@@ -133,14 +133,14 @@ |
||
| 133 | 133 | ); |
| 134 | 134 | |
| 135 | 135 | foreach ($all_topics as $name => $topic) { |
| 136 | - $existing = $topics->getTopic($name); |
|
| 137 | - if ($existing) { |
|
| 138 | - print "$name already exists\n"; |
|
| 139 | - } else { |
|
| 140 | - $topic['slug'] = $name; |
|
| 141 | - $topic['description'] = $topic['blurb']; |
|
| 142 | - $topic = new MySociety\TheyWorkForYou\Topic($topic); |
|
| 143 | - $topic->save(); |
|
| 144 | - print "created $name\n"; |
|
| 145 | - } |
|
| 136 | + $existing = $topics->getTopic($name); |
|
| 137 | + if ($existing) { |
|
| 138 | + print "$name already exists\n"; |
|
| 139 | + } else { |
|
| 140 | + $topic['slug'] = $name; |
|
| 141 | + $topic['description'] = $topic['blurb']; |
|
| 142 | + $topic = new MySociety\TheyWorkForYou\Topic($topic); |
|
| 143 | + $topic->save(); |
|
| 144 | + print "created $name\n"; |
|
| 145 | + } |
|
| 146 | 146 | } |
@@ -2,7 +2,7 @@ |
||
| 2 | 2 | |
| 3 | 3 | <?php |
| 4 | 4 | |
| 5 | -include_once dirname(__FILE__) .'/../www/includes/easyparliament/init.php'; |
|
| 5 | +include_once dirname(__FILE__) . '/../www/includes/easyparliament/init.php'; |
|
| 6 | 6 | |
| 7 | 7 | $topics = new MySociety\TheyWorkForYou\Topics(); |
| 8 | 8 | |
@@ -325,10 +325,10 @@ discard block |
||
| 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 |
||
| 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", |
@@ -11,7 +11,7 @@ |
||
| 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 | /** |
@@ -18,7 +18,7 @@ |
||
| 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', |
@@ -12,7 +12,7 @@ |
||
| 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 | /** |
@@ -17,7 +17,7 @@ |
||
| 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 | |
@@ -11,7 +11,7 @@ discard block |
||
| 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 |
||
| 56 | 56 | public function testHTMLCleaningOfAngleBrackets() { |
| 57 | 57 | $text = 'Is 2 < 3?'; |
| 58 | 58 | |
| 59 | - $this->assertEquals('Is 2 < 3?', filter_user_input( $text, 'comment' ) ); |
|
| 59 | + $this->assertEquals('Is 2 < 3?', filter_user_input($text, 'comment')); |
|
| 60 | 60 | } |
| 61 | 61 | |
| 62 | 62 | public function testHTMLCleaningWithNonASCIIChars() |
@@ -100,7 +100,7 @@ |
||
| 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]"'); |
@@ -11,7 +11,7 @@ discard block |
||
| 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 | /** |
@@ -43,8 +43,8 @@ discard block |
||
| 43 | 43 | $id = $u->user_id(); |
| 44 | 44 | $u->init($id); |
| 45 | 45 | |
| 46 | - $this->assertEquals( 'Test', $u->firstname() ); |
|
| 47 | - $this->assertEquals( 'EH1 99SP', $u->postcode() ); |
|
| 46 | + $this->assertEquals('Test', $u->firstname()); |
|
| 47 | + $this->assertEquals('EH1 99SP', $u->postcode()); |
|
| 48 | 48 | } |
| 49 | 49 | |
| 50 | 50 | public function testEditUser() { |
@@ -52,9 +52,9 @@ discard block |
||
| 52 | 52 | $u = new THEUSER(); |
| 53 | 53 | $u->loggedin = 1; |
| 54 | 54 | |
| 55 | - $this->assertEquals( 'Test', $u->firstname() ); |
|
| 55 | + $this->assertEquals('Test', $u->firstname()); |
|
| 56 | 56 | |
| 57 | - $d = $u->update_self( array( |
|
| 57 | + $d = $u->update_self(array( |
|
| 58 | 58 | 'firstname' => 'Experiment', |
| 59 | 59 | 'lastname' => 'User', |
| 60 | 60 | 'postcode' => 'EH1 99SP', |
@@ -62,9 +62,9 @@ discard block |
||
| 62 | 62 | 'url' => '', |
| 63 | 63 | 'optin' => '', |
| 64 | 64 | 'user_id' => 1 |
| 65 | - ) ); |
|
| 65 | + )); |
|
| 66 | 66 | |
| 67 | - $this->assertEquals( 'Experiment', $u->firstname() ); |
|
| 67 | + $this->assertEquals('Experiment', $u->firstname()); |
|
| 68 | 68 | } |
| 69 | 69 | |
| 70 | 70 | public function testEditUserEmail() { |
@@ -72,9 +72,9 @@ discard block |
||
| 72 | 72 | $u = new THEUSER(); |
| 73 | 73 | $u->loggedin = 1; |
| 74 | 74 | |
| 75 | - $this->assertEquals( '[email protected]', $u->email() ); |
|
| 75 | + $this->assertEquals('[email protected]', $u->email()); |
|
| 76 | 76 | |
| 77 | - $d = $u->update_self( array( |
|
| 77 | + $d = $u->update_self(array( |
|
| 78 | 78 | 'firstname' => 'Experiment', |
| 79 | 79 | 'lastname' => 'User', |
| 80 | 80 | 'email' => '[email protected]', |
@@ -83,10 +83,10 @@ discard block |
||
| 83 | 83 | 'url' => '', |
| 84 | 84 | 'optin' => '', |
| 85 | 85 | 'user_id' => 1 |
| 86 | - ), false ); |
|
| 86 | + ), false); |
|
| 87 | 87 | |
| 88 | 88 | // email should not change as user needs to confirm |
| 89 | - $this->assertEquals( '[email protected]', $u->email() ); |
|
| 89 | + $this->assertEquals('[email protected]', $u->email()); |
|
| 90 | 90 | |
| 91 | 91 | $tokenCount = $this->getConnection()->getRowCount('tokens', 'data = "1::[email protected]"'); |
| 92 | 92 | $this->assertEquals(1, $tokenCount, 'correct number of email confirm tokens'); |
@@ -96,7 +96,7 @@ discard block |
||
| 96 | 96 | 'tokens', 'SELECT type, data FROM tokens WHERE data = "1::[email protected]"' |
| 97 | 97 | ); |
| 98 | 98 | |
| 99 | - $expectedTable = $this->createXmlDataSet(dirname(__FILE__).'/_fixtures/expectedTokens.xml') |
|
| 99 | + $expectedTable = $this->createXmlDataSet(dirname(__FILE__) . '/_fixtures/expectedTokens.xml') |
|
| 100 | 100 | ->getTable("tokens"); |
| 101 | 101 | $this->assertTablesEqual($expectedTable, $queryTable); |
| 102 | 102 | |
@@ -110,9 +110,9 @@ discard block |
||
| 110 | 110 | $tokenRow = $queryTable->getRow(0); |
| 111 | 111 | $token = '2-' . $tokenRow['token']; |
| 112 | 112 | |
| 113 | - $u->confirm_email($token,false); |
|
| 113 | + $u->confirm_email($token, false); |
|
| 114 | 114 | |
| 115 | - $this->assertEquals( '[email protected]', $u->email(), 'confirming with token updates email address' ); |
|
| 115 | + $this->assertEquals('[email protected]', $u->email(), 'confirming with token updates email address'); |
|
| 116 | 116 | $tokenCount = $this->getConnection()->getRowCount('tokens', 'data = "1::[email protected]"'); |
| 117 | 117 | $this->assertEquals(0, $tokenCount, 'token deleted once email confirmed'); |
| 118 | 118 | |
@@ -128,15 +128,15 @@ discard block |
||
| 128 | 128 | $u = new THEUSER(); |
| 129 | 129 | $u->loggedin = 1; |
| 130 | 130 | |
| 131 | - $this->assertEquals( '[email protected]', $u->email(), 'confirming inital email address' ); |
|
| 131 | + $this->assertEquals('[email protected]', $u->email(), 'confirming inital email address'); |
|
| 132 | 132 | |
| 133 | 133 | $tokenCount = $this->getConnection()->getRowCount('tokens', 'data = "1::[email protected]"'); |
| 134 | 134 | $this->assertEquals(1, $tokenCount, 'correct number of email confirm tokens'); |
| 135 | 135 | |
| 136 | 136 | $token = '2-lkdsjafhsadjhf'; |
| 137 | 137 | |
| 138 | - $u->confirm_email($token,false); |
|
| 139 | - $this->assertEquals( '[email protected]', $u->email(), 'expired token does not update email address' ); |
|
| 138 | + $u->confirm_email($token, false); |
|
| 139 | + $this->assertEquals('[email protected]', $u->email(), 'expired token does not update email address'); |
|
| 140 | 140 | |
| 141 | 141 | $tokenCount = $this->getConnection()->getRowCount('tokens', 'data = "1::[email protected]"'); |
| 142 | 142 | $this->assertEquals(1, $tokenCount, 'correct number of email confirm tokens'); |
@@ -17,8 +17,8 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 | } |
@@ -11,7 +11,7 @@ |
||
| 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 | /** |
@@ -6,8 +6,8 @@ discard block |
||
| 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 |
||
| 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( |
@@ -18,13 +18,13 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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') { |
@@ -20,13 +20,13 @@ discard block |
||
| 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"> <\/td><td[^>]*><a href="\/' . $type . '\/\?d=2014-01-01">1<\/a><\/td><td[^>]*><span>2<\/span><\/td>/', $page); |
@@ -35,7 +35,7 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 | } |
@@ -7,8 +7,8 @@ discard block |
||
| 7 | 7 | |
| 8 | 8 | class SearchTest extends FetchPageTestCase |
| 9 | 9 | { |
| 10 | - public function setUp() |
|
| 11 | - { |
|
| 10 | + public function setUp() |
|
| 11 | + { |
|
| 12 | 12 | parent::setUp(); |
| 13 | 13 | include_once('www/includes/easyparliament/searchengine.php'); |
| 14 | 14 | } |
@@ -87,7 +87,7 @@ discard block |
||
| 87 | 87 | * |
| 88 | 88 | * @group xapian |
| 89 | 89 | */ |
| 90 | - public function testSearchNormal() |
|
| 90 | + public function testSearchNormal() |
|
| 91 | 91 | { |
| 92 | 92 | $SEARCHENGINE = new SEARCHENGINE('test'); |
| 93 | 93 | |
@@ -102,7 +102,7 @@ discard block |
||
| 102 | 102 | * |
| 103 | 103 | * @group xapian |
| 104 | 104 | */ |
| 105 | - public function testSearchLink() |
|
| 105 | + public function testSearchLink() |
|
| 106 | 106 | { |
| 107 | 107 | $SEARCHENGINE = new SEARCHENGINE('test'); |
| 108 | 108 | |
@@ -26,11 +26,11 @@ discard block |
||
| 26 | 26 | public function testConstituencySearch() |
| 27 | 27 | { |
| 28 | 28 | $this->assertEquals( |
| 29 | - array( array( 'Alyn and Deeside' ), false ), |
|
| 29 | + array(array('Alyn and Deeside'), false), |
|
| 30 | 30 | \MySociety\TheyWorkForYou\Utility\Search::searchConstituenciesByQuery('Alyn') |
| 31 | 31 | ); |
| 32 | 32 | $this->assertEquals( |
| 33 | - array( array( 'Alyn and Deeside' ), false ), |
|
| 33 | + array(array('Alyn and Deeside'), false), |
|
| 34 | 34 | \MySociety\TheyWorkForYou\Utility\Search::searchConstituenciesByQuery('Alyn and Deeside') |
| 35 | 35 | ); |
| 36 | 36 | } |
@@ -119,7 +119,7 @@ discard block |
||
| 119 | 119 | */ |
| 120 | 120 | public function testSearchPage() |
| 121 | 121 | { |
| 122 | - $page = $this->fetch_page( array( ) ); |
|
| 122 | + $page = $this->fetch_page(array( )); |
|
| 123 | 123 | $this->assertContains('Search', $page); |
| 124 | 124 | } |
| 125 | 125 | |
@@ -130,7 +130,7 @@ discard block |
||
| 130 | 130 | */ |
| 131 | 131 | public function testSearchPageMP() |
| 132 | 132 | { |
| 133 | - $page = $this->fetch_page( array( 'q' => 'Mary Smith' ) ); |
|
| 133 | + $page = $this->fetch_page(array('q' => 'Mary Smith')); |
|
| 134 | 134 | $this->assertContains('Mary Smith', $page); |
| 135 | 135 | $this->assertContains('MP, Amber Valley', $page); |
| 136 | 136 | } |
@@ -142,7 +142,7 @@ discard block |
||
| 142 | 142 | */ |
| 143 | 143 | public function testSearchPageMultipleMP() |
| 144 | 144 | { |
| 145 | - $page = $this->fetch_page( array( 'q' => 'Jones' ) ); |
|
| 145 | + $page = $this->fetch_page(array('q' => 'Jones')); |
|
| 146 | 146 | $this->assertContains('People matching <em class="current-search-term">Jones</em>', $page); |
| 147 | 147 | $this->assertContains('Andrew Jones', $page); |
| 148 | 148 | $this->assertContains('Simon Jones', $page); |
@@ -154,7 +154,7 @@ discard block |
||
| 154 | 154 | * @group xapian |
| 155 | 155 | */ |
| 156 | 156 | public function testSearchPageCons() { |
| 157 | - $page = $this->fetch_page( array( 'q' => 'Amber' ) ); |
|
| 157 | + $page = $this->fetch_page(array('q' => 'Amber')); |
|
| 158 | 158 | $this->assertContains('MP for <em class="current-search-term">Amber</em>', $page); |
| 159 | 159 | $this->assertContains('Mary Smith', $page); |
| 160 | 160 | } |
@@ -166,7 +166,7 @@ discard block |
||
| 166 | 166 | * @group xapian |
| 167 | 167 | */ |
| 168 | 168 | public function testSearchPageConsWithNoMp() { |
| 169 | - $page = $this->fetch_page( array( 'q' => 'Alyn' ) ); |
|
| 169 | + $page = $this->fetch_page(array('q' => 'Alyn')); |
|
| 170 | 170 | $this->assertNotContains('MP for <em class="current-search-term">Alyn</em>', $page); |
| 171 | 171 | $this->assertNotContains('MPs in constituencies matching', $page); |
| 172 | 172 | } |
@@ -178,7 +178,7 @@ discard block |
||
| 178 | 178 | * @group xapian |
| 179 | 179 | */ |
| 180 | 180 | public function testSearchPageMultipleCons() { |
| 181 | - $page = $this->fetch_page( array( 'q' => 'Liverpool' ) ); |
|
| 181 | + $page = $this->fetch_page(array('q' => 'Liverpool')); |
|
| 182 | 182 | $this->assertContains('MPs in constituencies matching <em class="current-search-term">Liverpool</em>', $page); |
| 183 | 183 | $this->assertContains('Susan Brown', $page); |
| 184 | 184 | $this->assertContains('MP, Liverpool, Riverside', $page); |
@@ -192,7 +192,7 @@ discard block |
||
| 192 | 192 | * @group xapian |
| 193 | 193 | */ |
| 194 | 194 | public function testSearchPageGlossary() { |
| 195 | - $page = $this->fetch_page( array( 'q' => 'other place' ) ); |
|
| 195 | + $page = $this->fetch_page(array('q' => 'other place')); |
|
| 196 | 196 | $this->assertContains('Glossary items matching', $page); |
| 197 | 197 | $this->assertContains('<a href="/glossary/?gl=1">“other place', $page); |
| 198 | 198 | } |
@@ -203,7 +203,7 @@ discard block |
||
| 203 | 203 | * @group xapian |
| 204 | 204 | */ |
| 205 | 205 | public function testSearchPageSpellCorrect() { |
| 206 | - $page = $this->fetch_page( array( 'q' => 'plice' ) ); |
|
| 206 | + $page = $this->fetch_page(array('q' => 'plice')); |
|
| 207 | 207 | $this->assertContains('Did you mean <a href="/search/?q=place">place', $page); |
| 208 | 208 | } |
| 209 | 209 | |
@@ -213,7 +213,7 @@ discard block |
||
| 213 | 213 | * @group xapian |
| 214 | 214 | */ |
| 215 | 215 | public function testSearchBySpeakerNoResults() { |
| 216 | - $page = $this->fetch_page( array( 'q' => 'splice', 'o' => 'p' ) ); |
|
| 216 | + $page = $this->fetch_page(array('q' => 'splice', 'o' => 'p')); |
|
| 217 | 217 | $this->assertContains('Who says splice the most', $page); |
| 218 | 218 | $this->assertContains('No results', $page); |
| 219 | 219 | } |
@@ -240,7 +240,7 @@ discard block |
||
| 240 | 240 | * @group xapian |
| 241 | 241 | */ |
| 242 | 242 | public function testSearchPageRSS() { |
| 243 | - $page = $this->fetch_page( array( 'q' => 'test' ) ); |
|
| 243 | + $page = $this->fetch_page(array('q' => 'test')); |
|
| 244 | 244 | $this->assertContains('<a href="/search/rss/?s=test">get an RSS feed', $page); |
| 245 | 245 | } |
| 246 | 246 | |