Passed
Pull Request — master (#1850)
by
unknown
04:48
created
tests/AlertsPageTest.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -21,31 +21,31 @@
 block discarded – undo
21 21
     }
22 22
 
23 23
     public function testKeywordOnly() {
24
-        $page = $this->fetch_page([ 'alertsearch' => 'elephant']);
24
+        $page = $this->fetch_page(['alertsearch' => 'elephant']);
25 25
         $this->assertStringContainsString('Receive alerts when [elephant] is mentioned', $page);
26 26
     }
27 27
 
28 28
     public function testPostCodeOnly() {
29
-        $page = $this->fetch_page([ 'alertsearch' => 'SE17 3HE']);
29
+        $page = $this->fetch_page(['alertsearch' => 'SE17 3HE']);
30 30
         $this->assertStringContainsString('when Mrs Test Current-MP', $page);
31 31
     }
32 32
 
33 33
     public function testPostCodeWithKeyWord() {
34
-        $page = $this->fetch_page([ 'alertsearch' => 'SE17 3HE elephant']);
34
+        $page = $this->fetch_page(['alertsearch' => 'SE17 3HE elephant']);
35 35
         $this->assertStringContainsString('You have used a postcode and something else', $page);
36 36
         $this->assertStringContainsString('Mentions of [elephant] by your MP, Mrs Test Current-MP', $page);
37 37
         $this->assertStringNotContainsString('by your MSP', $page);
38 38
     }
39 39
 
40 40
     public function testScottishPostcodeWithKeyword() {
41
-        $page = $this->fetch_page([ 'alertsearch' => 'PH6 2DB elephant']);
41
+        $page = $this->fetch_page(['alertsearch' => 'PH6 2DB elephant']);
42 42
         $this->assertStringContainsString('You have used a postcode and something else', $page);
43 43
         $this->assertStringContainsString('Mentions of [elephant] by your MP, Mr Test2 Current-MP', $page);
44 44
         $this->assertStringContainsString('Mentions of [elephant] by your MSP, Mrs Test Current-MSP', $page);
45 45
     }
46 46
 
47 47
     public function testPostcodeAndKeywordWithNoSittingMP() {
48
-        $page = $this->fetch_page([ 'alertsearch' => 'OX1 4LF elephant']);
48
+        $page = $this->fetch_page(['alertsearch' => 'OX1 4LF elephant']);
49 49
         $this->assertStringContainsString('You have used a postcode and something else', $page);
50 50
         $this->assertStringNotContainsString('Did you mean to get alerts for when your MP', $page);
51 51
     }
Please login to merge, or discard this patch.
tests/UserPageTest.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -40,7 +40,7 @@
 block discarded – undo
40 40
     }
41 41
 
42 42
     public function testEditUserInfo() {
43
-        $page = $this->fetch_user_page(['pg' => 'edit' ]);
43
+        $page = $this->fetch_user_page(['pg' => 'edit']);
44 44
         $this->assertStringContainsString('Edit your details', $page);
45 45
         $this->assertStringContainsString('name="pg" value="edit"', $page);
46 46
         $this->assertStringContainsString('value="Test"', $page);
Please login to merge, or discard this patch.
tests/VotesTest.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@
 block discarded – undo
13 13
     }
14 14
 
15 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' ]);
16
+        return $this->fetch_page(['pagetype' => 'votes', 'pid' => 2, 'url' => '/mp/2/test_current-mp/test_westminster_constituency/votes']);
17 17
     }
18 18
 
19 19
     public function testVoteSummary() {
Please login to merge, or discard this patch.
tests/DivisionsTest.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -13,16 +13,16 @@  discard block
 block discarded – undo
13 13
     }
14 14
 
15 15
     private function fetch_division_page() {
16
-        return $this->fetch_page([ 'pagetype' => 'divisions', 'pid' => 2, 'policy' => 363, 'url' => '/mp/2/test_current-mp/test_westminster_constituency/divisions' ]);
16
+        return $this->fetch_page(['pagetype' => 'divisions', 'pid' => 2, 'policy' => 363, 'url' => '/mp/2/test_current-mp/test_westminster_constituency/divisions']);
17 17
     }
18 18
 
19 19
     private function fetch_mp_recent_page() {
20
-        $vars = [ 'pagetype' => 'recent', 'pid' => 2, 'url' => '/mp/2/test_current-mp/test_westminster_constituency/recent' ];
20
+        $vars = ['pagetype' => 'recent', 'pid' => 2, 'url' => '/mp/2/test_current-mp/test_westminster_constituency/recent'];
21 21
         return $this->base_fetch_page($vars, 'mp', 'index.php', '/mp/recent.php');
22 22
     }
23 23
 
24 24
     private function fetch_recent_page() {
25
-        return $this->base_fetch_page(['url' => '/divisions' ], 'divisions', 'index.php', '/divisions/index.php');
25
+        return $this->base_fetch_page(['url' => '/divisions'], 'divisions', 'index.php', '/divisions/index.php');
26 26
     }
27 27
 
28 28
 
@@ -51,13 +51,13 @@  discard block
 block discarded – undo
51 51
 
52 52
     public function testMPPageContainsAgreement() {
53 53
         // Checks this MP contains a reference to the agreement
54
-        $page = $this->fetch_page([ 'pagetype' => 'divisions', 'pid' => 2, 'policy' => 363, 'url' => '/mp/2/test_current-mp/test_westminster_constituency/divisions' ]);
54
+        $page = $this->fetch_page(['pagetype' => 'divisions', 'pid' => 2, 'policy' => 363, 'url' => '/mp/2/test_current-mp/test_westminster_constituency/divisions']);
55 55
         $this->assertStringContainsString('Example Agreement', $page);
56 56
     }
57 57
 
58 58
     public function testMPPageDoesNotContainsAgreement() {
59 59
         // Checks this MP does not contain agreement - should be out of time scope
60
-        $page = $this->fetch_page([ 'pagetype' => 'divisions', 'pid' => 6, 'policy' => 363, 'url' => '/mp/6/test_current-mp/test_westminster_constituency/divisions' ]);
60
+        $page = $this->fetch_page(['pagetype' => 'divisions', 'pid' => 6, 'policy' => 363, 'url' => '/mp/6/test_current-mp/test_westminster_constituency/divisions']);
61 61
         $this->assertStringNotContainsString('Example Agreement', $page);
62 62
         $this->assertStringNotContainsString('This person has not voted on this policy', $page);
63 63
 
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
     }
122 122
 
123 123
     public function testNotEnoughInfoStatement() {
124
-        return $this->fetch_page([ 'pagetype' => 'divisions', 'pid' => 2, 'policy' => 810, 'url' => '/mp/2/test_current-mp/test_westminster_constituency/divisions' ]);
124
+        return $this->fetch_page(['pagetype' => 'divisions', 'pid' => 2, 'policy' => 810, 'url' => '/mp/2/test_current-mp/test_westminster_constituency/divisions']);
125 125
         $this->assertStringContainsString('we don’t have enough information to calculate Test Current-MP’s position', $page);
126 126
     }
127 127
 
@@ -132,7 +132,7 @@  discard block
 block discarded – undo
132 132
     }
133 133
 
134 134
     public function testSingleDivision() {
135
-        $page = $this->base_fetch_page(['url' => '/divisions/division.php', 'vote' => 'pw-3012-01-01-1-commons' ], 'divisions', 'division.php', '/divisions/division.php');
135
+        $page = $this->base_fetch_page(['url' => '/divisions/division.php', 'vote' => 'pw-3012-01-01-1-commons'], 'divisions', 'division.php', '/divisions/division.php');
136 136
         $this->assertStringContainsString('A majority of MPs  <b>voted in favour</b> of a thing', $page);
137 137
         $this->assertStringContainsString('Aye: 200', $page);
138 138
         $this->assertStringNotContainsString('No:', $page); # Summary 100, but no actual votes. In reality, summary can only be <= actual.
Please login to merge, or discard this patch.
tests/SectionTest.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -16,13 +16,13 @@  discard block
 block discarded – undo
16 16
 
17 17
     public function testDebatesFront() {
18 18
         foreach ($this->types as $type) {
19
-            $this->fetch_page([ 'type' => $type ]);
19
+            $this->fetch_page(['type' => $type]);
20 20
         }
21 21
     }
22 22
 
23 23
     public function testDebatesYear() {
24 24
         foreach ($this->types as $type) {
25
-            $page = $this->fetch_page([ 'type' => $type, 'y' => '2014' ]);
25
+            $page = $this->fetch_page(['type' => $type, 'y' => '2014']);
26 26
             $this->assertStringContainsString('<div class="calendar">', $page);
27 27
             $this->assertStringContainsString('January', $page);
28 28
             $this->assertMatchesRegularExpression('/<td colspan="2">&nbsp;<\/td><td[^>]*><a href="\/' . $type . '\/\?d=2014-01-01">1<\/a><\/td><td[^>]*><span>2<\/span><\/td>/', $page);
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
 
32 32
     public function testDebatesDay() {
33 33
         foreach ($this->types as $type) {
34
-            $page = $this->fetch_page([ 'type' => $type, 'd' => '2014-01-01' ]);
34
+            $page = $this->fetch_page(['type' => $type, 'd' => '2014-01-01']);
35 35
             $this->assertStringContainsString('Wednesday,  1 January 2014', $page);
36 36
             $this->assertStringContainsString('HeadingA', $page);
37 37
             if ($type == 'wrans') {
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
                 continue;
57 57
             }
58 58
 
59
-            $page = $this->fetch_page([ 'type' => $type, 'id' => '2014-01-01b.1.1' ]);
59
+            $page = $this->fetch_page(['type' => $type, 'id' => '2014-01-01b.1.1']);
60 60
             if ($type == 'wrans') {
61 61
                 $this->assertMatchesRegularExpression("#All .*?written answers on  1 Jan 2014#i", $page);
62 62
                 $this->assertStringContainsString("QuestionA", $page);
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
 
69 69
     public function testDebatesSubheading() {
70 70
         foreach ($this->types as $type) {
71
-            $page = $this->fetch_page([ 'type' => $type, 'id' => '2014-01-01b.1.2' ]);
71
+            $page = $this->fetch_page(['type' => $type, 'id' => '2014-01-01b.1.2']);
72 72
             $this->assertStringContainsString("HeadingA", $page);
73 73
             if ($type == 'spwrans') {
74 74
                 $this->assertStringContainsString("QuestionA", $page);
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
 
99 99
     public function testDebatesSpeech() {
100 100
         foreach ($this->types as $type) {
101
-            $page = $this->fetch_page([ 'type' => $type, 'id' => '2014-01-01b.1.3' ]);
101
+            $page = $this->fetch_page(['type' => $type, 'id' => '2014-01-01b.1.3']);
102 102
             if ($type == 'wrans' || $type == 'spwrans' || $type == 'wms') {
103 103
                 $this->assertMatchesRegularExpression("#Location: .*?/$type/\?id=2014-01-01b\.1\.2#", $page);
104 104
             } else {
@@ -123,13 +123,13 @@  discard block
 block discarded – undo
123 123
      * @group xapian
124 124
      */
125 125
     public function testGlossaryAndSearchHighlights() {
126
-        $page = $this->fetch_page([ 'type' => 'lords', 's' => 'constituency', 'id' => '2014-02-02b.1.3' ]);
126
+        $page = $this->fetch_page(['type' => 'lords', 's' => 'constituency', 'id' => '2014-02-02b.1.3']);
127 127
         $this->assertStringContainsString("constituency", $page);
128 128
         $this->assertStringContainsString("<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);
129 129
     }
130 130
 
131 131
     public function testGidRedirect() {
132
-        $page = $this->fetch_page([ 'type' => 'wrans', 'id' => '2014-01-01a.187335.h' ]);
132
+        $page = $this->fetch_page(['type' => 'wrans', 'id' => '2014-01-01a.187335.h']);
133 133
         $this->assertMatchesRegularExpression("#Location: .*?/wrans/\?id=2014-01-01b\.1\.2#", $page);
134 134
     }
135 135
 }
Please login to merge, or discard this patch.
classes/Utility/LibFilter.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -153,7 +153,7 @@  discard block
 block discarded – undo
153 153
 
154 154
     public function escape_comments($data) {
155 155
 
156
-        $data = preg_replace_callback("/<!--(.*?)-->/s", function ($matches) {
156
+        $data = preg_replace_callback("/<!--(.*?)-->/s", function($matches) {
157 157
             return '<!--' . HtmlSpecialChars($this->StripSingle($matches[1])) . '-->';
158 158
         }, $data);
159 159
 
@@ -203,7 +203,7 @@  discard block
 block discarded – undo
203 203
 
204 204
     public function check_tags($data) {
205 205
 
206
-        $data = preg_replace_callback("/<(.*?)>/s", function ($matches) {
206
+        $data = preg_replace_callback("/<(.*?)>/s", function($matches) {
207 207
             return $this->process_tag($this->StripSingle($matches[1]));
208 208
         }, $data);
209 209
 
@@ -391,7 +391,7 @@  discard block
 block discarded – undo
391 391
 
392 392
         $data = preg_replace_callback(
393 393
             '/(^|[^\w\s\';,\\-])(\s*)([a-z])/',
394
-            function ($m) {
394
+            function($m) {
395 395
                 return $m[1] . $m[2] . strtoupper($m[3]);
396 396
             },
397 397
             $data
@@ -432,7 +432,7 @@  discard block
 block discarded – undo
432 432
 
433 433
         $data = preg_replace_callback(
434 434
             '!&([^&;]*)(?=(;|&|$))!',
435
-            function ($matches) {
435
+            function($matches) {
436 436
                 return $this->check_entity($this->StripSingle($matches[1]), $this->StripSingle($matches[2]));
437 437
             },
438 438
             $data
Please login to merge, or discard this patch.
classes/Utility/Wikipedia.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
106 106
         }
107 107
 
108 108
         # Sort into order, largest first
109
-        usort($phrases, function ($a, $b) {
109
+        usort($phrases, function($a, $b) {
110 110
             return strlen($a) < strlen($b);
111 111
         });
112 112
 
@@ -156,31 +156,31 @@  discard block
 block discarded – undo
156 156
 
157 157
     public static function antiTagInTag($content = '', $format = 'htmlhead') {
158 158
         $tagend = -1;
159
-        for($tagstart = strpos($content, '<', $tagend + 1) ; $tagstart !== false && $tagstart < strlen($content); $tagstart = strpos($content, '<', $tagend)) {
159
+        for ($tagstart = strpos($content, '<', $tagend + 1); $tagstart !== false && $tagstart < strlen($content); $tagstart = strpos($content, '<', $tagend)) {
160 160
             // got the start of a tag.  Now find the proper end!
161 161
             $walker = $tagstart + 1;
162 162
             $open = 1;
163
-            while($open != 0 && $walker < strlen($content)) {
163
+            while ($open != 0 && $walker < strlen($content)) {
164 164
                 $nextopen = strpos($content, '<', $walker);
165 165
                 $nextclose = strpos($content, '>', $walker);
166
-                if($nextclose === false) {
166
+                if ($nextclose === false) {
167 167
                     // ERROR! Open waka without close waka!
168 168
                     // echo '<code>Error in antiTagInTag - malformed tag!</code> ';
169 169
                     return $content;
170 170
                 }
171
-                if($nextopen === false || $nextopen > $nextclose) {
171
+                if ($nextopen === false || $nextopen > $nextclose) {
172 172
                     // No more opens, but there was a close; or, a close happens before the next open.
173 173
                     // walker goes to the close+1, and open decrements
174 174
                     $open--;
175 175
                     $walker = $nextclose + 1;
176
-                } elseif($nextopen < $nextclose) {
176
+                } elseif ($nextopen < $nextclose) {
177 177
                     // an open before the next close
178 178
                     $open++;
179 179
                     $walker = $nextopen + 1;
180 180
                 }
181 181
             }
182 182
             $tagend = $walker;
183
-            if($tagend > strlen($content)) {
183
+            if ($tagend > strlen($content)) {
184 184
                 $tagend = strlen($content);
185 185
             } else {
186 186
                 $tagend--;
Please login to merge, or discard this patch.
classes/Search/Normal.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
         }
13 13
 
14 14
         $o = get_http_var('o');
15
-        $args =  [
15
+        $args = [
16 16
             's' => $this->searchstring,
17 17
             'p' => $pagenum,
18 18
             'num' => get_http_var('num'),
@@ -246,22 +246,22 @@  discard block
 block discarded – undo
246 246
 
247 247
             if ($page != 1) {
248 248
                 $prev_page = $page - 1;
249
-                $URL->insert([ 'p' => $prev_page ]);
249
+                $URL->insert(['p' => $prev_page]);
250 250
                 $pagelinks['prev'] = [
251 251
                     'url' => $URL->generate(),
252 252
                 ];
253
-                $URL->insert([ 'p' => 1 ]);
253
+                $URL->insert(['p' => 1]);
254 254
                 $pagelinks['firstpage'] = [
255 255
                     'url' => $URL->generate(),
256 256
                 ];
257 257
             }
258 258
             if ($page != $numpages) {
259 259
                 $next_page = $page + 1;
260
-                $URL->insert([ 'p' => $next_page ]);
260
+                $URL->insert(['p' => $next_page]);
261 261
                 $pagelinks['next'] = [
262 262
                     'url' => $URL->generate(),
263 263
                 ];
264
-                $URL->insert([ 'p' => $numpages ]);
264
+                $URL->insert(['p' => $numpages]);
265 265
                 $pagelinks['lastpage'] = [
266 266
                     'url' => $URL->generate(),
267 267
                 ];
Please login to merge, or discard this patch.
classes/Divisions.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
         $where = [];
69 69
         if ($houses) {
70 70
             if (is_string($houses)) {
71
-                $houses = [ $houses ];
71
+                $houses = [$houses];
72 72
             }
73 73
             $where[] = 'house IN ("' . implode('", "', $houses) . '")';
74 74
         }
@@ -410,7 +410,7 @@  discard block
 block discarded – undo
410 410
                     FROM person_names AS pn
411 411
                     WHERE person_id = :person_id
412 412
                     AND start_date <= :division_date AND end_date >= :division_date",
413
-                    [ ':person_id' => $vote['proxy'], ':division_date' => $row['division_date'] ]
413
+                    [':person_id' => $vote['proxy'], ':division_date' => $row['division_date']]
414 414
                 )->first();
415 415
                 $detail['proxy'] = ucfirst(member_full_name(
416 416
                     HOUSE_TYPE_COMMONS,
@@ -438,7 +438,7 @@  discard block
 block discarded – undo
438 438
 
439 439
         foreach ($votes as $vote => $count) { // array('yes_votes', 'no_votes', 'absent_votes', 'both_votes') as $vote) {
440 440
             $votes[$vote . '_by_party'] = $votes[$vote];
441
-            usort($votes[$vote . '_by_party'], function ($a, $b) {
441
+            usort($votes[$vote . '_by_party'], function($a, $b) {
442 442
                 return $a['party'] > $b['party'];
443 443
             });
444 444
         }
@@ -561,7 +561,7 @@  discard block
 block discarded – undo
561 561
     }
562 562
 
563 563
     private function constructYesNoVoteDescription($direction, $title, $short_text) {
564
-        $text = ' ' ;
564
+        $text = ' ';
565 565
         if ($short_text) {
566 566
             $text .= sprintf(gettext('voted %s'), $short_text);
567 567
         } else {
@@ -711,7 +711,7 @@  discard block
 block discarded – undo
711 711
 
712 712
         $gid = get_canonical_gid($gid);
713 713
 
714
-        $q = $this->db->query("SELECT gid, major FROM hansard WHERE epobject_id = ( SELECT subsection_id FROM hansard WHERE gid = :gid )", [ ':gid' => $gid ])->first();
714
+        $q = $this->db->query("SELECT gid, major FROM hansard WHERE epobject_id = ( SELECT subsection_id FROM hansard WHERE gid = :gid )", [':gid' => $gid])->first();
715 715
         if (!$q) {
716 716
             return '';
717 717
         }
Please login to merge, or discard this patch.