|
@@ 157-184 (lines=28) @@
|
| 154 |
|
/** |
| 155 |
|
* @group DDC-2432 |
| 156 |
|
*/ |
| 157 |
|
public function testFailedProxyLoadingDoesNotMarkTheProxyAsInitialized() |
| 158 |
|
{ |
| 159 |
|
$classMetaData = $this->emMock->getClassMetadata(ECommerceFeature::class); |
| 160 |
|
|
| 161 |
|
$persister = $this |
| 162 |
|
->getMockBuilder(BasicEntityPersister::class) |
| 163 |
|
->setConstructorArgs([$this->emMock, $classMetaData]) |
| 164 |
|
->setMethods(['load']) |
| 165 |
|
->getMock(); |
| 166 |
|
|
| 167 |
|
$persister |
| 168 |
|
->expects($this->atLeastOnce()) |
| 169 |
|
->method('load') |
| 170 |
|
->will($this->returnValue(null)); |
| 171 |
|
|
| 172 |
|
$this->uowMock->setEntityPersister(ECommerceFeature::class, $persister); |
| 173 |
|
|
| 174 |
|
/* @var $proxy GhostObjectInterface|ECommerceFeature */ |
| 175 |
|
$proxy = $this->proxyFactory->getProxy($classMetaData, ['id' => 42]); |
| 176 |
|
|
| 177 |
|
try { |
| 178 |
|
$proxy->getDescription(); |
| 179 |
|
$this->fail('An exception was expected to be raised'); |
| 180 |
|
} catch (EntityNotFoundException $exception) { |
| 181 |
|
} |
| 182 |
|
|
| 183 |
|
self::assertFalse($proxy->isProxyInitialized()); |
| 184 |
|
} |
| 185 |
|
|
| 186 |
|
/** |
| 187 |
|
* @group DDC-2432 |
|
@@ 189-216 (lines=28) @@
|
| 186 |
|
/** |
| 187 |
|
* @group DDC-2432 |
| 188 |
|
*/ |
| 189 |
|
public function testFailedProxyCloningDoesNotMarkTheProxyAsInitialized() |
| 190 |
|
{ |
| 191 |
|
$classMetaData = $this->emMock->getClassMetadata(ECommerceFeature::class); |
| 192 |
|
|
| 193 |
|
$persister = $this |
| 194 |
|
->getMockBuilder(BasicEntityPersister::class) |
| 195 |
|
->setConstructorArgs([$this->emMock, $classMetaData]) |
| 196 |
|
->setMethods(['load']) |
| 197 |
|
->getMock(); |
| 198 |
|
|
| 199 |
|
$persister |
| 200 |
|
->expects($this->atLeastOnce()) |
| 201 |
|
->method('load') |
| 202 |
|
->will($this->returnValue(null)); |
| 203 |
|
|
| 204 |
|
$this->uowMock->setEntityPersister(ECommerceFeature::class, $persister); |
| 205 |
|
|
| 206 |
|
/* @var $proxy GhostObjectInterface|ECommerceFeature */ |
| 207 |
|
$proxy = $this->proxyFactory->getProxy($classMetaData, ['id' => 42]); |
| 208 |
|
|
| 209 |
|
try { |
| 210 |
|
$cloned = clone $proxy; |
| 211 |
|
$this->fail('An exception was expected to be raised'); |
| 212 |
|
} catch (EntityNotFoundException $exception) { |
| 213 |
|
} |
| 214 |
|
|
| 215 |
|
self::assertFalse($proxy->isProxyInitialized()); |
| 216 |
|
} |
| 217 |
|
|
| 218 |
|
public function testProxyClonesParentFields() |
| 219 |
|
{ |