@@ -21,11 +21,11 @@ discard block |
||
21 | 21 | |
22 | 22 | public function testConstituencySearch() { |
23 | 23 | $this->assertEquals( |
24 | - [ [ 'Alyn and Deeside' ], false ], |
|
24 | + [['Alyn and Deeside'], false], |
|
25 | 25 | \MySociety\TheyWorkForYou\Utility\Search::searchConstituenciesByQuery('Alyn') |
26 | 26 | ); |
27 | 27 | $this->assertEquals( |
28 | - [ [ 'Alyn and Deeside' ], false ], |
|
28 | + [['Alyn and Deeside'], false], |
|
29 | 29 | \MySociety\TheyWorkForYou\Utility\Search::searchConstituenciesByQuery('Alyn and Deeside') |
30 | 30 | ); |
31 | 31 | } |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | * @group xapian |
110 | 110 | */ |
111 | 111 | public function testSearchPage() { |
112 | - $page = $this->fetch_page([ ]); |
|
112 | + $page = $this->fetch_page([]); |
|
113 | 113 | $this->assertStringContainsString('Search', $page); |
114 | 114 | } |
115 | 115 | |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | * @group xapian |
120 | 120 | */ |
121 | 121 | public function testSearchPageMP() { |
122 | - $page = $this->fetch_page([ 'q' => 'Mary Smith' ]); |
|
122 | + $page = $this->fetch_page(['q' => 'Mary Smith']); |
|
123 | 123 | $this->assertStringContainsString('Mary Smith', $page); |
124 | 124 | $this->assertMatchesRegularExpression('/MP *for Amber Valley/', $page); |
125 | 125 | } |
@@ -130,7 +130,7 @@ discard block |
||
130 | 130 | * @group xapian |
131 | 131 | */ |
132 | 132 | public function testSearchPageMultipleMP() { |
133 | - $page = $this->fetch_page([ 'q' => 'Jones' ]); |
|
133 | + $page = $this->fetch_page(['q' => 'Jones']); |
|
134 | 134 | $this->assertStringContainsString('People matching <em class="current-search-term">Jones</em>', $page); |
135 | 135 | $this->assertStringContainsString('Andrew Jones', $page); |
136 | 136 | $this->assertStringContainsString('Simon Jones', $page); |
@@ -142,7 +142,7 @@ discard block |
||
142 | 142 | * @group xapian |
143 | 143 | */ |
144 | 144 | public function testSearchPageCons() { |
145 | - $page = $this->fetch_page([ 'q' => 'Amber' ]); |
|
145 | + $page = $this->fetch_page(['q' => 'Amber']); |
|
146 | 146 | $this->assertStringContainsString('MP for <em class="current-search-term">Amber</em>', $page); |
147 | 147 | $this->assertStringContainsString('Mary Smith', $page); |
148 | 148 | } |
@@ -154,7 +154,7 @@ discard block |
||
154 | 154 | * @group xapian |
155 | 155 | */ |
156 | 156 | public function testSearchPageConsWithNoMp() { |
157 | - $page = $this->fetch_page([ 'q' => 'Alyn' ]); |
|
157 | + $page = $this->fetch_page(['q' => 'Alyn']); |
|
158 | 158 | $this->assertStringNotContainsString('MP for <em class="current-search-term">Alyn</em>', $page); |
159 | 159 | $this->assertStringNotContainsString('MPs in constituencies matching', $page); |
160 | 160 | } |
@@ -166,7 +166,7 @@ discard block |
||
166 | 166 | * @group xapian |
167 | 167 | */ |
168 | 168 | public function testSearchPageMultipleCons() { |
169 | - $page = $this->fetch_page([ 'q' => 'Liverpool' ]); |
|
169 | + $page = $this->fetch_page(['q' => 'Liverpool']); |
|
170 | 170 | $this->assertStringContainsString('MPs in constituencies matching <em class="current-search-term">Liverpool</em>', $page); |
171 | 171 | $this->assertStringContainsString('Susan Brown', $page); |
172 | 172 | $this->assertMatchesRegularExpression('/MP *for Liverpool, Riverside/', $page); |
@@ -180,7 +180,7 @@ discard block |
||
180 | 180 | * @group xapian |
181 | 181 | */ |
182 | 182 | public function testSearchPageGlossary() { |
183 | - $page = $this->fetch_page([ 'q' => 'other place' ]); |
|
183 | + $page = $this->fetch_page(['q' => 'other place']); |
|
184 | 184 | $this->assertStringContainsString('Glossary items matching', $page); |
185 | 185 | $this->assertStringContainsString('<a href="/glossary/?gl=1">“other place', $page); |
186 | 186 | } |
@@ -191,7 +191,7 @@ discard block |
||
191 | 191 | * @group xapian |
192 | 192 | */ |
193 | 193 | public function testSearchPageSpellCorrect() { |
194 | - $page = $this->fetch_page([ 'q' => 'plice' ]); |
|
194 | + $page = $this->fetch_page(['q' => 'plice']); |
|
195 | 195 | $this->assertStringContainsString('Did you mean <a href="/search/?q=place">place', $page); |
196 | 196 | } |
197 | 197 | |
@@ -201,7 +201,7 @@ discard block |
||
201 | 201 | * @group xapian |
202 | 202 | */ |
203 | 203 | public function testSearchBySpeakerNoResults() { |
204 | - $page = $this->fetch_page([ 'q' => 'splice', 'o' => 'p' ]); |
|
204 | + $page = $this->fetch_page(['q' => 'splice', 'o' => 'p']); |
|
205 | 205 | $this->assertStringContainsString('Who says splice the most', $page); |
206 | 206 | $this->assertStringContainsString('No results', $page); |
207 | 207 | } |
@@ -228,7 +228,7 @@ discard block |
||
228 | 228 | * @group xapian |
229 | 229 | */ |
230 | 230 | public function testSearchPageRSS() { |
231 | - $page = $this->fetch_page([ 'q' => 'test' ]); |
|
231 | + $page = $this->fetch_page(['q' => 'test']); |
|
232 | 232 | $this->assertStringContainsString('<a href="/search/rss/?s=test">get an RSS feed', $page); |
233 | 233 | } |
234 | 234 |
@@ -13,16 +13,16 @@ discard block |
||
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 |
||
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 |
||
121 | 121 | } |
122 | 122 | |
123 | 123 | public function testNotEnoughInfoStatement() { |
124 | - $page = $this->fetch_page([ 'pagetype' => 'divisions', 'pid' => 2, 'policy' => 810, 'url' => '/mp/2/test_current-mp/test_westminster_constituency/divisions' ]); |
|
124 | + $page = $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 Mrs Test Current-MP’s position', $page); |
126 | 126 | } |
127 | 127 | |
@@ -132,7 +132,7 @@ discard block |
||
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. |
@@ -16,14 +16,14 @@ discard block |
||
16 | 16 | |
17 | 17 | public function testDebatesFront() { |
18 | 18 | foreach ($this->types as $type) { |
19 | - $page = $this->fetch_page([ 'type' => $type ]); |
|
19 | + $page = $this->fetch_page(['type' => $type]); |
|
20 | 20 | $this->assertStringContainsString($type, $page); |
21 | 21 | } |
22 | 22 | } |
23 | 23 | |
24 | 24 | public function testDebatesYear() { |
25 | 25 | foreach ($this->types as $type) { |
26 | - $page = $this->fetch_page([ 'type' => $type, 'y' => '2014' ]); |
|
26 | + $page = $this->fetch_page(['type' => $type, 'y' => '2014']); |
|
27 | 27 | $this->assertStringContainsString('<div class="calendar">', $page); |
28 | 28 | $this->assertStringContainsString('January', $page); |
29 | 29 | $this->assertMatchesRegularExpression('/<td colspan="2"> <\/td><td[^>]*><a href="\/' . $type . '\/\?d=2014-01-01">1<\/a><\/td><td[^>]*><span>2<\/span><\/td>/', $page); |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | |
33 | 33 | public function testDebatesDay() { |
34 | 34 | foreach ($this->types as $type) { |
35 | - $page = $this->fetch_page([ 'type' => $type, 'd' => '2014-01-01' ]); |
|
35 | + $page = $this->fetch_page(['type' => $type, 'd' => '2014-01-01']); |
|
36 | 36 | $this->assertStringContainsString('Wednesday, 1 January 2014', $page); |
37 | 37 | $this->assertStringContainsString('HeadingA', $page); |
38 | 38 | if ($type == 'wrans') { |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | continue; |
58 | 58 | } |
59 | 59 | |
60 | - $page = $this->fetch_page([ 'type' => $type, 'id' => '2014-01-01b.1.1' ]); |
|
60 | + $page = $this->fetch_page(['type' => $type, 'id' => '2014-01-01b.1.1']); |
|
61 | 61 | if ($type == 'wrans') { |
62 | 62 | $this->assertMatchesRegularExpression("#All .*?written answers on 1 Jan 2014#i", $page); |
63 | 63 | $this->assertStringContainsString("QuestionA", $page); |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | |
70 | 70 | public function testDebatesSubheading() { |
71 | 71 | foreach ($this->types as $type) { |
72 | - $page = $this->fetch_page([ 'type' => $type, 'id' => '2014-01-01b.1.2' ]); |
|
72 | + $page = $this->fetch_page(['type' => $type, 'id' => '2014-01-01b.1.2']); |
|
73 | 73 | $this->assertStringContainsString("HeadingA", $page); |
74 | 74 | if ($type == 'spwrans') { |
75 | 75 | $this->assertStringContainsString("QuestionA", $page); |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | |
100 | 100 | public function testDebatesSpeech() { |
101 | 101 | foreach ($this->types as $type) { |
102 | - $page = $this->fetch_page([ 'type' => $type, 'id' => '2014-01-01b.1.3' ]); |
|
102 | + $page = $this->fetch_page(['type' => $type, 'id' => '2014-01-01b.1.3']); |
|
103 | 103 | if ($type == 'wrans' || $type == 'spwrans' || $type == 'wms') { |
104 | 104 | $this->assertMatchesRegularExpression("#Location: .*?/$type/\?id=2014-01-01b\.1\.2#", $page); |
105 | 105 | } else { |
@@ -124,13 +124,13 @@ discard block |
||
124 | 124 | * @group xapian |
125 | 125 | */ |
126 | 126 | public function testGlossaryAndSearchHighlights() { |
127 | - $page = $this->fetch_page([ 'type' => 'lords', 's' => 'constituency', 'id' => '2014-02-02b.1.3' ]); |
|
127 | + $page = $this->fetch_page(['type' => 'lords', 's' => 'constituency', 'id' => '2014-02-02b.1.3']); |
|
128 | 128 | $this->assertStringContainsString("constituency", $page); |
129 | 129 | $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); |
130 | 130 | } |
131 | 131 | |
132 | 132 | public function testGidRedirect() { |
133 | - $page = $this->fetch_page([ 'type' => 'wrans', 'id' => '2014-01-01a.187335.h' ]); |
|
133 | + $page = $this->fetch_page(['type' => 'wrans', 'id' => '2014-01-01a.187335.h']); |
|
134 | 134 | $this->assertMatchesRegularExpression("#Location: .*?/wrans/\?id=2014-01-01b\.1\.2#", $page); |
135 | 135 | } |
136 | 136 | } |
@@ -42,6 +42,6 @@ |
||
42 | 42 | return $category; |
43 | 43 | } |
44 | 44 | } |
45 | - throw new InvalidArgumentException("Category $categoryId not found in register"); |
|
45 | + throw new InvalidArgumentException("category $categoryId not found in register"); |
|
46 | 46 | } |
47 | 47 | } |
@@ -13,11 +13,14 @@ |
||
13 | 13 | <?php $detail = $upper_detail; ?> |
14 | 14 | </ul> |
15 | 15 | </li> |
16 | - <?php else : ?> |
|
16 | + <?php else { |
|
17 | + : ?> |
|
17 | 18 | <li class="interest-detail"> |
18 | 19 | <?php if ($detail->has_value()): ?> |
19 | 20 | <span class="interest-detail-name"><?= $detail->display_as ?>: </span> |
20 | 21 | <span class="interest-detail-value"><?= htmlspecialchars($detail->value) ?></span> |
21 | - <?php endif; ?> |
|
22 | + <?php endif; |
|
23 | +} |
|
24 | +?> |
|
22 | 25 | </li> |
23 | 26 | <?php endif; ?> |
@@ -1,7 +1,7 @@ |
||
1 | 1 | <?php |
2 | -$nav_items = [ |
|
2 | +$nav_items = [ |
|
3 | 3 | ['hansard', 'alldebatesfront', 'mps', 'peers', 'interests_home', 'wranswmsfront', 'divisions_recent_commons', 'divisions_recent_lords'], |
4 | - ['sp_home', 'sp_home', 'spdebatesfront', 'msps', 'spwransfront', 'divisions_recent_sp'], |
|
4 | + ['sp_home', 'sp_home', 'spdebatesfront', 'msps', 'spwransfront', 'divisions_recent_sp'], |
|
5 | 5 | ['wales_home', 'wales_home', 'wales_debates', 'mss', 'welshlanguage', 'divisions_recent_wales'], |
6 | 6 | ['ni_home', 'ni_home', 'nioverview', 'mlas'], |
7 | 7 | ]; |
@@ -13,12 +13,15 @@ |
||
13 | 13 | <?php $detail = $upper_detail; ?> |
14 | 14 | </ul> |
15 | 15 | </li> |
16 | - <?php else : ?> |
|
16 | + <?php else { |
|
17 | + : ?> |
|
17 | 18 | <?php if ($detail->has_value()): ?> |
18 | 19 | <li class="interest-detail"> |
19 | 20 | <span class="interest-detail-name"><?= $detail->display_as ?>: </span> |
20 | 21 | <span class="interest-detail-value"><?= htmlspecialchars($detail->value) ?></span> |
21 | 22 | </li> |
22 | - <?php endif; ?> |
|
23 | + <?php endif; |
|
24 | +} |
|
25 | +?> |
|
23 | 26 | |
24 | 27 | <?php endif; ?> |
@@ -53,7 +53,7 @@ |
||
53 | 53 | <th>MP's comment</th> |
54 | 54 | </tr> |
55 | 55 | <?php foreach ($register->persons as $person) { ?> |
56 | - <?php foreach($person->categories as $category) { ?> |
|
56 | + <?php foreach ($person->categories as $category) { ?> |
|
57 | 57 | <?php if ($category->category_id != $category_id) { ?> |
58 | 58 | <?php continue; ?> |
59 | 59 | <?php }; ?> |
@@ -28,9 +28,12 @@ |
||
28 | 28 | <?php // This is a more mininal style of entry, don't use the header structure, just print the xml content?> |
29 | 29 | <?php if ($entry->content_format == "xml") : ?> |
30 | 30 | <?= $entry->content ?> |
31 | - <?php else: ?> |
|
31 | + <?php else { |
|
32 | + : ?> |
|
32 | 33 | <p class="interest-content"><?= htmlspecialchars($entry->content) ?></p> |
33 | - <?php endif; ?> |
|
34 | + <?php endif; |
|
35 | +} |
|
36 | +?> |
|
34 | 37 | <?php endif; ?> |
35 | 38 | |
36 | 39 | </ul> |