Code Duplication    Length = 15-18 lines in 5 locations

tests/AuditHookTest.php 5 locations

@@ 173-187 (lines=15) @@
170
        $this->assertContains('My page', $message);
171
    }
172
173
    public function testUnpublishPage()
174
    {
175
        $this->logInWithPermission('ADMIN');
176
177
        $page = new \Page();
178
        $page->Title = 'My page';
179
        $page->Content = 'This is my page content';
180
        $page->doPublish();
181
        $page->doUnpublish();
182
183
        $message = $this->writer->getLastMessage();
184
        $this->assertContains('[email protected]', $message);
185
        $this->assertContains('unpublished Page', $message);
186
        $this->assertContains('My page', $message);
187
    }
188
189
    public function testDuplicatePage()
190
    {
@@ 189-203 (lines=15) @@
186
        $this->assertContains('My page', $message);
187
    }
188
189
    public function testDuplicatePage()
190
    {
191
        $this->logInWithPermission('ADMIN');
192
193
        $page = new \Page();
194
        $page->Title = 'My page';
195
        $page->Content = 'This is my page content';
196
        $page->write();
197
        $page->duplicate();
198
199
        $message = $this->writer->getLastMessage();
200
        $this->assertContains('[email protected]', $message);
201
        $this->assertContains('duplicated Page', $message);
202
        $this->assertContains('My page', $message);
203
    }
204
205
    public function testRevertToLive()
206
    {
@@ 205-222 (lines=18) @@
202
        $this->assertContains('My page', $message);
203
    }
204
205
    public function testRevertToLive()
206
    {
207
        $this->logInWithPermission('ADMIN');
208
209
        $page = new \Page();
210
        $page->Title = 'My page';
211
        $page->Content = 'This is my page content';
212
        $page->doPublish();
213
214
        $page->Content = 'Changed';
215
        $page->write();
216
        $page->doRevertToLive();
217
218
        $message = $this->writer->getLastMessage();
219
        $this->assertContains('[email protected]', $message);
220
        $this->assertContains('reverted Page', $message);
221
        $this->assertContains('My page', $message);
222
    }
223
224
    public function testDelete()
225
    {
@@ 224-239 (lines=16) @@
221
        $this->assertContains('My page', $message);
222
    }
223
224
    public function testDelete()
225
    {
226
        $this->logInWithPermission('ADMIN');
227
228
        $page = new \Page();
229
        $page->Title = 'My page';
230
        $page->Content = 'This is my page content';
231
        $page->doPublish();
232
233
        $page->delete();
234
235
        $message = $this->writer->getLastMessage();
236
        $this->assertContains('[email protected]', $message);
237
        $this->assertContains('deleted Page', $message);
238
        $this->assertContains('My page', $message);
239
    }
240
241
    public function testRestoreToStage()
242
    {
@@ 241-258 (lines=18) @@
238
        $this->assertContains('My page', $message);
239
    }
240
241
    public function testRestoreToStage()
242
    {
243
        $this->logInWithPermission('ADMIN');
244
245
        $page = new \Page();
246
        $page->Title = 'My page';
247
        $page->Content = 'Published';
248
        $page->doPublish();
249
250
        $page->Content = 'This is my page content';
251
        $page->doPublish();
252
        $page->delete();
253
254
        $message = $this->writer->getLastMessage();
255
        $this->assertContains('[email protected]', $message);
256
        $this->assertContains('deleted Page', $message);
257
        $this->assertContains('My page', $message);
258
    }
259
260
    public function tearDown()
261
    {