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