|
@@ 122-144 (lines=23) @@
|
| 119 |
|
/** |
| 120 |
|
* @group DDC-2432 |
| 121 |
|
*/ |
| 122 |
|
public function testFailedProxyLoadingDoesNotMarkTheProxyAsInitialized() |
| 123 |
|
{ |
| 124 |
|
$persister = $this->getMockBuilder(BasicEntityPersister::class)->setMethods(['load'])->disableOriginalConstructor()->getMock(); |
| 125 |
|
$this->uowMock->setEntityPersister(ECommerceFeature::class, $persister); |
| 126 |
|
|
| 127 |
|
/* @var $proxy \Doctrine\Common\Proxy\Proxy */ |
| 128 |
|
$proxy = $this->proxyFactory->getProxy(ECommerceFeature::class, ['id' => 42]); |
| 129 |
|
|
| 130 |
|
$persister |
| 131 |
|
->expects($this->atLeastOnce()) |
| 132 |
|
->method('load') |
| 133 |
|
->will($this->returnValue(null)); |
| 134 |
|
|
| 135 |
|
try { |
| 136 |
|
$proxy->getDescription(); |
| 137 |
|
$this->fail('An exception was expected to be raised'); |
| 138 |
|
} catch (EntityNotFoundException $exception) { |
| 139 |
|
} |
| 140 |
|
|
| 141 |
|
$this->assertFalse($proxy->__isInitialized()); |
| 142 |
|
$this->assertInstanceOf('Closure', $proxy->__getInitializer(), 'The initializer wasn\'t removed'); |
| 143 |
|
$this->assertInstanceOf('Closure', $proxy->__getCloner(), 'The cloner wasn\'t removed'); |
| 144 |
|
} |
| 145 |
|
|
| 146 |
|
/** |
| 147 |
|
* @group DDC-2432 |
|
@@ 149-171 (lines=23) @@
|
| 146 |
|
/** |
| 147 |
|
* @group DDC-2432 |
| 148 |
|
*/ |
| 149 |
|
public function testFailedProxyCloningDoesNotMarkTheProxyAsInitialized() |
| 150 |
|
{ |
| 151 |
|
$persister = $this->getMockBuilder(BasicEntityPersister::class)->setMethods(['load'])->disableOriginalConstructor()->getMock(); |
| 152 |
|
$this->uowMock->setEntityPersister(ECommerceFeature::class, $persister); |
| 153 |
|
|
| 154 |
|
/* @var $proxy \Doctrine\Common\Proxy\Proxy */ |
| 155 |
|
$proxy = $this->proxyFactory->getProxy(ECommerceFeature::class, ['id' => 42]); |
| 156 |
|
|
| 157 |
|
$persister |
| 158 |
|
->expects($this->atLeastOnce()) |
| 159 |
|
->method('load') |
| 160 |
|
->will($this->returnValue(null)); |
| 161 |
|
|
| 162 |
|
try { |
| 163 |
|
$cloned = clone $proxy; |
| 164 |
|
$this->fail('An exception was expected to be raised'); |
| 165 |
|
} catch (EntityNotFoundException $exception) { |
| 166 |
|
} |
| 167 |
|
|
| 168 |
|
$this->assertFalse($proxy->__isInitialized()); |
| 169 |
|
$this->assertInstanceOf('Closure', $proxy->__getInitializer(), 'The initializer wasn\'t removed'); |
| 170 |
|
$this->assertInstanceOf('Closure', $proxy->__getCloner(), 'The cloner wasn\'t removed'); |
| 171 |
|
} |
| 172 |
|
|
| 173 |
|
public function testProxyClonesParentFields() |
| 174 |
|
{ |