@@ 145-165 (lines=21) @@ | ||
142 | $this->assertCount(1, $objects); |
|
143 | } |
|
144 | ||
145 | public function testObjectsToUpdateOnPublishIfVirtualExists() |
|
146 | { |
|
147 | $redir = PublishablePage::create(); |
|
148 | ||
149 | $stub = $this->getMockBuilder(PublishablePage::class) |
|
150 | ->setMethods(['getMyVirtualPages']) |
|
151 | ->getMock(); |
|
152 | ||
153 | $stub->expects($this->once()) |
|
154 | ->method('getMyVirtualPages') |
|
155 | ->will( |
|
156 | $this->returnValue( |
|
157 | new ArrayList([$redir]) |
|
158 | ) |
|
159 | ); |
|
160 | ||
161 | $objects = $stub->objectsToUpdate(['action' => 'publish']); |
|
162 | $this->assertContains($stub, $objects); |
|
163 | $this->assertContains($redir, $objects); |
|
164 | $this->assertCount(2, $objects); |
|
165 | } |
|
166 | ||
167 | public function testObjectsToDeleteOnUnpublishIfVirtualExists() |
|
168 | { |
|
@@ 167-189 (lines=23) @@ | ||
164 | $this->assertCount(2, $objects); |
|
165 | } |
|
166 | ||
167 | public function testObjectsToDeleteOnUnpublishIfVirtualExists() |
|
168 | { |
|
169 | $redir = PublishablePage::create(); |
|
170 | ||
171 | $stub = $this->getMockBuilder(PublishablePage::class) |
|
172 | ->setMethods(['getMyVirtualPages']) |
|
173 | ->getMock(); |
|
174 | ||
175 | $stub->Title = 'stub'; |
|
176 | ||
177 | $stub->expects($this->once()) |
|
178 | ->method('getMyVirtualPages') |
|
179 | ->will( |
|
180 | $this->returnValue( |
|
181 | new ArrayList([$redir]) |
|
182 | ) |
|
183 | ); |
|
184 | ||
185 | $objects = $stub->objectsToDelete(['action' => 'unpublish']); |
|
186 | $this->assertContains($stub, $objects); |
|
187 | $this->assertContains($redir, $objects); |
|
188 | $this->assertCount(2, $objects); |
|
189 | } |
|
190 | } |
|
191 |