Issues (404)

tests/VotesTest.php (1 issue)

Labels
Severity
1
<?php
2
3
/**
4
 * Provides test methods to ensure pages contain what we want them to in various ways.
5
 */
6
class VotesTest extends FetchPageTestCase {
7
    public function getDataSet() {
8
        return $this->createMySQLXMLDataSet(dirname(__FILE__) . '/_fixtures/divisions.xml');
0 ignored issues
show
Are you sure the usage of $this->createMySQLXMLDat...ixtures/divisions.xml') targeting TWFY_Database_TestCase::createMySQLXMLDataSet() seems to always return null.

This check looks for function or method calls that always return null and whose return value is used.

class A
{
    function getObject()
    {
        return null;
    }

}

$a = new A();
if ($a->getObject()) {

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.

Loading history...
9
    }
10
11
    private function fetch_page($vars) {
12
        return $this->base_fetch_page($vars, 'mp', 'index.php', '/mp/votes.php');
13
    }
14
15
    private function fetch_votes_page() {
16
        return $this->fetch_page([ 'pagetype' => 'votes', 'pid' => 2, 'url' => '/mp/2/test_current-mp/test_westminster_constituency/votes' ]);
17
    }
18
19
    public function testVoteSummary() {
20
        $page = $this->fetch_votes_page();
21
        $this->assertStringContainsString('2 votes against, 1 abstention, in 2013', $page);
22
    }
23
24
    public function testLastUpdate() {
25
        $page = $this->fetch_votes_page();
26
        $this->assertStringContainsString('Last updated:  1 January 2013', $page);
27
    }
28
}
29