Exemplo n.º 1
0
 /**
  * {@inheritdoc}
  */
 public function convertToPHPValue($value)
 {
     if ($value === null) {
         return;
     }
     return Coordinate::fromLatLng($value['coordinates'][1], $value['coordinates'][0]);
 }
Exemplo n.º 2
0
 /**
  * Test get.
  */
 public function testGet()
 {
     parent::testGet();
     $this->given($repository = $this->randomRepository())->and($unique = $this->uniqueValue())->and($friend = new User(UserId::next(), 'Ivan', 32))->and($friend1 = new User(UserId::next(), 'Karel', 32))->and($repository->persist($friend))->and($repository->persist($friend1))->and($unique->addFriend($friend))->and($unique->addFriend($friend1))->and($repository->persist($unique))->when($object = $repository->get($unique->id()))->then()->object($object->fullName())->isEqualTo(StringLiteral::fromNative('Methuselah'))->integer($object->languagesLevel()->get('english'))->isEqualTo(10)->boolean($object->mainRole()->is(Role::ROLE_ADMIN))->isTrue()->array($object->roles()->toArray())->contains(Role::ROLE_ADMIN)->array($object->phonenumbers()->toArray())->contains('+34 685 165 267')->string($object->fax()->number())->isEqualTo('+34-208-1234567')->array($object->addresses()->toArray())->object[0]->isInstanceOf(Address::class)->string($object->addresses()->toArray()[0]->name())->isEqualTo('Home')->object($object->addresses()->toArray()[0]->coordinate())->isEqualTo(Coordinate::fromLatLng(41.390205, 2.154007))->integer($object->friends()->count())->isEqualTo(2);
 }