Completed
Push — master ( c3d26a...25c055 )
by Hamish
7s
created

testUnModifiedPagesDontChangeEditor()   B

Complexity

Conditions 1
Paths 1

Size

Total Lines 31
Code Lines 21

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 31
rs 8.8571
cc 1
eloc 21
nc 1
nop 0
1
<?php
2
3
/**
4
 * @mixin PHPUnit_Framework_TestCase
5
 */
6
class SiteTreeContentReviewTest extends ContentReviewBaseTest
0 ignored issues
show
Coding Style Compatibility introduced by
PSR1 recommends that each class must be in a namespace of at least one level to avoid collisions.

You can fix this by adding a namespace to your class:

namespace YourVendor;

class YourClass { }

When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.

Loading history...
7
{
8
    /**
9
     * @var string
10
     */
11
    public static $fixture_file = "contentreview/tests/ContentReviewTest.yml";
12
13
    /**
14
     * @var array
15
     */
16
    protected $requiredExtensions = array(
17
        "SiteTree"              => array("SiteTreeContentReview"),
18
        "Group"                 => array("ContentReviewOwner"),
19
        "Member"                => array("ContentReviewOwner"),
20
        "CMSPageEditController" => array("ContentReviewCMSExtension"),
21
        "SiteConfig"            => array("ContentReviewDefaultSettings"),
22
    );
23
24
    public function testOwnerNames()
25
    {
26
        /** @var Member $editor */
27
        $editor = $this->objFromFixture("Member", "editor");
28
29
        $this->logInAs($editor);
30
31
        /** @var Page|SiteTreeContentReview $page */
32
        $page = new Page();
33
        $page->ReviewPeriodDays = 10;
34
        $page->ContentReviewType = "Custom";
35
36
        $page->ContentReviewUsers()->push($editor);
37
        $page->write();
0 ignored issues
show
Bug introduced by
The method write() does not seem to exist on object<SiteTreeContentReview>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
38
39
        $this->assertTrue($page->canPublish());
0 ignored issues
show
Bug introduced by
The method canPublish() does not seem to exist on object<SiteTreeContentReview>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
Bug introduced by
The method assertTrue() does not seem to exist on object<SiteTreeContentReviewTest>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
40
        $this->assertTrue($page->doPublish());
0 ignored issues
show
Bug introduced by
The method doPublish() does not seem to exist on object<SiteTreeContentReview>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
Bug introduced by
The method assertTrue() does not seem to exist on object<SiteTreeContentReviewTest>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
41
        $this->assertEquals($page->OwnerNames, "Test Editor", "Test Editor should be the owner");
0 ignored issues
show
Bug introduced by
The method assertEquals() does not seem to exist on object<SiteTreeContentReviewTest>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
42
43
        /** @var Page|SiteTreeContentReview $page */
44
        $page = $this->objFromFixture("Page", "about");
45
46
        $page->OwnerUsers()->removeAll();
47
        $page->write();
0 ignored issues
show
Bug introduced by
The method write() does not seem to exist on object<SiteTreeContentReview>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
48
49
        $this->assertTrue($page->canPublish());
0 ignored issues
show
Bug introduced by
The method canPublish() does not seem to exist on object<SiteTreeContentReview>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
Bug introduced by
The method assertTrue() does not seem to exist on object<SiteTreeContentReviewTest>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
50
        $this->assertTrue($page->doPublish());
0 ignored issues
show
Bug introduced by
The method doPublish() does not seem to exist on object<SiteTreeContentReview>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
Bug introduced by
The method assertTrue() does not seem to exist on object<SiteTreeContentReviewTest>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
51
        $this->assertEquals("", $page->OwnerNames);
0 ignored issues
show
Bug introduced by
The method assertEquals() does not seem to exist on object<SiteTreeContentReviewTest>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
52
    }
53
54
    public function testPermissionsExists()
55
    {
56
        $perms = singleton("SiteTreeContentReview")->providePermissions();
57
58
        $this->assertTrue(isset($perms["EDIT_CONTENT_REVIEW_FIELDS"]));
0 ignored issues
show
Bug introduced by
The method assertTrue() does not seem to exist on object<SiteTreeContentReviewTest>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
59
    }
60
61 View Code Duplication
    public function testUserWithPermissionCanEdit()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
62
    {
63
        /** @var Member $editor */
64
        $editor = $this->objFromFixture("Member", "editor");
65
66
        $this->logInAs($editor);
67
68
        /** @var Page|SiteTreeContentReview $page */
69
        $page = new Page();
70
71
        $fields = $page->getSettingsFields();
0 ignored issues
show
Bug introduced by
The method getSettingsFields() does not seem to exist on object<SiteTreeContentReview>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
72
73
        $this->assertNotNull($fields->dataFieldByName("NextReviewDate"));
0 ignored issues
show
Bug introduced by
The method assertNotNull() does not seem to exist on object<SiteTreeContentReviewTest>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
74
    }
75
76 View Code Duplication
    public function testUserWithoutPermissionCannotEdit()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
77
    {
78
        /** @var Member $author */
79
        $author = $this->objFromFixture("Member", "author");
80
81
        $this->logInAs($author);
82
83
        /** @var Page|SiteTreeContentReview $page */
84
        $page = new Page();
85
86
        $fields = $page->getSettingsFields();
0 ignored issues
show
Bug introduced by
The method getSettingsFields() does not seem to exist on object<SiteTreeContentReview>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
87
88
        $this->assertNull($fields->dataFieldByName("NextReviewDate"));
0 ignored issues
show
Bug introduced by
The method assertNull() does not seem to exist on object<SiteTreeContentReviewTest>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
89
    }
90
91
    public function testAutomaticallyToNotSetReviewDate()
92
    {
93
        /** @var Member $editor */
94
        $editor = $this->objFromFixture("Member", "editor");
95
96
        $this->logInAs($editor);
97
98
        /** @var Page|SiteTreeContentReview $page */
99
        $page = new Page();
100
101
        $page->ReviewPeriodDays = 10;
102
        $page->write();
0 ignored issues
show
Bug introduced by
The method write() does not seem to exist on object<SiteTreeContentReview>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
103
104
        $this->assertTrue($page->doPublish());
0 ignored issues
show
Bug introduced by
The method doPublish() does not seem to exist on object<SiteTreeContentReview>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
Bug introduced by
The method assertTrue() does not seem to exist on object<SiteTreeContentReviewTest>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
105
        $this->assertEquals(null, $page->NextReviewDate);
0 ignored issues
show
Bug introduced by
The method assertEquals() does not seem to exist on object<SiteTreeContentReviewTest>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
106
    }
107
108
    public function testAddReviewNote()
109
    {
110
        /** @var Member $author */
111
        $author = $this->objFromFixture("Member", "author");
112
113
        /** @var Page|SiteTreeContentReview $page */
114
        $page = $this->objFromFixture("Page", "home");
115
116
        $page->addReviewNote($author, "This is a message");
117
118
        /** @var Page|SiteTreeContentReview $page */
119
        $homepage = $this->objFromFixture("Page", "home");
120
121
        $this->assertEquals(1, $homepage->ReviewLogs()->count());
0 ignored issues
show
Bug introduced by
The method assertEquals() does not seem to exist on object<SiteTreeContentReviewTest>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
122
        $this->assertEquals("This is a message", $homepage->ReviewLogs()->first()->Note);
0 ignored issues
show
Bug introduced by
The method assertEquals() does not seem to exist on object<SiteTreeContentReviewTest>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
123
    }
124
125
    public function testGetContentReviewOwners()
126
    {
127
        /** @var Page|SiteTreeContentReview $page */
128
        $page = $this->objFromFixture("Page", "group-owned");
129
130
        $owners = $page->ContentReviewOwners();
131
132
        $this->assertEquals(1, $owners->count());
0 ignored issues
show
Bug introduced by
The method assertEquals() does not seem to exist on object<SiteTreeContentReviewTest>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
133
        $this->assertEquals("[email protected]", $owners->first()->Email);
0 ignored issues
show
Bug introduced by
The method assertEquals() does not seem to exist on object<SiteTreeContentReviewTest>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
134
    }
135
136 View Code Duplication
    public function testCanNotBeReviewBecauseNoReviewDate()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
137
    {
138
        SS_Datetime::set_mock_now("2010-01-01 12:00:00");
139
140
        /** @var Member $author */
141
        $author = $this->objFromFixture("Member", "author");
142
143
        /** @var Page|SiteTreeContentReview $page */
144
        $page = $this->objFromFixture("Page", "no-review");
145
146
        $this->assertFalse($page->canBeReviewedBy($author));
0 ignored issues
show
Bug introduced by
The method assertFalse() does not seem to exist on object<SiteTreeContentReviewTest>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
147
148
        SS_Datetime::clear_mock_now();
149
    }
150
151 View Code Duplication
    public function testCanNotBeReviewedBecauseInFuture()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
152
    {
153
        SS_Datetime::set_mock_now("2010-01-01 12:00:00");
154
155
        /** @var Member $author */
156
        $author = $this->objFromFixture("Member", "author");
157
158
        /** @var Page|SiteTreeContentReview $page */
159
        $page = $this->objFromFixture("Page", "staff");
160
161
        $this->assertFalse($page->canBeReviewedBy($author));
0 ignored issues
show
Bug introduced by
The method assertFalse() does not seem to exist on object<SiteTreeContentReviewTest>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
162
163
        SS_Datetime::clear_mock_now();
164
    }
165
166 View Code Duplication
    public function testCanNotBeReviewedByUser()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
167
    {
168
        SS_Datetime::set_mock_now("2010-03-01 12:00:00");
169
170
        /** @var Member $author */
171
        $author = $this->objFromFixture("Member", "author");
172
173
        /** @var Page|SiteTreeContentReview $page */
174
        $page = $this->objFromFixture("Page", "home");
175
176
        $this->assertFalse($page->canBeReviewedBy($author));
0 ignored issues
show
Bug introduced by
The method assertFalse() does not seem to exist on object<SiteTreeContentReviewTest>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
177
178
        SS_Datetime::clear_mock_now();
179
    }
180
181 View Code Duplication
    public function testCanBeReviewedByUser()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
182
    {
183
        SS_Datetime::set_mock_now("2010-03-01 12:00:00");
184
185
        /** @var Member $author */
186
        $author = $this->objFromFixture("Member", "author");
187
188
        /** @var Page|SiteTreeContentReview $page */
189
        $page = $this->objFromFixture("Page", "staff");
190
191
        $this->assertTrue($page->canBeReviewedBy($author));
0 ignored issues
show
Bug introduced by
The method assertTrue() does not seem to exist on object<SiteTreeContentReviewTest>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
192
193
        SS_Datetime::clear_mock_now();
194
    }
195
196 View Code Duplication
    public function testCanNotBeReviewedByGroup()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
197
    {
198
        SS_Datetime::set_mock_now("2010-03-01 12:00:00");
199
200
        /** @var Member $author */
201
        $author = $this->objFromFixture("Member", "editor");
202
203
        /** @var Page|SiteTreeContentReview $page */
204
        $page = $this->objFromFixture("Page", "contact");
205
206
        $this->assertFalse($page->canBeReviewedBy($author));
0 ignored issues
show
Bug introduced by
The method assertFalse() does not seem to exist on object<SiteTreeContentReviewTest>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
207
208
        SS_Datetime::clear_mock_now();
209
    }
210
211 View Code Duplication
    public function testCanBeReviewedByGroup()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
212
    {
213
        SS_Datetime::set_mock_now("2010-03-01 12:00:00");
214
215
        /** @var Member $author */
216
        $author = $this->objFromFixture("Member", "author");
217
218
        /** @var Page|SiteTreeContentReview $page */
219
        $page = $this->objFromFixture("Page", "contact");
220
221
        $this->assertTrue($page->canBeReviewedBy($author));
0 ignored issues
show
Bug introduced by
The method assertTrue() does not seem to exist on object<SiteTreeContentReviewTest>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
222
223
        SS_Datetime::clear_mock_now();
224
    }
225
226
    public function testCanBeReviewedFromInheritedSetting()
227
    {
228
        SS_Datetime::set_mock_now("2013-03-01 12:00:00");
229
230
        /** @var Member $author */
231
        $author = $this->objFromFixture("Member", "author");
232
233
        /** @var Page|SiteTreeContentReview $parentPage */
234
        $parentPage = $this->objFromFixture("Page", "contact");
235
236
        $parentPage->NextReviewDate = "2013-01-01";
237
        $parentPage->write();
0 ignored issues
show
Bug introduced by
The method write() does not seem to exist on object<SiteTreeContentReview>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
238
239
        /** @var Page|SiteTreeContentReview $page */
240
        $page = $this->objFromFixture("Page", "contact-child");
241
242
        $this->assertTrue($page->canBeReviewedBy($author));
0 ignored issues
show
Bug introduced by
The method assertTrue() does not seem to exist on object<SiteTreeContentReviewTest>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
243
244
        SS_Datetime::clear_mock_now();
245
    }
246
247
    public function testUnModifiedPagesDontChangeEditor() {
248
        SS_Datetime::set_mock_now("2013-03-01 12:00:00");
249
250
        /** @var Member $author */
251
        $author = $this->objFromFixture("Member", "author");
252
        $this->logInAs($author);
253
254
        // Page which is un-modified doesn't advance version of have an editor assigned
255
        $contactPage = $this->objFromFixture("Page", "contact");
256
        $contactPageVersion = $contactPage->Version;
257
        $contactPage->write();
258
        $this->assertEmpty($contactPage->LastEditedByName);
0 ignored issues
show
Bug introduced by
The property LastEditedByName does not seem to exist. Did you mean LastEdited?

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
Bug introduced by
The method assertEmpty() does not seem to exist on object<SiteTreeContentReviewTest>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
259
        $this->assertEquals(
0 ignored issues
show
Bug introduced by
The method assertEquals() does not seem to exist on object<SiteTreeContentReviewTest>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
260
            $contactPageVersion,
261
            Versioned::get_versionnumber_by_stage('SiteTree', 'Stage', $contactPage->ID, false)
262
        );
263
264
        // Page with modifications gets marked
265
        $homePage = $this->objFromFixture("Page", "home");
266
        $homePageVersion = $homePage->Version;
267
        $homePage->Content = '<p>Welcome!</p>';
268
        $homePage->write();
269
        $this->assertNotEmpty($homePage->LastEditedByName);
0 ignored issues
show
Bug introduced by
The property LastEditedByName does not seem to exist. Did you mean LastEdited?

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
Bug introduced by
The method assertNotEmpty() does not seem to exist on object<SiteTreeContentReviewTest>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
270
        $this->assertEquals($author->getTitle(), $homePage->LastEditedByName);
0 ignored issues
show
Bug introduced by
The property LastEditedByName does not seem to exist. Did you mean LastEdited?

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
Bug introduced by
The method assertEquals() does not seem to exist on object<SiteTreeContentReviewTest>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
271
        $this->assertGreaterThan(
0 ignored issues
show
Bug introduced by
The method assertGreaterThan() does not seem to exist on object<SiteTreeContentReviewTest>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
272
            $homePageVersion,
273
            Versioned::get_versionnumber_by_stage('SiteTree', 'Stage', $homePage->ID, false)
274
        );
275
276
        SS_Datetime::clear_mock_now();
277
    }
278
279 View Code Duplication
    public function testReviewActionVisibleForAuthor()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
280
    {
281
        SS_Datetime::set_mock_now("2020-03-01 12:00:00");
282
283
        /** @var Page|SiteTreeContentReview $page */
284
        $page = $this->objFromFixture("Page", "contact");
285
286
        /** @var Member $author */
287
        $author = $this->objFromFixture("Member", "author");
288
289
        $this->logInAs($author);
290
291
        $fields = $page->getCMSActions();
0 ignored issues
show
Bug introduced by
The method getCMSActions() does not seem to exist on object<SiteTreeContentReview>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
292
293
        $this->assertNotNull($fields->fieldByName("ActionMenus.ReviewContent"));
0 ignored issues
show
Bug introduced by
The method assertNotNull() does not seem to exist on object<SiteTreeContentReviewTest>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
294
295
        SS_Datetime::clear_mock_now();
296
    }
297
298 View Code Duplication
    public function testReviewActionNotVisibleForEditor()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
299
    {
300
        SS_Datetime::set_mock_now("2020-03-01 12:00:00");
301
302
        /** @var Page|SiteTreeContentReview $page */
303
        $page = $this->objFromFixture("Page", "contact");
304
305
        /** @var Member $author */
306
        $author = $this->objFromFixture("Member", "editor");
307
308
        $this->logInAs($author);
309
310
        $fields = $page->getCMSActions();
0 ignored issues
show
Bug introduced by
The method getCMSActions() does not seem to exist on object<SiteTreeContentReview>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
311
312
        $this->assertNull($fields->fieldByName("ActionMenus.ReviewContent"));
0 ignored issues
show
Bug introduced by
The method assertNull() does not seem to exist on object<SiteTreeContentReviewTest>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
313
314
        SS_Datetime::clear_mock_now();
315
    }
316
}
317