diff --git a/tests/Models/AttributeTest.php b/tests/Models/AttributeTest.php new file mode 100644 index 0000000..c3a950a --- /dev/null +++ b/tests/Models/AttributeTest.php @@ -0,0 +1,72 @@ +deepClone(); + + $attr->ref = 1; + + self::assertNotEquals($attr->ref, $clone->ref); + } + + public function testToArray() : void + { + $attr = new Attribute(); + + $array = $attr->toArray(); + + unset($array['type']); + unset($array['value']); + + self::assertEquals( + [ + 'id' => 0, + 'ref' => 0, + ], + $array + ); + } + + public function testJsonSerialize() : void + { + $attr = new Attribute(); + + $array = $attr->jsonSerialize(); + + unset($array['type']); + unset($array['value']); + + self::assertEquals( + [ + 'id' => 0, + 'ref' => 0, + ], + $array + ); + } +} diff --git a/tests/Models/NullAttributeTest.php b/tests/Models/NullAttributeTest.php new file mode 100644 index 0000000..ed3748d --- /dev/null +++ b/tests/Models/NullAttributeTest.php @@ -0,0 +1,52 @@ +id); + } + + /** + * @covers Modules\Attribute\Models\NullAttribute + * @group module + */ + public function testJsonSerialize() : void + { + $null = new NullAttribute(2); + self::assertEquals(['id' => 2], $null); + } +} diff --git a/tests/Models/NullAttributeTypeTest.php b/tests/Models/NullAttributeTypeTest.php new file mode 100644 index 0000000..173221b --- /dev/null +++ b/tests/Models/NullAttributeTypeTest.php @@ -0,0 +1,52 @@ +id); + } + + /** + * @covers Modules\Attribute\Models\NullAttributeType + * @group module + */ + public function testJsonSerialize() : void + { + $null = new NullAttributeType(2); + self::assertEquals(['id' => 2], $null); + } +} diff --git a/tests/Models/NullAttributeValueTest.php b/tests/Models/NullAttributeValueTest.php new file mode 100644 index 0000000..34c1411 --- /dev/null +++ b/tests/Models/NullAttributeValueTest.php @@ -0,0 +1,52 @@ +id); + } + + /** + * @covers Modules\Attribute\Models\NullAttributeValue + * @group module + */ + public function testJsonSerialize() : void + { + $null = new NullAttributeValue(2); + self::assertEquals(['id' => 2], $null); + } +}