Skip to content

Instantly share code, notes, and snippets.

@mikeemoo
Created May 29, 2012 14:55
Show Gist options
  • Select an option

  • Save mikeemoo/2828884 to your computer and use it in GitHub Desktop.

Select an option

Save mikeemoo/2828884 to your computer and use it in GitHub Desktop.
InheritanceFunctionalTest
<?php
namespace Lowpress\CmsBundle\Tests\Entity;
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
class InheritanceFunctionalTest extends WebTestCase
{
/**
* @var \Doctrine\ORM\EntityManager
*/
private $em;
public function setUp()
{
$kernel = static::createKernel();
$kernel->boot();
$this->em = $kernel->getContainer()->get('doctrine.orm.entity_manager');
}
public function testSelectHtmlPage()
{
$repos = $this->em->getRepository('LowpressCmsBundle:HtmlPage');
$results = $repos->findAll();
$this->assertGreaterThanOrEqual(1, count($results));
$result = $results[0];
$this->assertEquals('Lowpress\CmsBundle\Entity\HtmlPage', get_class($result));
$this->assertEquals('my/html/page', $result->getUrl());
}
public function testSelectAllPaths()
{
$repos = $this->em->getRepository('LowpressCmsBundle:Path');
$results = $repos->findAll();
$this->assertGreaterThanOrEqual(2, count($results));
$this->assertEquals('Lowpress\CmsBundle\Entity\HtmlPage', get_class($results[0]));
$this->assertEquals('my/html/page', $results[0]->getUrl());
$this->assertEquals('Lowpress\CmsBundle\Entity\Path', get_class($results[1]));
$this->assertEquals('my/page/url', $results[1]->getUrl());
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment