public function testDeserializePostExclusion() { /** @var ExclusionClass $entity */ $entity = $this->serializer->deserialize(self::$data['rawData']); $this->assertTrue($entity instanceof ExclusionClass); $this->assertNotEquals($entity, self::$data['originalData']); $this->assertEmpty($entity->__get('internalProperty')); $this->assertNotEquals($entity->__get('internalProperty'), $this->instance->__get('internalProperty')); $this->assertEmpty($entity->__get('isExcluded')); $this->assertNotEquals($entity->__get('isExcluded'), $this->instance->__get('isExcluded')); $this->assertNotEmpty($entity->__get('propertyOne')); $this->assertEquals($entity->__get('propertyOne'), $this->instance->__get('propertyOne')); $this->assertNotEmpty($entity->__get('propertyTwo')); $this->assertEquals($entity->__get('propertyTwo'), $this->instance->__get('propertyTwo')); }
public function testConstructorWithArgumentsIsCorrectlyHandled() { $expected = 'This is a test string value'; $instance = new ConstructorWithArgumentsClass($expected); $this->assertEquals($expected, $instance->__get('someValue')); $serializedInstance = self::$instance->serialize($instance); $deserializedInstance = self::$instance->deserialize($serializedInstance); $this->assertEquals($instance->__get('someValue'), $deserializedInstance->__get('someValue')); }
public function testDeserializeCorrectlyMapsProperties() { $remappedClass = $this->serializer->deserialize(self::$serializedMappedInstance); $mappedClass = json_decode(self::$serializedMappedInstance, true); $this->assertNotEquals($remappedClass, $mappedClass); foreach ($remappedClass as $item) { $this->assertTrue(in_array($item, $mappedClass)); } $this->assertEquals($remappedClass, $this->serializer->deserialize(self::$serializedMappedInstance)); }