From 0afc45f30050801b9d0e67b4a20c425b972f9272 Mon Sep 17 00:00:00 2001 From: netkas Date: Tue, 17 Sep 2024 22:17:22 -0400 Subject: [PATCH] Added ComponentTest.php --- tests/ncc/Objects/Package/ComponentTest.php | 71 +++++++++++++++++++++ 1 file changed, 71 insertions(+) create mode 100644 tests/ncc/Objects/Package/ComponentTest.php 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