@@ 254-269 (lines=16) @@ | ||
251 | self::assertFalse($persister->removeElement($collection, $element)); |
|
252 | } |
|
253 | ||
254 | public function testInvokeGet() |
|
255 | { |
|
256 | $entity = new State("Foo"); |
|
257 | $element = new State("Bar"); |
|
258 | $persister = $this->createPersisterDefault(); |
|
259 | $collection = $this->createCollection($entity); |
|
260 | ||
261 | $this->em->getUnitOfWork()->registerManaged($entity, ['id'=>1], ['id'=>1, 'name'=>'Foo']); |
|
262 | ||
263 | $this->collectionPersister->expects($this->once()) |
|
264 | ->method('get') |
|
265 | ->with($this->equalTo($collection), $this->equalTo(0)) |
|
266 | ->will($this->returnValue($element)); |
|
267 | ||
268 | self::assertEquals($element, $persister->get($collection, 0)); |
|
269 | } |
|
270 | } |
|
271 |
@@ 57-73 (lines=17) @@ | ||
54 | ->getMock(); |
|
55 | } |
|
56 | ||
57 | public function testDeleteShouldLockItem() |
|
58 | { |
|
59 | $entity = new State("Foo"); |
|
60 | $lock = Lock::createLockRead(); |
|
61 | $persister = $this->createPersisterDefault(); |
|
62 | $collection = $this->createCollection($entity); |
|
63 | $key = new CollectionCacheKey(State::class, 'cities', ['id'=>1]); |
|
64 | ||
65 | $this->region->expects($this->once()) |
|
66 | ->method('lock') |
|
67 | ->with($this->equalTo($key)) |
|
68 | ->will($this->returnValue($lock)); |
|
69 | ||
70 | $this->em->getUnitOfWork()->registerManaged($entity, ['id'=>1], ['id'=>1, 'name'=>'Foo']); |
|
71 | ||
72 | $persister->delete($collection); |
|
73 | } |
|
74 | ||
75 | public function testUpdateShouldLockItem() |
|
76 | { |
|
@@ 75-91 (lines=17) @@ | ||
72 | $persister->delete($collection); |
|
73 | } |
|
74 | ||
75 | public function testUpdateShouldLockItem() |
|
76 | { |
|
77 | $entity = new State("Foo"); |
|
78 | $lock = Lock::createLockRead(); |
|
79 | $persister = $this->createPersisterDefault(); |
|
80 | $collection = $this->createCollection($entity); |
|
81 | $key = new CollectionCacheKey(State::class, 'cities', ['id'=>1]); |
|
82 | ||
83 | $this->region->expects($this->once()) |
|
84 | ->method('lock') |
|
85 | ->with($this->equalTo($key)) |
|
86 | ->will($this->returnValue($lock)); |
|
87 | ||
88 | $this->em->getUnitOfWork()->registerManaged($entity, ['id'=>1], ['id'=>1, 'name'=>'Foo']); |
|
89 | ||
90 | $persister->update($collection); |
|
91 | } |
|
92 | ||
93 | public function testUpdateTransactionRollBackShouldEvictItem() |
|
94 | { |
@@ 52-67 (lines=16) @@ | ||
49 | ->getMock(); |
|
50 | } |
|
51 | ||
52 | public function testDeleteShouldLockItem() |
|
53 | { |
|
54 | $entity = new Country("Foo"); |
|
55 | $lock = Lock::createLockRead(); |
|
56 | $persister = $this->createPersisterDefault(); |
|
57 | $key = new EntityCacheKey(Country::class, ['id'=>1]); |
|
58 | ||
59 | $this->region->expects($this->once()) |
|
60 | ->method('lock') |
|
61 | ->with($this->equalTo($key)) |
|
62 | ->will($this->returnValue($lock)); |
|
63 | ||
64 | $this->em->getUnitOfWork()->registerManaged($entity, ['id'=>1], ['id'=>1, 'name'=>'Foo']); |
|
65 | ||
66 | $persister->delete($entity); |
|
67 | } |
|
68 | ||
69 | public function testUpdateShouldLockItem() |
|
70 | { |
|
@@ 69-84 (lines=16) @@ | ||
66 | $persister->delete($entity); |
|
67 | } |
|
68 | ||
69 | public function testUpdateShouldLockItem() |
|
70 | { |
|
71 | $entity = new Country("Foo"); |
|
72 | $lock = Lock::createLockRead(); |
|
73 | $persister = $this->createPersisterDefault(); |
|
74 | $key = new EntityCacheKey(Country::class, ['id'=>1]); |
|
75 | ||
76 | $this->region->expects($this->once()) |
|
77 | ->method('lock') |
|
78 | ->with($this->equalTo($key)) |
|
79 | ->will($this->returnValue($lock)); |
|
80 | ||
81 | $this->em->getUnitOfWork()->registerManaged($entity, ['id'=>1], ['id'=>1, 'name'=>'Foo']); |
|
82 | ||
83 | $persister->update($entity); |
|
84 | } |
|
85 | ||
86 | public function testUpdateTransactionRollBackShouldEvictItem() |
|
87 | { |