public function testLoadSelfReferencing() { $fixtures = <<<YAML Propel\\PropelBundle\\Tests\\Fixtures\\DataFixtures\\Loader\\BookAuthor: BookAuthor_1: id: '1' name: 'to be announced' BookAuthor_2: id: BookAuthor_1 name: 'A famous one' YAML; $filename = $this->getTempFile($fixtures); $loader = new YamlDataLoader(__DIR__ . '/../../Fixtures/DataFixtures/Loader'); $loader->load(array($filename), 'default'); $books = \Propel\PropelBundle\Tests\Fixtures\DataFixtures\Loader\BookPeer::doSelect(new \Criteria(), $this->con); $this->assertCount(0, $books); $authors = \Propel\PropelBundle\Tests\Fixtures\DataFixtures\Loader\BookAuthorPeer::doSelect(new \Criteria(), $this->con); $this->assertCount(1, $authors); $author = $authors[0]; $this->assertEquals('A famous one', $author->getName()); }
public function testLoadWithoutFaker() { $fixtures = <<<YAML Propel\\PropelBundle\\Tests\\Fixtures\\DataFixtures\\Loader\\BookAuthor: BookAuthor_1: id: '1' name: <?php echo \$faker('word'); ?> YAML; $filename = $this->getTempFile($fixtures); $loader = new YamlDataLoader(__DIR__ . '/../../Fixtures/DataFixtures/Loader'); $loader->load(array($filename), 'default'); $books = \Propel\PropelBundle\Tests\Fixtures\DataFixtures\Loader\BookPeer::doSelect(new \Criteria(), $this->con); $this->assertCount(0, $books); $authors = \Propel\PropelBundle\Tests\Fixtures\DataFixtures\Loader\BookAuthorPeer::doSelect(new \Criteria(), $this->con); $this->assertCount(1, $authors); $author = $authors[0]; $this->assertEquals('word', $author->getName()); }