Failed Conditions
Pull Request — master (#1324)
by Nick
34:37 queued 19:37
created
scripts/video-speed.php 2 patches
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -26,9 +26,13 @@
 block discarded – undo
26 26
         $body = strip_tags($q->field($i, 'body'));
27 27
         $qq = $db->query('select time_to_sec(atime) as atime from hansard,video_timestamps where hansard.gid=video_timestamps.gid and deleted=0 and video_status in (5,7) and hdate="' . $hdate . '" and hpos=' . ($hpos+1) . ' group by video_timestamps.gid');
28 28
         $next_atime = $qq->field(0, 'atime');
29
-        if (!$next_atime) continue;
29
+        if (!$next_atime) {
30
+            continue;
31
+        }
30 32
         $duration = $next_atime - $atime;
31
-        if ($duration<=0) continue;
33
+        if ($duration<=0) {
34
+            continue;
35
+        }
32 36
         $words = preg_split('/\W+/', $body, -1, PREG_SPLIT_NO_EMPTY);
33 37
         $num_words = count($words);
34 38
         $speed = $num_words / ($duration/60);
Please login to merge, or discard this patch.
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -5,7 +5,7 @@  discard block
 block discarded – undo
5 5
 $db = new ParlDB;
6 6
 
7 7
 $q = $db->query('select distinct(person_id) from hansard where video_status in (5,7) and person_id>0 limit 5');
8
-for ($i=0; $i<$q->rows(); $i++) {
8
+for ($i = 0; $i < $q->rows(); $i++) {
9 9
     $spid = $q->field($i, 'person_id');
10 10
     calculate_speed($db, $spid);
11 11
 }
@@ -18,20 +18,20 @@  discard block
 block discarded – undo
18 18
     $total_words = 0;
19 19
     $total_speed = 0;
20 20
     $num = 0;
21
-    for ($i=0; $i<$q->rows(); $i++) {
21
+    for ($i = 0; $i < $q->rows(); $i++) {
22 22
         $hpos = $q->field($i, 'hpos');
23 23
         $hdate = $q->field($i, 'hdate');
24 24
         $gid = $q->field($i, 'gid');
25 25
         $atime = $q->field($i, 'atime');
26 26
         $body = strip_tags($q->field($i, 'body'));
27
-        $qq = $db->query('select time_to_sec(atime) as atime from hansard,video_timestamps where hansard.gid=video_timestamps.gid and deleted=0 and video_status in (5,7) and hdate="' . $hdate . '" and hpos=' . ($hpos+1) . ' group by video_timestamps.gid');
27
+        $qq = $db->query('select time_to_sec(atime) as atime from hansard,video_timestamps where hansard.gid=video_timestamps.gid and deleted=0 and video_status in (5,7) and hdate="' . $hdate . '" and hpos=' . ($hpos + 1) . ' group by video_timestamps.gid');
28 28
         $next_atime = $qq->field(0, 'atime');
29 29
         if (!$next_atime) continue;
30 30
         $duration = $next_atime - $atime;
31
-        if ($duration<=0) continue;
31
+        if ($duration <= 0) continue;
32 32
         $words = preg_split('/\W+/', $body, -1, PREG_SPLIT_NO_EMPTY);
33 33
         $num_words = count($words);
34
-        $speed = $num_words / ($duration/60);
34
+        $speed = $num_words / ($duration / 60);
35 35
         $total_speed += $speed;
36 36
         print "$gid, $num_words words, from $atime to $next_atime, duration $duration s, speed $speed wpm\n";
37 37
         $total += $duration;
@@ -39,12 +39,12 @@  discard block
 block discarded – undo
39 39
         $num++;
40 40
     }
41 41
 
42
-    $total_min = $total/60;
42
+    $total_min = $total / 60;
43 43
 
44 44
     print "Person ID $spid\n";
45
-    print "Average length = " . ($total/$num) . "s\n";
46
-    print "Average speed = " . ($total_words/$total_min) . "wpm\n";
47
-    print "Average of speeds = " . ($total_speed/$num) . "wpm\n";
45
+    print "Average length = " . ($total / $num) . "s\n";
46
+    print "Average speed = " . ($total_words / $total_min) . "wpm\n";
47
+    print "Average of speeds = " . ($total_speed / $num) . "wpm\n";
48 48
     print "\n";
49 49
 }
50 50
 
Please login to merge, or discard this patch.
tests/MemberTest.php 2 patches
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -325,10 +325,10 @@  discard block
 block discarded – undo
325 325
 
326 326
         $msps = array(
327 327
             array(
328
-             'person_id' => "19",
329
-              'name' => "Mr Regional MSP1",
330
-              'constituency' => "Mid Scotland and Fife",
331
-              'house' => "4"
328
+                'person_id' => "19",
329
+                'name' => "Mr Regional MSP1",
330
+                'constituency' => "Mid Scotland and Fife",
331
+                'house' => "4"
332 332
             ),
333 333
             array(
334 334
                 'person_id' => "20",
@@ -340,10 +340,10 @@  discard block
 block discarded – undo
340 340
         $this->assertEquals($msps, \MySociety\TheyWorkForYou\Member::getRegionalList('KY16 8YG', 4, 'SPE'));
341 341
         $mlas = array(
342 342
             array(
343
-              'person_id' => "21",
344
-              'name' => "Mr Regional MLA1",
345
-              'constituency' => "Belfast West",
346
-              'house' => "3"
343
+                'person_id' => "21",
344
+                'name' => "Mr Regional MLA1",
345
+                'constituency' => "Belfast West",
346
+                'house' => "3"
347 347
             ),
348 348
             array(
349 349
                 'person_id' => "22",
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@
 block discarded – undo
11 11
      */
12 12
     public function getDataSet()
13 13
     {
14
-        return $this->createMySQLXMLDataSet(dirname(__FILE__).'/_fixtures/member.xml');
14
+        return $this->createMySQLXMLDataSet(dirname(__FILE__) . '/_fixtures/member.xml');
15 15
     }
16 16
 
17 17
     /**
Please login to merge, or discard this patch.
tests/PostcodeTest.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@
 block discarded – undo
18 18
     /**
19 19
      * Test converting a postcode to a constituency
20 20
      */
21
-	public function testPostcodeToConstituency()
21
+    public function testPostcodeToConstituency()
22 22
     {
23 23
         $this->assertEquals(
24 24
             'Cities of London and Westminster',
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@
 block discarded – undo
12 12
      */
13 13
     public function getDataSet()
14 14
     {
15
-        return $this->createMySQLXMLDataSet(dirname(__FILE__).'/_fixtures/postcode.xml');
15
+        return $this->createMySQLXMLDataSet(dirname(__FILE__) . '/_fixtures/postcode.xml');
16 16
     }
17 17
 
18 18
     /**
Please login to merge, or discard this patch.
tests/CommentTest.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@
 block discarded – undo
17 17
     /**
18 18
      * Ensures the database is prepared and the comment class is included for every test.
19 19
      */
20
-	public function setUp() {
20
+    public function setUp() {
21 21
 
22 22
         parent::setUp();
23 23
 
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
      */
12 12
     public function getDataSet()
13 13
     {
14
-        return $this->createMySQLXMLDataSet(dirname(__FILE__).'/_fixtures/comment.xml');
14
+        return $this->createMySQLXMLDataSet(dirname(__FILE__) . '/_fixtures/comment.xml');
15 15
     }
16 16
 
17 17
     /**
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
     public function testHTMLCleaningOfAngleBrackets() {
57 57
         $text = 'Is 2 < 3?';
58 58
 
59
-        $this->assertEquals('Is 2 &lt; 3?', filter_user_input( $text, 'comment' ) );
59
+        $this->assertEquals('Is 2 &lt; 3?', filter_user_input($text, 'comment'));
60 60
     }
61 61
 
62 62
     public function testHTMLCleaningWithNonASCIIChars()
Please login to merge, or discard this patch.
tests/UserTest.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -100,7 +100,7 @@
 block discarded – undo
100 100
         );
101 101
 
102 102
         $expectedTable = $this->createXmlDataSet(dirname(__FILE__).'/_fixtures/expectedTokens.xml')
103
-                              ->getTable("tokens");
103
+                                ->getTable("tokens");
104 104
         $this->assertTablesEqual($expectedTable, $queryTable);
105 105
 
106 106
         $alertCount = $this->getConnection()->getRowCount('alerts', 'email = "[email protected]"');
Please login to merge, or discard this patch.
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
      */
12 12
     public function getDataSet()
13 13
     {
14
-        return $this->createMySQLXMLDataSet(dirname(__FILE__).'/_fixtures/user.xml');
14
+        return $this->createMySQLXMLDataSet(dirname(__FILE__) . '/_fixtures/user.xml');
15 15
     }
16 16
 
17 17
     /**
@@ -44,8 +44,8 @@  discard block
 block discarded – undo
44 44
         $id = $u->user_id();
45 45
         $u->init($id);
46 46
 
47
-        $this->assertEquals( 'Test', $u->firstname() );
48
-        $this->assertEquals( 'EH1 99SP', $u->postcode() );
47
+        $this->assertEquals('Test', $u->firstname());
48
+        $this->assertEquals('EH1 99SP', $u->postcode());
49 49
     }
50 50
 
51 51
     public function testEditUser() {
@@ -53,9 +53,9 @@  discard block
 block discarded – undo
53 53
         $u = new THEUSER();
54 54
         $u->loggedin = 1;
55 55
 
56
-        $this->assertEquals( 'Test', $u->firstname() );
56
+        $this->assertEquals('Test', $u->firstname());
57 57
 
58
-        $d = $u->update_self( array(
58
+        $d = $u->update_self(array(
59 59
             'firstname' => 'Experiment',
60 60
             'lastname' => 'User',
61 61
             'emailpublic' => '0',
@@ -64,9 +64,9 @@  discard block
 block discarded – undo
64 64
             'url' => '',
65 65
             'optin' => '',
66 66
             'user_id' => 1
67
-        ) );
67
+        ));
68 68
 
69
-        $this->assertEquals( 'Experiment', $u->firstname() );
69
+        $this->assertEquals('Experiment', $u->firstname());
70 70
     }
71 71
 
72 72
     public function testEditUserEmail() {
@@ -74,9 +74,9 @@  discard block
 block discarded – undo
74 74
         $u = new THEUSER();
75 75
         $u->loggedin = 1;
76 76
 
77
-        $this->assertEquals( '[email protected]', $u->email() );
77
+        $this->assertEquals('[email protected]', $u->email());
78 78
 
79
-        $d = $u->update_self( array(
79
+        $d = $u->update_self(array(
80 80
             'firstname' => 'Experiment',
81 81
             'lastname' => 'User',
82 82
             'email' => '[email protected]',
@@ -86,10 +86,10 @@  discard block
 block discarded – undo
86 86
             'url' => '',
87 87
             'optin' => '',
88 88
             'user_id' => 1
89
-        ), false );
89
+        ), false);
90 90
 
91 91
         // email should not change as user needs to confirm
92
-        $this->assertEquals( '[email protected]', $u->email() );
92
+        $this->assertEquals('[email protected]', $u->email());
93 93
 
94 94
         $tokenCount = $this->getConnection()->getRowCount('tokens', 'data = "1::[email protected]"');
95 95
         $this->assertEquals(1, $tokenCount, 'correct number of email confirm tokens');
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
             'tokens', 'SELECT type, data FROM tokens WHERE data = "1::[email protected]"'
100 100
         );
101 101
 
102
-        $expectedTable = $this->createXmlDataSet(dirname(__FILE__).'/_fixtures/expectedTokens.xml')
102
+        $expectedTable = $this->createXmlDataSet(dirname(__FILE__) . '/_fixtures/expectedTokens.xml')
103 103
                               ->getTable("tokens");
104 104
         $this->assertTablesEqual($expectedTable, $queryTable);
105 105
 
@@ -113,9 +113,9 @@  discard block
 block discarded – undo
113 113
         $tokenRow = $queryTable->getRow(0);
114 114
         $token = '2-' . $tokenRow['token'];
115 115
 
116
-        $u->confirm_email($token,false);
116
+        $u->confirm_email($token, false);
117 117
 
118
-        $this->assertEquals( '[email protected]', $u->email(), 'confirming with token updates email address' );
118
+        $this->assertEquals('[email protected]', $u->email(), 'confirming with token updates email address');
119 119
         $tokenCount = $this->getConnection()->getRowCount('tokens', 'data = "1::[email protected]"');
120 120
         $this->assertEquals(0, $tokenCount, 'token deleted once email confirmed');
121 121
 
@@ -131,15 +131,15 @@  discard block
 block discarded – undo
131 131
         $u = new THEUSER();
132 132
         $u->loggedin = 1;
133 133
 
134
-        $this->assertEquals( '[email protected]', $u->email(), 'confirming inital email address' );
134
+        $this->assertEquals('[email protected]', $u->email(), 'confirming inital email address');
135 135
 
136 136
         $tokenCount = $this->getConnection()->getRowCount('tokens', 'data = "1::[email protected]"');
137 137
         $this->assertEquals(1, $tokenCount, 'correct number of email confirm tokens');
138 138
 
139 139
         $token = '2-lkdsjafhsadjhf';
140 140
 
141
-        $u->confirm_email($token,false);
142
-        $this->assertEquals( '[email protected]', $u->email(), 'expired token does not update email address' );
141
+        $u->confirm_email($token, false);
142
+        $this->assertEquals('[email protected]', $u->email(), 'expired token does not update email address');
143 143
 
144 144
         $tokenCount = $this->getConnection()->getRowCount('tokens', 'data = "1::[email protected]"');
145 145
         $this->assertEquals(1, $tokenCount, 'correct number of email confirm tokens');
Please login to merge, or discard this patch.
tests/PageTest.php 2 patches
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
         $this->assertContains('<span class="party Lab">Labour</span>', $page);
35 35
     }
36 36
 
37
-	public function testSittingMLA()
37
+    public function testSittingMLA()
38 38
     {
39 39
         $page = $this->fetch_page( array( 'pid' => 4, 'url' => '/mp/4/test_current-mla/test_northern_ireland_constituency' ) );
40 40
         $this->assertContains('Test Current-MLA', $page);
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
     /**
64 64
      * Ensure that the Speaker is given the correct constituency.
65 65
      */
66
-	public function testSpeaker()
66
+    public function testSpeaker()
67 67
     {
68 68
         $page = $this->fetch_page( array( 'pid' => 13, 'url' => '/mp/13/test_speaker/buckingham' ) );
69 69
         $this->assertContains('<span class="party SPK">Speaker</span>', $page);
Please login to merge, or discard this patch.
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
      */
12 12
     public function getDataSet()
13 13
     {
14
-        return $this->createMySQLXMLDataSet(dirname(__FILE__).'/_fixtures/member.xml');
14
+        return $this->createMySQLXMLDataSet(dirname(__FILE__) . '/_fixtures/member.xml');
15 15
     }
16 16
 
17 17
     private function fetch_page($vars)
@@ -21,14 +21,14 @@  discard block
 block discarded – undo
21 21
 
22 22
     public function testQueenie()
23 23
     {
24
-        $page = $this->fetch_page( array( 'royal' => 1, 'n' => 'elizabeth_the_second' ) );
24
+        $page = $this->fetch_page(array('royal' => 1, 'n' => 'elizabeth_the_second'));
25 25
         $this->assertContains('Elizabeth the Second', $page);
26 26
         $this->assertContains('Coronated on 2 June 1953', $page);
27 27
     }
28 28
 
29 29
     public function testSittingMP()
30 30
     {
31
-        $page = $this->fetch_page( array( 'pid' => 2, 'url' => '/mp/2/test_current-mp/test_westminster_constituency' ) );
31
+        $page = $this->fetch_page(array('pid' => 2, 'url' => '/mp/2/test_current-mp/test_westminster_constituency'));
32 32
         $this->assertContains('Test Current-MP', $page);
33 33
         $this->assertContains('<span class="constituency">Test Westminster Constituency</span>', $page);
34 34
         $this->assertContains('<span class="party Lab">Labour</span>', $page);
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
 
37 37
 	public function testSittingMLA()
38 38
     {
39
-        $page = $this->fetch_page( array( 'pid' => 4, 'url' => '/mp/4/test_current-mla/test_northern_ireland_constituency' ) );
39
+        $page = $this->fetch_page(array('pid' => 4, 'url' => '/mp/4/test_current-mla/test_northern_ireland_constituency'));
40 40
         $this->assertContains('Test Current-MLA', $page);
41 41
         $this->assertContains('<span class="constituency">Test Northern Ireland Constituency</span>', $page);
42 42
         $this->assertContains('<span class="party SinnFéin">Sinn Féin</span>', $page);
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
      */
48 48
     public function testSittingSinnFeinMP()
49 49
     {
50
-        $page = $this->fetch_page( array( 'pid' => 15, 'url' => '/mp/15/test_current-sf-mp/test_westminster_constituency' ) );
50
+        $page = $this->fetch_page(array('pid' => 15, 'url' => '/mp/15/test_current-sf-mp/test_westminster_constituency'));
51 51
         $this->assertContains('Sinn F&eacute;in MPs do not take their seats in Parliament.', $page);
52 52
     }
53 53
 
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
      */
57 57
     public function testSittingNonSinnFeinMP()
58 58
     {
59
-        $page = $this->fetch_page( array( 'pid' => 2, 'url' => '/mp/2/test_current-mp/test_westminster_constituency' ) );
59
+        $page = $this->fetch_page(array('pid' => 2, 'url' => '/mp/2/test_current-mp/test_westminster_constituency'));
60 60
         $this->assertNotContains('Sinn F&eacute;in MPs do not take their seats in Parliament.', $page);
61 61
     }
62 62
 
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
      */
66 66
 	public function testSpeaker()
67 67
     {
68
-        $page = $this->fetch_page( array( 'pid' => 13, 'url' => '/mp/13/test_speaker/buckingham' ) );
68
+        $page = $this->fetch_page(array('pid' => 13, 'url' => '/mp/13/test_speaker/buckingham'));
69 69
         $this->assertContains('<span class="party SPK">Speaker</span>', $page);
70 70
     }
71 71
 
@@ -75,25 +75,25 @@  discard block
 block discarded – undo
75 75
         # makes sure it is empty in case there's something hanging
76 76
         # about in memcached
77 77
         $banner->set_text('');
78
-        $page = $this->fetch_page( array( 'url' => '/' ) );
78
+        $page = $this->fetch_page(array('url' => '/'));
79 79
         $this->assertNotContains('<div class="banner">', $page);
80 80
         $this->assertNotContains('This is a banner', $page);
81 81
 
82 82
         $banner->set_text('This is a banner');
83
-        $page = $this->fetch_page( array( 'url' => '/' ) );
83
+        $page = $this->fetch_page(array('url' => '/'));
84 84
         $this->assertContains('This is a banner', $page);
85 85
 
86 86
         $banner->set_text('');
87
-        $page = $this->fetch_page( array( 'url' => '/' ) );
87
+        $page = $this->fetch_page(array('url' => '/'));
88 88
         $this->assertNotContains('<div class="banner">', $page);
89 89
         $this->assertNotContains('This is a banner', $page);
90 90
     }
91 91
 
92 92
     public function testNewMPMessage() {
93
-        $page = $this->fetch_page( array( 'pid' => 17, 'url' => '/mp/17/recent_mp/test_westminster_constituency' ) );
93
+        $page = $this->fetch_page(array('pid' => 17, 'url' => '/mp/17/recent_mp/test_westminster_constituency'));
94 94
         $this->assertNotContains('is a recently elected MP', $page);
95 95
         $this->db->query('UPDATE member SET entered_house = NOW() WHERE person_id = 17');
96
-        $page = $this->fetch_page( array( 'pid' => 17, 'url' => '/mp/17/recent_mp/test_westminster_constituency' ) );
96
+        $page = $this->fetch_page(array('pid' => 17, 'url' => '/mp/17/recent_mp/test_westminster_constituency'));
97 97
         $this->assertContains('is a recently elected MP', $page);
98 98
     }
99 99
 
Please login to merge, or discard this patch.
tests/GlossaryTest.php 2 patches
Indentation   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -17,8 +17,8 @@  discard block
 block discarded – undo
17 17
     /**
18 18
      * Ensures the database is prepared and the glossary class is included for every test.
19 19
      */
20
-	public function setUp()
21
-	{
20
+    public function setUp()
21
+    {
22 22
         parent::setUp();
23 23
         
24 24
         include_once('www/includes/easyparliament/glossary.php');
@@ -27,10 +27,10 @@  discard block
 block discarded – undo
27 27
     /**
28 28
      * Test that glossarising a single word works as expected.
29 29
      */
30
-	public function testGlossariseNormal()
30
+    public function testGlossariseNormal()
31 31
     {
32 32
         $args['sort'] = "regexp_replace";
33
-		$glossary = new GLOSSARY($args);
33
+        $glossary = new GLOSSARY($args);
34 34
 		
35 35
         $this->assertEquals('<a href="/glossary/?gl=1" title="In a general election, each Constituency chooses an MP to represent them...." class="glossary">constituency</a>', $glossary->glossarise('constituency'));
36 36
     }
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
     public function testGlossariseInLink()
42 42
     {
43 43
         $args['sort'] = "regexp_replace";
44
-		$glossary = new GLOSSARY($args);
44
+        $glossary = new GLOSSARY($args);
45 45
 		
46 46
         $this->assertEquals('<a href="#">constituency</a>', $glossary->glossarise('<a href="#">constituency</a>'));
47 47
     }
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
     public function testGlossariseInString()
53 53
     {
54 54
         $args['sort'] = "regexp_replace";
55
-		$glossary = new GLOSSARY($args);
55
+        $glossary = new GLOSSARY($args);
56 56
 		
57 57
         $this->assertEquals('fooconstituencybar', $glossary->glossarise('fooconstituencybar'));
58 58
     }
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
     public function testGlossariseInSpacedString()
64 64
     {
65 65
         $args['sort'] = "regexp_replace";
66
-		$glossary = new GLOSSARY($args);
66
+        $glossary = new GLOSSARY($args);
67 67
 		
68 68
         $this->assertEquals('foo <a href="/glossary/?gl=1" title="In a general election, each Constituency chooses an MP to represent them...." class="glossary">constituency</a> bar', $glossary->glossarise('foo constituency bar'));
69 69
     }
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
     public function testWikipediaLinkNormal()
75 75
     {
76 76
         $args['sort'] = "regexp_replace";
77
-		$glossary = new GLOSSARY($args);
77
+        $glossary = new GLOSSARY($args);
78 78
 		
79 79
         $this->assertEquals('<a href="https://en.wikipedia.org/wiki/MP">MP</a>', $glossary->glossarise('MP'));
80 80
     }
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
     public function testWikipediaLinkInLink()
86 86
     {
87 87
         $args['sort'] = "regexp_replace";
88
-		$glossary = new GLOSSARY($args);
88
+        $glossary = new GLOSSARY($args);
89 89
 		
90 90
         $this->assertEquals('<a href="#">MP</a>', $glossary->glossarise('<a href="#">MP</a>'));
91 91
     }
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
     public function testWikipediaLinkInString()
97 97
     {
98 98
         $args['sort'] = "regexp_replace";
99
-		$glossary = new GLOSSARY($args);
99
+        $glossary = new GLOSSARY($args);
100 100
 		
101 101
         $this->assertEquals('fooMPbar', $glossary->glossarise('fooMPbar'));
102 102
     }
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
     public function testWikipediaLinkInSpacedString()
108 108
     {
109 109
         $args['sort'] = "regexp_replace";
110
-		$glossary = new GLOSSARY($args);
110
+        $glossary = new GLOSSARY($args);
111 111
 		
112 112
         $this->assertEquals('foo <a href="https://en.wikipedia.org/wiki/MP">MP</a> bar', $glossary->glossarise('foo MP bar'));
113 113
     }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@
 block discarded – undo
11 11
      */
12 12
     public function getDataSet()
13 13
     {
14
-        return $this->createMySQLXMLDataSet(dirname(__FILE__).'/_fixtures/glossary.xml');
14
+        return $this->createMySQLXMLDataSet(dirname(__FILE__) . '/_fixtures/glossary.xml');
15 15
     }
16 16
 
17 17
     /**
Please login to merge, or discard this patch.
tests/UtilityTest.php 1 patch
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -6,8 +6,8 @@  discard block
 block discarded – undo
6 6
 
7 7
 class UtilityTest extends PHPUnit_Framework_TestCase
8 8
 {
9
-	public function setUp()
10
-	{
9
+    public function setUp()
10
+    {
11 11
         parent::setUp();
12 12
         include_once('www/includes/utility.php');
13 13
     }
@@ -16,7 +16,7 @@  discard block
 block discarded – undo
16 16
      * Test the escaping of replacement strings for use with
17 17
      * preg_replace.
18 18
      */
19
-	public function testPregReplacement()
19
+    public function testPregReplacement()
20 20
     {
21 21
         $example = 'try \1 and $0, also backslash \ and dollar $ alone';
22 22
         $this->assertEquals(
Please login to merge, or discard this patch.
tests/SectionTest.php 3 patches
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -18,13 +18,13 @@  discard block
 block discarded – undo
18 18
 
19 19
     var $types = array('debates', 'whall', 'wrans', 'wms', 'ni', 'sp', 'spwrans', 'lords');
20 20
 
21
-	public function testDebatesFront() {
21
+    public function testDebatesFront() {
22 22
         foreach ($this->types as $type) {
23 23
             $this->fetch_page( array( 'type' => $type ) );
24 24
         }
25 25
     }
26 26
 
27
-	public function testDebatesYear() {
27
+    public function testDebatesYear() {
28 28
         foreach ($this->types as $type) {
29 29
             $page = $this->fetch_page( array( 'type' => $type, 'y' => '2014' ) );
30 30
             $this->assertContains('<div class="calendar">', $page);
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
         }
34 34
     }
35 35
 
36
-	public function testDebatesDay() {
36
+    public function testDebatesDay() {
37 37
         foreach ($this->types as $type) {
38 38
             $page = $this->fetch_page( array( 'type' => $type, 'd' => '2014-01-01' ) );
39 39
             $this->assertContains('Wednesday, 1 January 2014', $page);
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
         }
54 54
     }
55 55
 
56
-	public function testDebatesHeading() {
56
+    public function testDebatesHeading() {
57 57
         foreach ($this->types as $type) {
58 58
             if ($type == 'spwrans') {
59 59
                 # Only one level of headings on spwrans
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
         }
71 71
     }
72 72
 
73
-	public function testDebatesSubheading() {
73
+    public function testDebatesSubheading() {
74 74
         foreach ($this->types as $type) {
75 75
             $page = $this->fetch_page( array( 'type' => $type, 'id' => '2014-01-01b.1.2' ) );
76 76
             $this->assertContains("HeadingA", $page);
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
         }
100 100
     }
101 101
 
102
-	public function testDebatesSpeech() {
102
+    public function testDebatesSpeech() {
103 103
         foreach ($this->types as $type) {
104 104
             $page = $this->fetch_page( array( 'type' => $type, 'id' => '2014-01-01b.1.3' ) );
105 105
             if ($type == 'wrans' || $type == 'spwrans' || $type == 'wms') {
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -20,13 +20,13 @@  discard block
 block discarded – undo
20 20
 
21 21
 	public function testDebatesFront() {
22 22
         foreach ($this->types as $type) {
23
-            $this->fetch_page( array( 'type' => $type ) );
23
+            $this->fetch_page(array('type' => $type));
24 24
         }
25 25
     }
26 26
 
27 27
 	public function testDebatesYear() {
28 28
         foreach ($this->types as $type) {
29
-            $page = $this->fetch_page( array( 'type' => $type, 'y' => '2014' ) );
29
+            $page = $this->fetch_page(array('type' => $type, 'y' => '2014'));
30 30
             $this->assertContains('<div class="calendar">', $page);
31 31
             $this->assertContains('January', $page);
32 32
             $this->assertRegExp('/<td colspan="2">&nbsp;<\/td><td[^>]*><a href="\/' . $type . '\/\?d=2014-01-01">1<\/a><\/td><td[^>]*><span>2<\/span><\/td>/', $page);
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
 
36 36
 	public function testDebatesDay() {
37 37
         foreach ($this->types as $type) {
38
-            $page = $this->fetch_page( array( 'type' => $type, 'd' => '2014-01-01' ) );
38
+            $page = $this->fetch_page(array('type' => $type, 'd' => '2014-01-01'));
39 39
             $this->assertContains('Wednesday, 1 January 2014', $page);
40 40
             $this->assertContains('HeadingA', $page);
41 41
             if ($type == 'wrans') {
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
                 continue;
61 61
             }
62 62
 
63
-            $page = $this->fetch_page( array( 'type' => $type, 'id' => '2014-01-01b.1.1' ) );
63
+            $page = $this->fetch_page(array('type' => $type, 'id' => '2014-01-01b.1.1'));
64 64
             if ($type == 'wrans') {
65 65
                 $this->assertRegexp("#All .*?written answers on 1 Jan 2014#i", $page);
66 66
                 $this->assertContains("QuestionA", $page);
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
 
73 73
 	public function testDebatesSubheading() {
74 74
         foreach ($this->types as $type) {
75
-            $page = $this->fetch_page( array( 'type' => $type, 'id' => '2014-01-01b.1.2' ) );
75
+            $page = $this->fetch_page(array('type' => $type, 'id' => '2014-01-01b.1.2'));
76 76
             $this->assertContains("HeadingA", $page);
77 77
             if ($type == 'spwrans') {
78 78
                 $this->assertContains("QuestionA", $page);
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
 
102 102
 	public function testDebatesSpeech() {
103 103
         foreach ($this->types as $type) {
104
-            $page = $this->fetch_page( array( 'type' => $type, 'id' => '2014-01-01b.1.3' ) );
104
+            $page = $this->fetch_page(array('type' => $type, 'id' => '2014-01-01b.1.3'));
105 105
             if ($type == 'wrans' || $type == 'spwrans' || $type == 'wms') {
106 106
                 $this->assertRegexp("#Location: .*?/$type/\?id=2014-01-01b\.1\.2#", $page);
107 107
             } else {
@@ -125,13 +125,13 @@  discard block
 block discarded – undo
125 125
      * @group xapian
126 126
      */
127 127
     public function testGlossaryAndSearchHighlights() {
128
-            $page = $this->fetch_page( array( 'type' => 'lords', 's' => 'constituency', 'id' => '2014-02-02b.1.3' ) );
128
+            $page = $this->fetch_page(array('type' => 'lords', 's' => 'constituency', 'id' => '2014-02-02b.1.3'));
129 129
             $this->assertContains("constituency", $page);
130 130
             $this->assertContains("<span class=\"hi\"><a href=\"/glossary/?gl=1\" title=\"In a general election, each Constituency chooses an MP to represent them....\" class=\"glossary\">constituency</a></span>", $page);
131 131
     }
132 132
 
133 133
     public function testGidRedirect() {
134
-        $page = $this->fetch_page( array( 'type' => 'wrans', 'id' => '2014-01-01a.187335.h' ) );
134
+        $page = $this->fetch_page(array('type' => 'wrans', 'id' => '2014-01-01a.187335.h'));
135 135
         $this->assertRegexp("#Location: .*?/wrans/\?id=2014-01-01b\.1\.2#", $page);
136 136
     }
137 137
 }
Please login to merge, or discard this patch.
Braces   +16 added lines, -8 removed lines patch added patch discarded remove patch
@@ -41,12 +41,15 @@  discard block
 block discarded – undo
41 41
             if ($type == 'wrans') {
42 42
                 $this->assertContains('DepartmentA', $page);
43 43
                 $this->assertContains('QuestionA', $page);
44
-            } elseif ($type == 'spwrans') {
44
+            }
45
+            elseif ($type == 'spwrans') {
45 46
                 $this->assertContains('QuestionA', $page);
46
-            } elseif ($type == 'wms') {
47
+            }
48
+            elseif ($type == 'wms') {
47 49
                 $this->assertContains('DepartmentA', $page);
48 50
                 $this->assertContains('StatementA', $page);
49
-            } else {
51
+            }
52
+            else {
50 53
                 $this->assertContains('SubheadingA', $page);
51 54
                 $this->assertContains('SpeechA', $page);
52 55
             }
@@ -64,7 +67,8 @@  discard block
 block discarded – undo
64 67
             if ($type == 'wrans') {
65 68
                 $this->assertRegexp("#All .*?written answers on 1 Jan 2014#i", $page);
66 69
                 $this->assertContains("QuestionA", $page);
67
-            } else {
70
+            }
71
+            else {
68 72
                 $this->assertRegexp("#Location: .*?/$type/\?id=2014-01-01b\.1\.2#", $page);
69 73
             }
70 74
         }
@@ -77,7 +81,8 @@  discard block
 block discarded – undo
77 81
             if ($type == 'spwrans') {
78 82
                 $this->assertContains("QuestionA", $page);
79 83
                 $this->assertContains("AnswerA", $page);
80
-            } elseif ($type == 'wrans') {
84
+            }
85
+            elseif ($type == 'wrans') {
81 86
                 $this->assertContains("DepartmentA", $page);
82 87
                 $this->assertContains("QuestionA", $page);
83 88
                 $this->assertContains("AnswerA", $page);
@@ -86,10 +91,12 @@  discard block
 block discarded – undo
86 91
                 $this->assertContains('Mp2 Mp2', $page);
87 92
                 $this->assertContains('Birmingham', $page);
88 93
                 $this->assertContains('Independent', $page);
89
-            } elseif ($type == 'wms') {
94
+            }
95
+            elseif ($type == 'wms') {
90 96
                 $this->assertContains('DepartmentA', $page);
91 97
                 $this->assertContains('StatementA', $page);
92
-            } else {
98
+            }
99
+            else {
93 100
                 $this->assertContains("SubheadingA", $page);
94 101
                 $this->assertContains("SpeechA", $page);
95 102
             }
@@ -104,7 +111,8 @@  discard block
 block discarded – undo
104 111
             $page = $this->fetch_page( array( 'type' => $type, 'id' => '2014-01-01b.1.3' ) );
105 112
             if ($type == 'wrans' || $type == 'spwrans' || $type == 'wms') {
106 113
                 $this->assertRegexp("#Location: .*?/$type/\?id=2014-01-01b\.1\.2#", $page);
107
-            } else {
114
+            }
115
+            else {
108 116
                 $this->assertContains("HeadingA", $page);
109 117
                 $this->assertContains("SubheadingA", $page);
110 118
                 $this->assertContains("2:30 pm", $page);
Please login to merge, or discard this patch.