Exemple #1
0
 public function testSerializeWithEmptyCountable()
 {
     $country = new Country();
     $country->setName('France');
     $country->citiesInTraversable(new \ArrayObject());
     $configuration = new Configuration();
     $configurationObject = new Configuration\Object(new ClassName(City::class));
     $configurationObject->attributeUseMethod('name', 'setName', 'getName')->attributeUseObject('country', new ClassName(Country::class), 'countryIs', 'getCountry')->registerToConfiguration($configuration);
     $configurationObject = new Configuration\Object(new ClassName(Country::class));
     $configurationObject->attributeUseMethod('name', 'setName', 'getName')->registerToConfiguration($configuration);
     $this->given($this->newTestedInstance($configuration))->string($this->testedInstance->serialize($country))->isIdenticalTo('{"name":"France"}');
 }
Exemple #2
0
 public function deserialize($object, $value)
 {
     $country = new Country();
     $country->setName($value['name']);
     $object->countryIs($country);
 }
 public function deserialize($object, $value)
 {
     $country = new Country();
     $country->setName(str_replace(' (Handler please remove me)', '', $value['name']));
     $object->countryIs($country);
     $object->setName(str_replace(' (Handler please remove me if i have a country)', '', $object->getName()));
 }