@@ 91-105 (lines=15) @@ | ||
88 | $this->assertEquals(count($drivers), 0); |
|
89 | } |
|
90 | ||
91 | public function testContext() |
|
92 | { |
|
93 | $loader = new YamlLoader($this->kernel, array('SomeBundle'), 'DataFixtures'); |
|
94 | $loader->loadFixtures('french_cars'); |
|
95 | ||
96 | $repo = $this->doctrine->getManager()->getRepository('Khepin\Fixture\Document\Car'); |
|
97 | $cars = $repo->findAll(); |
|
98 | $this->assertEquals(5, count($cars)); |
|
99 | ||
100 | $car = $repo->findOneBy(array('name' => 'Peugeot')); |
|
101 | $this->assertEquals('Peugeot', $car->getName()); |
|
102 | ||
103 | $car = $repo->findOneBy(array('name' => 'BMW')); |
|
104 | $this->assertEquals('BMW', $car->getName()); |
|
105 | } |
|
106 | ||
107 | public function testReferenceOne() |
|
108 | { |
@@ 79-93 (lines=15) @@ | ||
76 | $this->assertEquals(0, count($drivers)); |
|
77 | } |
|
78 | ||
79 | public function testContext() |
|
80 | { |
|
81 | $loader = new YamlLoader($this->kernel, array('SomeBundle'), 'DataFixtures'); |
|
82 | $loader->loadFixtures('french_cars'); |
|
83 | ||
84 | $repo = $this->doctrine->getEntityManager()->getRepository('Khepin\Fixture\Entity\Car'); |
|
85 | $cars = $repo->findAll(); |
|
86 | $this->assertEquals(4, count($cars)); |
|
87 | ||
88 | $car = $repo->findOneBy(array('name' => 'Peugeot')); |
|
89 | $this->assertEquals('Peugeot', $car->getName()); |
|
90 | ||
91 | $car = $repo->findOneBy(array('name' => 'BMW')); |
|
92 | $this->assertEquals('BMW', $car->getName()); |
|
93 | } |
|
94 | ||
95 | public function testWithAssociation() |
|
96 | { |
|
@@ 95-107 (lines=13) @@ | ||
92 | $this->assertEquals('BMW', $car->getName()); |
|
93 | } |
|
94 | ||
95 | public function testWithAssociation() |
|
96 | { |
|
97 | $loader = new YamlLoader($this->kernel, array('SomeBundle'), 'DataFixtures'); |
|
98 | $loader->loadFixtures('with_drivers'); |
|
99 | ||
100 | $repo = $this->doctrine->getEntityManager()->getRepository('Khepin\Fixture\Entity\Driver'); |
|
101 | $driver = $repo->findOneBy(array('name' => 'Mom')); |
|
102 | $this->assertEquals($driver->getCar()->getName(), 'Mercedes'); |
|
103 | $driver = $repo->findOneBy(array('name' => 'Dad')); |
|
104 | $this->assertEquals($driver->getCar()->getName(), 'BMW'); |
|
105 | ||
106 | $this->assertEquals(get_class($driver->getCar()), 'Khepin\Fixture\Entity\Car'); |
|
107 | } |
|
108 | ||
109 | public function testPurge() |
|
110 | { |