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