@@ 144-158 (lines=15) @@ | ||
141 | $this->assertTrue('toyota' === $car->getName()); |
|
142 | } |
|
143 | ||
144 | public function testEmbedOne() |
|
145 | { |
|
146 | $loader = new YamlLoader($this->kernel, array('SomeBundle'), 'DataFixtures'); |
|
147 | $loader->loadFixtures('embed_one'); |
|
148 | ||
149 | $repo = $this->doctrine->getManager()->getRepository('Khepin\Fixture\Document\Article'); |
|
150 | $articles = $repo->createQueryBuilder()->getQuery()->execute(); |
|
151 | $this->assertEquals($articles->count(), 1); |
|
152 | $article = $articles->getNext(); |
|
153 | $this->assertInstanceOf('Khepin\Fixture\Document\Article', $article); |
|
154 | $author = $article->getAuthor(); |
|
155 | $this->assertInstanceOf('Khepin\Fixture\Document\Author', $author); |
|
156 | ||
157 | $this->assertEquals($author->getName(), 'Paul'); |
|
158 | } |
|
159 | ||
160 | public function testEmbedMany() |
|
161 | { |
|
@@ 160-173 (lines=14) @@ | ||
157 | $this->assertEquals($author->getName(), 'Paul'); |
|
158 | } |
|
159 | ||
160 | public function testEmbedMany() |
|
161 | { |
|
162 | $loader = new YamlLoader($this->kernel, array('SomeBundle'), 'DataFixtures'); |
|
163 | $loader->loadFixtures('embed_many'); |
|
164 | ||
165 | $repo = $this->doctrine->getManager()->getRepository('Khepin\Fixture\Document\Article'); |
|
166 | $articles = $repo->createQueryBuilder()->getQuery()->execute(); |
|
167 | $this->assertEquals($articles->count(), 1); |
|
168 | $article = $articles->getNext(); |
|
169 | $this->assertInstanceOf('Khepin\Fixture\Document\Article', $article); |
|
170 | $tags = $article->getTags(); |
|
171 | $this->assertEquals('YAML', $tags[0]->getName()); |
|
172 | $this->assertEquals($tags->count(), 2); |
|
173 | } |
|
174 | ||
175 | public function testConstructor() |
|
176 | { |