*/ class PersistentCollectionTest extends \Doctrine\Tests\OrmTestCase { private $_connectionMock; private $_emMock; protected function setUp() { parent::setUp(); // SUT $this->_connectionMock = new ConnectionMock(array(), new \Doctrine\Tests\Mocks\DriverMock()); $this->_emMock = EntityManagerMock::create($this->_connectionMock); } public function testCanBePutInLazyLoadingMode() { $class = $this->_emMock->getClassMetadata('Doctrine\Tests\Models\ECommerce\ECommerceProduct'); $collection = new PersistentCollection($this->_emMock, $class, new ArrayCollection); $collection->setInitialized(false); } public function testQueriesAssociationToLoadItself() { $class = $this->_emMock->getClassMetadata('Doctrine\Tests\Models\ECommerce\ECommerceProduct'); $collection = new PersistentCollection($this->_emMock, $class, new ArrayCollection); $collection->setInitialized(false); $association = $this->getMock('Doctrine\ORM\Mapping\OneToManyMapping', array('load'), array(), '', false, false, false); $association->targetEntityName = 'Doctrine\Tests\Models\ECommerce\ECommerceFeature'; $product = new ECommerceProduct(); $association->expects($this->once()) ->method('load') ->with($product, $this->isInstanceOf($collection), $this->isInstanceOf($this->_emMock)); $collection->setOwner($product, $association); count($collection); } }