| @@ 175-189 (lines=15) @@ | ||
| 172 | $this->assertEquals($tags->count(), 2); |
|
| 173 | } |
|
| 174 | ||
| 175 | public function testConstructor() |
|
| 176 | { |
|
| 177 | $loader = new YamlLoader($this->kernel, array('SomeBundle'), 'DataFixtures'); |
|
| 178 | $loader->loadFixtures('construct'); |
|
| 179 | ||
| 180 | $repo = $this->doctrine->getManager()->getRepository('Khepin\Fixture\Document\Car'); |
|
| 181 | $car = $repo->findOneByName('Ford'); |
|
| 182 | $this->assertEquals('Ford', $car->getName()); |
|
| 183 | $this->assertInstanceOf('\DateTime', $car->getDatePurchased()); |
|
| 184 | ||
| 185 | $repo = $this->doctrine->getManager()->getRepository('Khepin\Fixture\Document\Owner'); |
|
| 186 | $owner = $repo->findOneByName('Some Small Company'); |
|
| 187 | $this->assertEquals(1, count($owner->getOwnedCars())); |
|
| 188 | $this->assertEquals('Some Small Company', $owner->getName()); |
|
| 189 | } |
|
| 190 | } |
|
| 191 | ||
| @@ 196-210 (lines=15) @@ | ||
| 193 | $this->assertEquals('BMW', $car2->getName()); |
|
| 194 | } |
|
| 195 | ||
| 196 | public function testConstructor() |
|
| 197 | { |
|
| 198 | $loader = new YamlLoader($this->kernel, array('SomeBundle'), 'DataFixtures'); |
|
| 199 | $loader->loadFixtures('construct'); |
|
| 200 | ||
| 201 | $repo = $this->doctrine->getManager()->getRepository('Khepin\Fixture\Entity\Car'); |
|
| 202 | $car = $repo->findOneByName('Ford'); |
|
| 203 | $this->assertEquals('Ford', $car->getName()); |
|
| 204 | $this->assertInstanceOf('\DateTime', $car->getDatePurchased()); |
|
| 205 | ||
| 206 | $repo = $this->doctrine->getManager()->getRepository('Khepin\Fixture\Entity\Owner'); |
|
| 207 | $owner = $repo->findOneByName('Some Small Company'); |
|
| 208 | $this->assertEquals(1, count($owner->getOwnedCars())); |
|
| 209 | $this->assertEquals('Some Small Company', $owner->getName()); |
|
| 210 | } |
|
| 211 | } |
|
| 212 | ||