Completed
Push — master ( 02d548...e42a4c )
by Damian
02:25
created

CommentingControllerTest::testHam()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 23
Code Lines 15

Duplication

Lines 23
Ratio 100 %
Metric Value
dl 23
loc 23
rs 9.0856
cc 1
eloc 15
nc 1
nop 0
1
<?php
2
3
/**
4
 * @package comments
5
 * @subpackage tests
6
 */
7
class CommentingControllerTest extends FunctionalTest {
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...
8
9
	public static $fixture_file = 'CommentsTest.yml';
10
11
	protected $extraDataObjects = array(
12
		'CommentableItem'
13
	);
14
15
	protected $securityEnabled;
16
17
	public function tearDown() {
18
		if($this->securityEnabled) {
19
			SecurityToken::enable();
20
		} else {
21
			SecurityToken::disable();
22
		}
23
		parent::tearDown();
24
	}
25
26
	public function setUp() {
27
		parent::setUp();
28
		$this->securityEnabled = SecurityToken::is_enabled();
29
	}
30
31 View Code Duplication
    public function testApprove() {
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...
32
        SecurityToken::disable();
33
34
        // mark a comment as spam then approve it
35
        $this->logInWithPermission('CMS_ACCESS_CommentAdmin');
36
        $comment = $this->objFromFixture('Comment', 'firstComA');
37
        $comment->markSpam();
38
        $st = new Comment_SecurityToken($comment);
0 ignored issues
show
Documentation introduced by
$comment is of type object<DataObject>|null, but the function expects a object<Comment>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
39
        $url = 'CommentingController/approve/' . $comment->ID;
40
        $url = $st->addToUrl($url, Member::currentUser());
0 ignored issues
show
Documentation introduced by
\Member::currentUser() is of type object<DataObject>|null, but the function expects a object<Member>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
41
        $response = $this->get($url);
42
        $this->assertEquals(200, $response->getStatusCode());
0 ignored issues
show
Bug introduced by
The method assertEquals() does not seem to exist on object<CommentingControllerTest>.

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...
43
        $comment = DataObject::get_by_id('Comment', $comment->ID);
44
45
        // Need to use 0,1 here instead of false, true for SQLite
46
        $this->assertEquals(0, $comment->IsSpam);
0 ignored issues
show
Bug introduced by
The method assertEquals() does not seem to exist on object<CommentingControllerTest>.

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...
47
        $this->assertEquals(1, $comment->Moderated);
0 ignored issues
show
Bug introduced by
The method assertEquals() does not seem to exist on object<CommentingControllerTest>.

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
        // try and approve a non existent comment
50
        $response = $this->get('CommentingController/approve/100000');
51
        $this->assertEquals(404, $response->getStatusCode());
0 ignored issues
show
Bug introduced by
The method assertEquals() does not seem to exist on object<CommentingControllerTest>.

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
55
    public function testSetGetOwnerController() {
56
        $commController = new CommentingController();
57
        $commController->setOwnerController(Controller::curr());
58
        $this->assertEquals(Controller::curr(), $commController->getOwnerController());
0 ignored issues
show
Bug introduced by
The method assertEquals() does not seem to exist on object<CommentingControllerTest>.

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
        $commController->setOwnerController(null);
0 ignored issues
show
Documentation introduced by
null is of type null, but the function expects a object<Controller>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
60
        $this->assertNull($commController->getOwnerController());
0 ignored issues
show
Bug introduced by
The method assertNull() does not seem to exist on object<CommentingControllerTest>.

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...
61
    }
62
63 View Code Duplication
    public function testHam() {
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...
64
        SecurityToken::disable();
65
66
        // mark a comment as spam then ham it
67
        $this->logInWithPermission('CMS_ACCESS_CommentAdmin');
68
        $comment = $this->objFromFixture('Comment', 'firstComA');
69
        $comment->markSpam();
70
        $st = new Comment_SecurityToken($comment);
0 ignored issues
show
Documentation introduced by
$comment is of type object<DataObject>|null, but the function expects a object<Comment>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
71
        $url = 'CommentingController/ham/' . $comment->ID;
72
        $url = $st->addToUrl($url, Member::currentUser());
0 ignored issues
show
Documentation introduced by
\Member::currentUser() is of type object<DataObject>|null, but the function expects a object<Member>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
73
        $response = $this->get($url);
74
        $this->assertEquals(200, $response->getStatusCode());
0 ignored issues
show
Bug introduced by
The method assertEquals() does not seem to exist on object<CommentingControllerTest>.

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...
75
        $comment = DataObject::get_by_id('Comment', $comment->ID);
76
77
        // Need to use 0,1 here instead of false, true for SQLite
78
        $this->assertEquals(0, $comment->IsSpam);
0 ignored issues
show
Bug introduced by
The method assertEquals() does not seem to exist on object<CommentingControllerTest>.

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...
79
        $this->assertEquals(1, $comment->Moderated);
0 ignored issues
show
Bug introduced by
The method assertEquals() does not seem to exist on object<CommentingControllerTest>.

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...
80
81
        // try and ham a non existent comment
82
        $response = $this->get('CommentingController/ham/100000');
83
        $this->assertEquals(404, $response->getStatusCode());
0 ignored issues
show
Bug introduced by
The method assertEquals() does not seem to exist on object<CommentingControllerTest>.

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...
84
85
    }
86
87
    public function testSpam() {
88
        // mark a comment as approved then spam it
89
        $this->logInWithPermission('CMS_ACCESS_CommentAdmin');
90
        $comment = $this->objFromFixture('Comment', 'firstComA');
91
        $comment->markApproved();
92
        $st = new Comment_SecurityToken($comment);
0 ignored issues
show
Documentation introduced by
$comment is of type object<DataObject>|null, but the function expects a object<Comment>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
93
        $url = 'CommentingController/spam/' . $comment->ID;
94
        $url = $st->addToUrl($url, Member::currentUser());
0 ignored issues
show
Documentation introduced by
\Member::currentUser() is of type object<DataObject>|null, but the function expects a object<Member>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
95
        $response = $this->get($url);
96
        $this->assertEquals(200, $response->getStatusCode());
0 ignored issues
show
Bug introduced by
The method assertEquals() does not seem to exist on object<CommentingControllerTest>.

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
        $comment = DataObject::get_by_id('Comment', $comment->ID);
98
99
        // Need to use 0,1 here instead of false, true for SQLite
100
        $this->assertEquals(1, $comment->IsSpam);
0 ignored issues
show
Bug introduced by
The method assertEquals() does not seem to exist on object<CommentingControllerTest>.

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...
101
        $this->assertEquals(1, $comment->Moderated);
0 ignored issues
show
Bug introduced by
The method assertEquals() does not seem to exist on object<CommentingControllerTest>.

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
        // try and spam a non existent comment
104
        $response = $this->get('CommentingController/spam/100000');
105
        $this->assertEquals(404, $response->getStatusCode());
0 ignored issues
show
Bug introduced by
The method assertEquals() does not seem to exist on object<CommentingControllerTest>.

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
109
	public function testRSS() {
110
        // Delete the newly added children of firstComA so as not to have to recalculate values below
111
        $this->objFromFixture('Comment', 'firstComAChild1')->delete();
112
        $this->objFromFixture('Comment', 'firstComAChild2')->delete();
113
        $this->objFromFixture('Comment', 'firstComAChild3')->delete();
114
115
        $item = $this->objFromFixture('CommentableItem', 'first');
116
117
118
		// comments sitewide
119
		$response = $this->get('CommentingController/rss');
120
		$this->assertEquals(10, substr_count($response->getBody(), "<item>"), "10 approved, non spam comments on page 1");
0 ignored issues
show
Bug introduced by
The method assertEquals() does not seem to exist on object<CommentingControllerTest>.

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...
121
122
		$response = $this->get('CommentingController/rss?start=10');
123
		$this->assertEquals(4, substr_count($response->getBody(), "<item>"), "3 approved, non spam comments on page 2");
0 ignored issues
show
Bug introduced by
The method assertEquals() does not seem to exist on object<CommentingControllerTest>.

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...
124
125
		// all comments on a type
126
		$response = $this->get('CommentingController/rss/CommentableItem');
127
		$this->assertEquals(10, substr_count($response->getBody(), "<item>"));
0 ignored issues
show
Bug introduced by
The method assertEquals() does not seem to exist on object<CommentingControllerTest>.

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...
128
129
		$response = $this->get('CommentingController/rss/CommentableItem?start=10');
130
		$this->assertEquals(4, substr_count($response->getBody(), "<item>"), "3 approved, non spam comments on page 2");
0 ignored issues
show
Bug introduced by
The method assertEquals() does not seem to exist on object<CommentingControllerTest>.

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...
131
132
		// specific page
133
		$response = $this->get('CommentingController/rss/CommentableItem/'.$item->ID);
134
		$this->assertEquals(1, substr_count($response->getBody(), "<item>"));
0 ignored issues
show
Bug introduced by
The method assertEquals() does not seem to exist on object<CommentingControllerTest>.

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...
135
		$this->assertContains('<dc:creator>FA</dc:creator>', $response->getBody());
136
137
		// test accessing comments on a type that doesn't exist
138
		$response = $this->get('CommentingController/rss/Fake');
139
		$this->assertEquals(404, $response->getStatusCode());
0 ignored issues
show
Bug introduced by
The method assertEquals() does not seem to exist on object<CommentingControllerTest>.

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...
140
	}
141
142
    // This is returning a 404 which looks logical code wise but also a bit weird.
143
    // Test module on a clean install and check what the actual URL is first
0 ignored issues
show
Unused Code Comprehensibility introduced by
48% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
144
/*    public function testReply() {
145
        $this->logInWithPermission('CMS_ACCESS_CommentAdmin');
146
        $comment = $this->objFromFixture('Comment', 'firstComA');
147
        $item = $this->objFromFixture('CommentableItem', 'first');
148
149
        $st = new Comment_SecurityToken($comment);
150
        $url = 'CommentingController/reply/' . $item->ID.'?ParentCommentID=' . $comment->ID;
151
        error_log($url);
152
        $response = $this->get($url);
153
        error_log(print_r($response,1));
154
155
        $this->assertEquals(200, $response->getStatusCode());
156
157
    }
158
*/
159
/*
0 ignored issues
show
Unused Code Comprehensibility introduced by
59% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
160
    public function testCommentsFormLoadMemberData() {
161
        Config::inst()->update('CommentableItem', 'comments', array(
162
            'use_preview' => false
163
        ));
164
        $this->logInAs('visitor');
165
        SecurityToken::disable();
166
        $parent = $this->objFromFixture('CommentableItem', 'first');
167
        $parent->CommentsRequireLogin = true;
168
        $parent->PostingRequiredPermission = true;
169
        //$parent->write();
170
        $commController = new CommentingController();
171
        $commController->setOwnerRecord($parent);
172
173
        $form = $commController->CommentsForm();
174
        $commentsFields = $form->Fields()->first()->FieldList();
175
        $expected = array('Name', 'Email', 'URL', 'Comment', 'PreviewComment');
176
        CommentTestHelper::assertFieldNames($this, $expected, $commentsFields);
177
    }
178
*/
179
180
    public function testCommentsFormUsePreview() {
181
        // test with preview on
182
        Config::inst()->update('CommentableItem', 'comments', array(
183
            'use_preview' => true
184
        ));
185
186
        $this->objFromFixture('Comment', 'firstComAChild1')->delete();
187
        $this->objFromFixture('Comment', 'firstComAChild2')->delete();
188
        $this->objFromFixture('Comment', 'firstComAChild3')->delete();
189
190
        SecurityToken::disable();
191
        $this->autoFollowRedirection = false;
192
        $parent = $this->objFromFixture('CommentableItem', 'first');
193
        $commController = new CommentingController();
194
        $commController->setOwnerRecord($parent);
0 ignored issues
show
Bug introduced by
It seems like $parent defined by $this->objFromFixture('CommentableItem', 'first') on line 192 can be null; however, CommentingController::setOwnerRecord() does not accept null, maybe add an additional type check?

Unless you are absolutely sure that the expression can never be null because of other conditions, we strongly recommend to add an additional type check to your code:

/** @return stdClass|null */
function mayReturnNull() { }

function doesNotAcceptNull(stdClass $x) { }

// With potential error.
function withoutCheck() {
    $x = mayReturnNull();
    doesNotAcceptNull($x); // Potential error here.
}

// Safe - Alternative 1
function withCheck1() {
    $x = mayReturnNull();
    if ( ! $x instanceof stdClass) {
        throw new \LogicException('$x must be defined.');
    }
    doesNotAcceptNull($x);
}

// Safe - Alternative 2
function withCheck2() {
    $x = mayReturnNull();
    if ($x instanceof stdClass) {
        doesNotAcceptNull($x);
    }
}
Loading history...
195
196
        $form = $commController->CommentsForm();
197
        $commentsFields = $form->Fields()->first()->FieldList();
198
        $expected = array('Name', 'Email', 'URL', 'Comment', 'PreviewComment');
199
        CommentTestHelper::assertFieldNames($this, $expected, $commentsFields);
200
201
        // Turn off preview.  Assert lack of preview field
202
        Config::inst()->update('CommentableItem', 'comments', array(
203
            'use_preview' => false
204
        ));
205
        $form = $commController->CommentsForm();
206
        $commentsFields = $form->Fields()->first()->FieldList();
207
        $expected = array('Name', 'Email', 'URL', 'Comment');
208
        CommentTestHelper::assertFieldNames($this, $expected, $commentsFields);
209
    }
210
211
	public function testCommentsForm() {
212
        // Delete the newly added children of firstComA so as not to change this test
213
        $this->objFromFixture('Comment', 'firstComAChild1')->delete();
214
        $this->objFromFixture('Comment', 'firstComAChild2')->delete();
215
        $this->objFromFixture('Comment', 'firstComAChild3')->delete();
216
217
		SecurityToken::disable();
218
		$this->autoFollowRedirection = false;
219
		$parent = $this->objFromFixture('CommentableItem', 'first');
220
221
		// Test posting to base comment
222
		$response = $this->post('CommentingController/CommentsForm',
223
			array(
224
				'Name' => 'Poster',
225
				'Email' => '[email protected]',
226
				'Comment' => 'My Comment',
227
				'ParentID' => $parent->ID,
228
				'BaseClass' => 'CommentableItem',
229
				'action_doPostComment' => 'Post'
230
			)
231
		);
232
		$this->assertEquals(302, $response->getStatusCode());
0 ignored issues
show
Bug introduced by
The method assertEquals() does not seem to exist on object<CommentingControllerTest>.

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...
233
		$this->assertStringStartsWith('CommentableItem_Controller#comment-', $response->getHeader('Location'));
0 ignored issues
show
Bug introduced by
The method assertStringStartsWith() does not seem to exist on object<CommentingControllerTest>.

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...
234
		$this->assertDOSEquals(
235
			array(array(
236
				'Name' => 'Poster',
237
				'Email' => '[email protected]',
238
				'Comment' => 'My Comment',
239
				'ParentID' => $parent->ID,
240
				'BaseClass' => 'CommentableItem',
241
			)),
242
			Comment::get()->filter('Email', '[email protected]')
243
		);
244
245
		// Test posting to parent comment
246
		$parentComment = $this->objFromFixture('Comment', 'firstComA');
247
		$this->assertEquals(0, $parentComment->ChildComments()->count());
0 ignored issues
show
Bug introduced by
The method assertEquals() does not seem to exist on object<CommentingControllerTest>.

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...
248
249
		$response = $this->post(
250
			'CommentingController/reply/'.$parentComment->ID,
251
			array(
252
				'Name' => 'Test Author',
253
				'Email' => '[email protected]',
254
				'Comment' => 'Making a reply to firstComA',
255
				'ParentID' => $parent->ID,
256
				'BaseClass' => 'CommentableItem',
257
				'ParentCommentID' => $parentComment->ID,
258
				'action_doPostComment' => 'Post'
259
			)
260
		);
261
		$this->assertEquals(302, $response->getStatusCode());
0 ignored issues
show
Bug introduced by
The method assertEquals() does not seem to exist on object<CommentingControllerTest>.

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...
262
		$this->assertStringStartsWith('CommentableItem_Controller#comment-', $response->getHeader('Location'));
0 ignored issues
show
Bug introduced by
The method assertStringStartsWith() does not seem to exist on object<CommentingControllerTest>.

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...
263
		$this->assertDOSEquals(array(array(
264
			'Name' => 'Test Author',
265
				'Email' => '[email protected]',
266
				'Comment' => 'Making a reply to firstComA',
267
				'ParentID' => $parent->ID,
268
				'BaseClass' => 'CommentableItem',
269
				'ParentCommentID' => $parentComment->ID
270
		)), $parentComment->ChildComments());
271
272
273
	}
274
}
275