|
@@ 127-154 (lines=28) @@
|
| 124 |
|
/** |
| 125 |
|
* @group DDC-2432 |
| 126 |
|
*/ |
| 127 |
|
public function testFailedProxyLoadingDoesNotMarkTheProxyAsInitialized() |
| 128 |
|
{ |
| 129 |
|
$classMetaData = $this->emMock->getClassMetadata(ECommerceFeature::class); |
| 130 |
|
|
| 131 |
|
$persister = $this |
| 132 |
|
->getMockBuilder(BasicEntityPersister::class) |
| 133 |
|
->setConstructorArgs([$this->emMock, $classMetaData]) |
| 134 |
|
->setMethods(['load']) |
| 135 |
|
->getMock(); |
| 136 |
|
|
| 137 |
|
$persister |
| 138 |
|
->expects($this->atLeastOnce()) |
| 139 |
|
->method('load') |
| 140 |
|
->will($this->returnValue(null)); |
| 141 |
|
|
| 142 |
|
$this->uowMock->setEntityPersister(ECommerceFeature::class, $persister); |
| 143 |
|
|
| 144 |
|
/* @var $proxy GhostObjectInterface|ECommerceFeature */ |
| 145 |
|
$proxy = $this->proxyFactory->getProxy($classMetaData, ['id' => 42]); |
| 146 |
|
|
| 147 |
|
try { |
| 148 |
|
$proxy->getDescription(); |
| 149 |
|
$this->fail('An exception was expected to be raised'); |
| 150 |
|
} catch (EntityNotFoundException $exception) { |
| 151 |
|
} |
| 152 |
|
|
| 153 |
|
self::assertFalse($proxy->isProxyInitialized()); |
| 154 |
|
} |
| 155 |
|
|
| 156 |
|
/** |
| 157 |
|
* @group DDC-2432 |
|
@@ 159-186 (lines=28) @@
|
| 156 |
|
/** |
| 157 |
|
* @group DDC-2432 |
| 158 |
|
*/ |
| 159 |
|
public function testFailedProxyCloningDoesNotMarkTheProxyAsInitialized() |
| 160 |
|
{ |
| 161 |
|
$classMetaData = $this->emMock->getClassMetadata(ECommerceFeature::class); |
| 162 |
|
|
| 163 |
|
$persister = $this |
| 164 |
|
->getMockBuilder(BasicEntityPersister::class) |
| 165 |
|
->setConstructorArgs([$this->emMock, $classMetaData]) |
| 166 |
|
->setMethods(['load']) |
| 167 |
|
->getMock(); |
| 168 |
|
|
| 169 |
|
$persister |
| 170 |
|
->expects($this->atLeastOnce()) |
| 171 |
|
->method('load') |
| 172 |
|
->will($this->returnValue(null)); |
| 173 |
|
|
| 174 |
|
$this->uowMock->setEntityPersister(ECommerceFeature::class, $persister); |
| 175 |
|
|
| 176 |
|
/* @var $proxy GhostObjectInterface|ECommerceFeature */ |
| 177 |
|
$proxy = $this->proxyFactory->getProxy($classMetaData, ['id' => 42]); |
| 178 |
|
|
| 179 |
|
try { |
| 180 |
|
$cloned = clone $proxy; |
| 181 |
|
$this->fail('An exception was expected to be raised'); |
| 182 |
|
} catch (EntityNotFoundException $exception) { |
| 183 |
|
} |
| 184 |
|
|
| 185 |
|
self::assertFalse($proxy->isProxyInitialized()); |
| 186 |
|
} |
| 187 |
|
|
| 188 |
|
public function testProxyClonesParentFields() |
| 189 |
|
{ |