DDC949Test.php 1.3KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. <?php
  2. namespace Doctrine\Tests\ORM\Functional\Ticket;
  3. use Doctrine\Common\Collections\ArrayCollection;
  4. use Doctrine\Tests\Models\Generic\BooleanModel;
  5. require_once __DIR__ . '/../../../TestInit.php';
  6. class DDC949Test extends \Doctrine\Tests\OrmFunctionalTestCase
  7. {
  8. public function setUp()
  9. {
  10. $this->useModelSet('generic');
  11. parent::setUp();
  12. }
  13. /**
  14. * @group DDC-949
  15. */
  16. public function testBooleanThroughRepository()
  17. {
  18. $true = new BooleanModel();
  19. $true->booleanField = true;
  20. $false = new BooleanModel();
  21. $false->booleanField = false;
  22. $this->_em->persist($true);
  23. $this->_em->persist($false);
  24. $this->_em->flush();
  25. $this->_em->clear();
  26. $true = $this->_em->getRepository('Doctrine\Tests\Models\Generic\BooleanModel')->findOneBy(array('booleanField' => true));
  27. $false = $this->_em->getRepository('Doctrine\Tests\Models\Generic\BooleanModel')->findOneBy(array('booleanField' => false));
  28. $this->assertInstanceOf('Doctrine\Tests\Models\Generic\BooleanModel', $true);
  29. $this->assertTrue($true->booleanField, "True Boolean Model should be true.");
  30. $this->assertInstanceOf('Doctrine\Tests\Models\Generic\BooleanModel', $false);
  31. $this->assertFalse($false->booleanField, "False Boolean Model should be false.");
  32. }
  33. }