1 | <?php |
||
2 | |||
3 | /** |
||
4 | * Provides test methods to ensure pages contain what we want them to in various ways. |
||
5 | */ |
||
6 | class AlertsPageTest extends FetchPageTestCase { |
||
7 | /** |
||
8 | * Loads the member testing fixture. |
||
9 | */ |
||
10 | public function getDataSet() { |
||
11 | return $this->createMySQLXMLDataSet(dirname(__FILE__) . '/_fixtures/alertspage.xml'); |
||
0 ignored issues
–
show
|
|||
12 | } |
||
13 | |||
14 | private function fetch_page($vars) { |
||
15 | return $this->base_fetch_page($vars, 'alert'); |
||
16 | } |
||
17 | |||
18 | public function testFetchPage() { |
||
19 | $page = $this->fetch_page([]); |
||
20 | $this->assertStringContainsString('TheyWorkForYou Email Alerts', $page); |
||
21 | } |
||
22 | |||
23 | public function testKeywordOnly() { |
||
24 | $page = $this->fetch_page([ 'alertsearch' => 'elephant']); |
||
25 | $this->assertStringContainsString('Receive alerts when [elephant] is mentioned', $page); |
||
26 | } |
||
27 | |||
28 | public function testPostCodeOnly() { |
||
29 | $page = $this->fetch_page([ 'alertsearch' => 'SE17 3HE']); |
||
30 | $this->assertStringContainsString('when Mrs Test Current-MP', $page); |
||
31 | } |
||
32 | |||
33 | public function testPostCodeWithKeyWord() { |
||
34 | $page = $this->fetch_page([ 'alertsearch' => 'SE17 3HE elephant']); |
||
35 | $this->assertStringContainsString('You have used a postcode and something else', $page); |
||
36 | $this->assertStringContainsString('Mentions of [elephant] by your MP, Mrs Test Current-MP', $page); |
||
37 | $this->assertStringNotContainsString('by your MSP', $page); |
||
38 | } |
||
39 | |||
40 | public function testScottishPostcodeWithKeyword() { |
||
41 | $page = $this->fetch_page([ 'alertsearch' => 'PH6 2DB elephant']); |
||
42 | $this->assertStringContainsString('You have used a postcode and something else', $page); |
||
43 | $this->assertStringContainsString('Mentions of [elephant] by your MP, Mr Test2 Current-MP', $page); |
||
44 | $this->assertStringContainsString('Mentions of [elephant] by your MSP, Mrs Test Current-MSP', $page); |
||
45 | } |
||
46 | |||
47 | public function testPostcodeAndKeywordWithNoSittingMP() { |
||
48 | $page = $this->fetch_page([ 'alertsearch' => 'OX1 4LF elephant']); |
||
49 | $this->assertStringContainsString('You have used a postcode and something else', $page); |
||
50 | $this->assertStringNotContainsString('Did you mean to get alerts for when your MP', $page); |
||
51 | } |
||
52 | } |
||
53 |
This check looks for function or method calls that always return null and whose return value is used.
The method
getObject()
can return nothing but null, so it makes no sense to use the return value.The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.