diff --git a/tests/ncc/Objects/Package/ComponentTest.php b/tests/ncc/Objects/Package/ComponentTest.php new file mode 100644 index 0000000..40f5cf1 --- /dev/null +++ b/tests/ncc/Objects/Package/ComponentTest.php @@ -0,0 +1,71 @@ +assertSame('TestName', $component->getName()); + $this->assertSame([], $component->getFlags()); + $this->assertSame(ComponentDataType::PLAIN, $component->getDataType()); + $this->assertSame('TestData', $component->getData()); + } + + /** + * Test creation of a new instance with binary data type + */ + public function testNewInstanceWithBinaryDataType(): void + { + $component = new Component('TestName', 'TestData', ComponentDataType::BINARY); + + $this->assertSame('TestName', $component->getName()); + $this->assertSame([], $component->getFlags()); + $this->assertSame(ComponentDataType::BINARY, $component->getDataType()); + $this->assertSame('TestData', $component->getData()); + } + + /** + * Test creation of a new instance with base64 encoded data type + */ + public function testNewInstanceWithBase64EncodedDataType(): void + { + $component = new Component('TestName', base64_encode('TestData'), ComponentDataType::BASE64_ENCODED); + + $this->assertSame('TestName', $component->getName()); + $this->assertSame([], $component->getFlags()); + $this->assertSame(ComponentDataType::BASE64_ENCODED, $component->getDataType()); + $this->assertSame('TestData', $component->getData()); + } +} \ No newline at end of file