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 testMapProperty() { $initialProperty = 'mappedPropertyOne'; $expectedProperty = 'propertyThree'; $mappedInstance = $this->instance->mapProperty($initialProperty, $this->serializer->getConfiguration()); $mappedArray = (array) $mappedInstance; $this->assertArrayHasKey($expectedProperty, $mappedArray); $this->assertArrayNotHasKey('*' . $initialProperty, $mappedArray); }