These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | |||
3 | /** |
||
4 | * @mixin PHPUnit_Framework_TestCase |
||
5 | */ |
||
6 | class ContentReviewCMSPageEditControllerTest extends ContentReviewBaseTest |
||
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 | View Code Duplication | public function testReviewedThrowsExceptionWithNoRecordID() |
|
25 | { |
||
26 | $this->setExpectedException("SS_HTTPResponse_Exception"); |
||
0 ignored issues
–
show
|
|||
27 | |||
28 | /** @var CMSPageEditController|ContentReviewCMSExtension $controller */ |
||
29 | $controller = new CMSPageEditController(); |
||
30 | |||
31 | $dummyForm = new CMSForm($controller, "EditForm", new FieldList(), new FieldList()); |
||
32 | |||
33 | $controller->savereview(array( |
||
34 | "ID" => null, |
||
35 | "Message" => null, |
||
36 | ), $dummyForm); |
||
37 | } |
||
38 | |||
39 | View Code Duplication | public function testReviewedThrowsExceptionWithWrongRecordID() |
|
40 | { |
||
41 | $this->setExpectedException("SS_HTTPResponse_Exception"); |
||
0 ignored issues
–
show
The method
setExpectedException() does not seem to exist on object<ContentReviewCMSPageEditControllerTest> .
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 CMSPageEditController|ContentReviewCMSExtension $controller */ |
||
44 | $controller = new CMSPageEditController(); |
||
45 | |||
46 | $dummyForm = new CMSForm($controller, "EditForm", new FieldList(), new FieldList()); |
||
47 | |||
48 | $controller->savereview(array( |
||
49 | "ID" => "FAIL", |
||
50 | "Message" => null, |
||
51 | ), $dummyForm); |
||
52 | } |
||
53 | |||
54 | public function testReviewedWithAuthor() |
||
55 | { |
||
56 | /** @var Member $author */ |
||
57 | $author = $this->objFromFixture("Member", "author"); |
||
58 | |||
59 | $this->loginAs($author); |
||
60 | |||
61 | /** @var Page|SiteTreeContentReview $page */ |
||
62 | $page = $this->objFromFixture("Page", "home"); |
||
63 | |||
64 | $data = array( |
||
65 | "action_savereview" => 1, |
||
66 | "ID" => $page->ID, |
||
67 | ); |
||
68 | |||
69 | $this->get('admin/pages/edit/show/' . $page->ID); |
||
70 | $response = $this->post(singleton('CMSPageEditController')->getEditForm($page->ID)->FormAction(), $data); |
||
71 | |||
72 | $this->assertEquals("OK", $response->getStatusDescription()); |
||
0 ignored issues
–
show
The method
assertEquals() does not seem to exist on object<ContentReviewCMSPageEditControllerTest> .
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...
|
|||
73 | $this->assertEquals(200, $response->getStatusCode()); |
||
0 ignored issues
–
show
The method
assertEquals() does not seem to exist on object<ContentReviewCMSPageEditControllerTest> .
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 | public function testSaveReview() |
||
77 | { |
||
78 | /** @var Member $author */ |
||
79 | $author = $this->objFromFixture("Member", "author"); |
||
80 | |||
81 | $this->loginAs($author); |
||
82 | |||
83 | /** @var Page|SiteTreeContentReview $page */ |
||
84 | $page = $this->objFromFixture("Page", "home"); |
||
85 | |||
86 | $data = array( |
||
87 | "action_savereview" => 1, |
||
88 | "ID" => $page->ID, |
||
89 | "ReviewNotes" => "This is the best page ever", |
||
90 | ); |
||
91 | |||
92 | $this->get('admin/pages/edit/show/' . $page->ID); |
||
93 | $response = $this->post(singleton('CMSPageEditController')->getEditForm($page->ID)->FormAction(), $data); |
||
94 | |||
95 | $this->assertEquals("OK", $response->getStatusDescription()); |
||
0 ignored issues
–
show
The method
assertEquals() does not seem to exist on object<ContentReviewCMSPageEditControllerTest> .
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...
|
|||
96 | $this->assertEquals(200, $response->getStatusCode()); |
||
0 ignored issues
–
show
The method
assertEquals() does not seem to exist on object<ContentReviewCMSPageEditControllerTest> .
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...
|
|||
97 | $this->assertEquals(1, $page->ReviewLogs()->count()); |
||
0 ignored issues
–
show
The method
assertEquals() does not seem to exist on object<ContentReviewCMSPageEditControllerTest> .
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...
|
|||
98 | |||
99 | $reviewLog = $page->ReviewLogs()->first(); |
||
100 | |||
101 | $this->assertEquals($data["ReviewNotes"], $reviewLog->Note); |
||
0 ignored issues
–
show
The method
assertEquals() does not seem to exist on object<ContentReviewCMSPageEditControllerTest> .
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...
|
|||
102 | } |
||
103 | } |
||
104 |
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.