37 yield [ $newSlots,
null, [
'A',
'B' ], [] ];
38 yield [ $newSlots, $parentSlots, [
'B' ], [
'C' ] ];
57 $this->assertEquals( $modified, $update->getModifiedRoles() );
58 $this->assertEquals( $removed, $update->getRemovedRoles() );
60 foreach ( $modified
as $role ) {
61 $this->assertSame( $newSlots->
getSlot( $role ), $update->getModifiedSlot( $role ) );
81 yield [ $newContent,
null, [
'A',
'B' ] ];
82 yield [ $newContent, $parentSlots, [
'B' ] ];
99 $this->assertEquals( $modified, $update->getModifiedRoles() );
100 $this->assertEmpty( $update->getRemovedRoles() );
106 $this->assertEmpty( $update->getModifiedRoles() );
107 $this->assertEmpty( $update->getRemovedRoles() );
112 $this->assertEquals( [
'A' ], $update->getModifiedRoles() );
113 $this->assertEmpty( $update->getRemovedRoles() );
117 $this->assertEquals( [
'A' ], $update->getModifiedRoles() );
118 $this->assertEquals( [
'X' ], $update->getRemovedRoles() );
124 $this->assertSame( [], $slots->getModifiedRoles() );
125 $this->assertSame( [], $slots->getRemovedRoles() );
128 $slots->modifySlot( $slotA );
129 $this->assertTrue( $slots->isModifiedSlot(
'some' ) );
130 $this->assertFalse( $slots->isRemovedSlot(
'some' ) );
131 $this->assertSame( $slotA, $slots->getModifiedSlot(
'some' ) );
132 $this->assertSame( [
'some' ], $slots->getModifiedRoles() );
133 $this->assertSame( [], $slots->getRemovedRoles() );
136 $slots->modifySlot( $slotB );
137 $this->assertTrue( $slots->isModifiedSlot(
'other' ) );
138 $this->assertFalse( $slots->isRemovedSlot(
'other' ) );
139 $this->assertSame( $slotB, $slots->getModifiedSlot(
'other' ) );
140 $this->assertSame( [
'some',
'other' ], $slots->getModifiedRoles() );
141 $this->assertSame( [], $slots->getRemovedRoles() );
144 $slots->modifySlot( $slotA );
148 $slots->removeSlot(
'some' );
149 $this->assertSame( [
'other' ], $slots->getModifiedRoles() );
150 $this->assertSame( [
'some' ], $slots->getRemovedRoles() );
153 $slots->modifySlot( $slotA );
155 $this->assertSame( [], $slots->getRemovedRoles() );
162 $slots->modifySlot( $slotA );
164 $this->assertSame( [
'main' ], $slots->getModifiedRoles() );
167 $slots->removeSlot(
'other' );
168 $this->assertSame( [], $slots->getModifiedRoles() );
169 $this->assertSame( [
'main',
'other' ], $slots->getRemovedRoles() );
171 $this->assertTrue( $slots->isRemovedSlot(
'other' ) );
185 $this->assertSame( [], $slots->getModifiedRoles() );
189 $this->assertSame( [
'main',
'foo' ], $slots->getModifiedRoles() );
192 $this->assertSame( [
'foo' ], $slots->getModifiedRoles() );
199 $this->assertSame( [], $slots->getRemovedRoles() );
204 $this->assertSame( [
'main',
'foo' ], $slots->getRemovedRoles() );
207 $this->assertSame( [
'foo' ], $slots->getRemovedRoles() );
215 $a->modifySlot( $fooX );
216 $a->modifySlot( $barZ );
217 $a->removeSlot(
'Q' );
220 $a2->modifySlot( $fooX );
221 $a2->modifySlot( $barZ );
222 $a2->removeSlot(
'Q' );
225 $b->modifySlot( $barZ );
226 $b->removeSlot(
'Q' );
229 $c->modifySlot( $fooX );
230 $c->modifySlot( $barZ );
232 yield
'same instance' => [ $a, $a,
true ];
233 yield
'same udpates' => [ $a, $a2,
true ];
235 yield
'different modified' => [ $a, $b,
false ];
236 yield
'different removed' => [ $a, $c,
false ];
269 $update->removeSlot(
'Z' );
271 $update->apply( $slots );
272 $this->assertSame( [
'X',
'Y',
'A' ], $slots->getSlotRoles() );
273 $this->assertSame( $update->getModifiedSlot(
'A' ), $slots->getSlot(
'A' ) );
274 $this->assertSame( $update->getModifiedSlot(
'Y' ), $slots->getSlot(
'Y' ) );