Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- namespace TMS\OpenBundle\Tests\Controller;
- use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
- class DefaultControllerTest extends WebTestCase {
- /**
- * @var \Doctrine\ORM\EntityManager
- */
- private $em;
- /**
- * {@inheritDoc}
- */
- public function setUp() {
- static::$kernel = static::createKernel();
- static::$kernel->boot();
- $this->em = static::$kernel->getContainer()
- ->get('doctrine')
- ->getManager()
- ;
- $f = $this->em->getFilters()->enable('is_active');
- $f->setParameter('is_active', true);
- $childRecord = new \TMS\OpenBundle\Entity\ChildClass();
- $childRecord->setIsActive(false);
- $this->em->persist($childRecord);
- $this->em->flush();
- $assocClass = new \TMS\OpenBundle\Entity\AssocClass();
- $assocClass->setChild($childRecord);
- $this->em->persist($assocClass);
- $this->em->flush();
- $this->em->clear();
- }
- public function testSearchByCategoryName() {
- $q = 'SELECT a,child FROM TMSOpenBundle:AssocClass a JOIN a.child child';
- $q = $this->em->createQuery($q);
- $records = $q->getResult();
- $this->assertCount(0, $records);
- }
- /**
- * {@inheritDoc}
- */
- protected function tearDown() {
- parent::tearDown();
- $this->em->close();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement