コード例 #1
0
 public function testAccessors()
 {
     $favouritePlace = new FavouritePlace();
     $favouritePlace->setId('12345');
     $favouritePlace->setLabel('Home');
     $favouritePlace->setGeolocation(new Geolocation(52.9549135, -1.1582327));
     $favouritePlace->setStops(['3390Y4', '3390Y3']);
     $this->assertEquals('12345', $favouritePlace->getId());
     $this->assertEquals('Home', $favouritePlace->getLabel());
     $this->assertInstanceOf('Base\\Geospatial\\Geolocation', $favouritePlace->getGeolocation());
     $this->assertEquals(['3390Y4', '3390Y3'], $favouritePlace->getStops());
 }
コード例 #2
0
 public function testNormalization()
 {
     $category = new FavouritePlaceCategory();
     $category->setId('id');
     $category->setLabel('Label');
     $favouritePlace = new FavouritePlace();
     $favouritePlace->setCategory($category);
     $favouritePlace->setLabel('City Centre');
     $favouritePlace->setLocation('NG1 5AW');
     $favouritePlace->setGeolocation(new Geolocation(52.9549135, -1.1582327));
     $favouritePlace->setStops([new AtcoCode('3390Y4'), new AtcoCode('3390Y3'), new AtcoCode('3390Y2')]);
     $data = $this->extension->normalize($this->serializer, [$favouritePlace]);
     $this->assertInternalType('array', $data);
 }
コード例 #3
0
 public function testNormalization()
 {
     $favouritePlace = new FavouritePlace();
     $favouritePlace->setLabel('City Centre');
     $favouritePlace->setLocation('NG1 5AW');
     $favouritePlace->setGeolocation(new Geolocation(52.9549135, -1.1582327));
     $favouritePlace->setStops([new AtcoCode('3390Y4'), new AtcoCode('3390Y3'), new AtcoCode('3390Y2')]);
     $category = new FavouritePlaceCategory();
     $category->setLabel('Label');
     $category->setId('id');
     $favouritePlace->setCategory($category);
     $normalized = $this->serializer->normalize($favouritePlace);
     $this->assertEquals($this->getNormalized(), $normalized);
 }