protected function setUp()
 {
     parent::setUp();
     $client = $this->createClient();
     /** @var EntityManager $manager */
     $manager = $client->getContainer()->get("doctrine.orm.default_entity_manager");
     $toyota = new Car();
     $toyota->setName("Toyota")->setPlateNumber("KJ342");
     $manager->persist($toyota);
     $car = new Car();
     $car->setName("Ford")->setPlateNumber("AA123")->addRelatedCar($toyota);
     $manager->persist($car);
     $this->records[] = $car;
     $car = new Car();
     $car->setName("Honda")->setPlateNumber("BB243");
     $manager->persist($car);
     $this->records[] = $car;
     $this->records[] = $toyota;
     $manager->flush();
     /** @var RestYamlCollectionLoader $loader */
     $loader = $client->getContainer()->get("fos_rest.routing.loader.yaml_collection");
     $router = $client->getContainer()->get('router');
     $router->getRouteCollection()->addCollection($loader->load(__DIR__ . '/../../Fixtures/Test/TestBundle/Resources/config/routing.rest.yml'));
     $this->client = $client;
 }
Beispiel #2
0
 /**
  * Add cars
  *
  * @param Car $cars
  * @return CarOwner
  */
 public function addCar(Car $cars)
 {
     $this->cars[] = $cars;
     $cars->setCarOwner($this);
     return $this;
 }