Issues (404)

tests/AcceptBasicTest.php (1 issue)

Labels
Severity
1
<?php
2
3
/**
4
 * Provides acceptance(ish) tests to ensure key pages are working.
5
 */
6
class AcceptBasicTest extends FetchPageTestCase {
7
    /**
8
     * Loads the acceptance testing fixture.
9
     */
10
    public function getDataSet() {
11
        return $this->createMySQLXMLDataSet(dirname(__FILE__) . '/_fixtures/acceptance.xml');
0 ignored issues
show
Are you sure the usage of $this->createMySQLXMLDat...xtures/acceptance.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...
12
    }
13
14
    private function fetch_page($path, $file = 'index.php', $vars = []) {
15
        return $this->base_fetch_page($vars, $path, $file);
16
    }
17
18
    /**
19
     * Does the homepage still work?
20
     */
21
    public function testHome() {
22
        $page = $this->fetch_page('');
23
        $this->assertStringContainsString('Learn more about', $page);
24
        $this->assertStringContainsString('Create an alert', $page);
25
        $this->assertStringContainsString('Upcoming', $page);
26
    }
27
28
    /**
29
     * Does the list of MPs still work?
30
     */
31
    public function testMPList() {
32
        $page = $this->fetch_page('mps');
33
        $this->assertStringContainsString('All MPs', $page);
34
        $this->assertStringContainsString('Test Current-MP', $page);
35
    }
36
37
    /**
38
     * Does the list of Lords still work?
39
     */
40
    public function testLordsList() {
41
        $page = $this->fetch_page('mps', 'index.php', ['representative_type' => 'peer']);
42
        $this->assertStringContainsString('All Members of the House of Lords', $page);
43
        $this->assertStringContainsString('Mr Current-Lord', $page);
44
    }
45
46
    /**
47
     * Does the list of MSPs still work?
48
     */
49
    public function testMSPList() {
50
        $page = $this->fetch_page('mps', 'index.php', ['representative_type' => 'msp']);
51
        $this->assertStringContainsString('Scottish Parliament', $page);
52
        $this->assertStringContainsString('All MSPs', $page);
53
        $this->assertStringContainsString('Test Current-MSP', $page);
54
    }
55
56
    /**
57
     * Does the list of MSPs still work?
58
     */
59
    public function testMLAList() {
60
        $page = $this->fetch_page('mps', 'index.php', ['representative_type' => 'mla']);
61
        $this->assertStringContainsString('Northern Ireland Assembly', $page);
62
        $this->assertStringContainsString('All MLAs', $page);
63
        $this->assertStringContainsString('Test Current-MLA', $page);
64
    }
65
66
    /**
67
     * Does the debates top page still work?
68
     */
69
    public function testDebatesList() {
70
        $page = $this->fetch_page('', 'section.php', ['type' => 'debates']);
71
        $this->assertStringContainsString('UK Parliament Hansard Debates', $page);
72
        $this->assertStringContainsString('Recent House of Commons debates', $page);
73
        $this->assertStringContainsString('Test Hansard Section', $page);
74
        $this->assertStringContainsString('Test Hansard Subsection', $page);
75
        $this->assertStringContainsString('6 speeches', $page);
76
        $this->assertStringContainsString('Wednesday,  1 January 2014', $page);
77
    }
78
79
}
80