Rajout de doctrine/orm
[zf2.biz/galerie.git] / vendor / doctrine / orm / tests / Doctrine / Tests / ORM / PersistentCollectionTest.php
1 <?php
2
3 namespace Doctrine\Tests\ORM;
4
5 use Doctrine\Common\Collections\ArrayCollection;
6 use Doctrine\ORM\PersistentCollection;
7 use Doctrine\Tests\Mocks\ConnectionMock;
8 use Doctrine\Tests\Mocks\EntityManagerMock;
9 use Doctrine\Tests\Models\ECommerce\ECommerceProduct;
10
11 require_once __DIR__ . '/../TestInit.php';
12
13 /**
14  * Tests the lazy-loading capabilities of the PersistentCollection.
15  * @author Giorgio Sironi <piccoloprincipeazzurro@gmail.com>
16  */
17 class PersistentCollectionTest extends \Doctrine\Tests\OrmTestCase
18 {
19     private $_connectionMock;
20     private $_emMock;
21
22     protected function setUp()
23     {
24         parent::setUp();
25         // SUT
26         $this->_connectionMock = new ConnectionMock(array(), new \Doctrine\Tests\Mocks\DriverMock());
27         $this->_emMock = EntityManagerMock::create($this->_connectionMock);
28     }
29
30     public function testCanBePutInLazyLoadingMode()
31     {
32         $class = $this->_emMock->getClassMetadata('Doctrine\Tests\Models\ECommerce\ECommerceProduct');
33         $collection = new PersistentCollection($this->_emMock, $class, new ArrayCollection);
34         $collection->setInitialized(false);
35         $this->assertFalse($collection->isInitialized());
36     }
37 }