-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
74 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,6 +15,10 @@ private function fetch_page($vars) { | |
return $this->base_fetch_page($vars, 'alert'); | ||
} | ||
|
||
private function get_page($vars = []) { | ||
return $this->base_fetch_page_user($vars, '1.fbb689a0c092f5534b929d302db2c8a9', 'alert'); | ||
} | ||
|
||
public function testFetchPage() { | ||
$page = $this->fetch_page([]); | ||
$this->assertStringContainsString('TheyWorkForYou Email Alerts', $page); | ||
|
@@ -23,7 +27,7 @@ public function testFetchPage() { | |
public function testKeywordOnly() { | ||
$page = $this->fetch_page([ 'alertsearch' => 'elephant']); | ||
$this->assertStringContainsString('What word or phrase would you like to recieve alerts about', $page); | ||
$this->assertStringContainsString('<input type="text" id="words0" name="words[]" aria-required="true" value="fire"', $page); | ||
$this->assertStringContainsString('<input type="text" id="words0" name="words[]" aria-required="true" value="elephant"', $page); | ||
} | ||
|
||
public function testSpeakerId() { | ||
|
@@ -67,7 +71,7 @@ public function testBasicKeyWordAlertsCreation() { | |
|
||
$page = $this->fetch_page([ 'step' => 'confirm', 'email' => '[email protected]', 'words[]' => 'fish']); | ||
$this->assertStringContainsString('We’re nearly done', $page); | ||
//$this->assertStringContainsString('You will now receive email alerts on any day when [fish] is mentioned in parliament', $page); | ||
$this->assertStringContainsString('You should receive an email shortly', $page); | ||
} | ||
|
||
public function testMultipleKeyWordAlertsCreation() { | ||
|
@@ -78,10 +82,50 @@ public function testMultipleKeyWordAlertsCreation() { | |
$page = $this->fetch_page([ 'step' => 'review', 'email' => '[email protected]', 'words[]' => ['fish', 'salmon']]); | ||
$this->assertStringContainsString('Review Your Alert', $page); | ||
$this->assertStringContainsString('<input type="hidden" name="words[]" value="fish"', $page); | ||
$this->assertStringContainsString('<input type="hidden" name="words[]" value="fish"', $page); | ||
$this->assertStringContainsString('<input type="hidden" name="words[]" value="salmon"', $page); | ||
|
||
$page = $this->fetch_page([ 'step' => 'confirm', 'email' => '[email protected]', 'words[]' => ['fish', 'salmon']]); | ||
$this->assertStringContainsString('We’re nearly done', $page); | ||
$this->assertStringContainsString('You should receive an email shortly', $page); | ||
} | ||
|
||
public function testMultipleKeyWordAlertsCreationLoggedIn() { | ||
$page = $this->get_page(['step' => 'define']); | ||
$this->assertStringContainsString('What word or phrase would you like to recieve alerts about', $page); | ||
$this->assertStringContainsString('<input type="text" id="words0" name="words[]" aria-required="true" value=""', $page); | ||
|
||
$page = $this->get_page([ 'step' => 'review', 'words[]' => ['fish', 'salmon']]); | ||
$this->assertStringContainsString('Review Your Alert', $page); | ||
$this->assertStringContainsString('<input type="hidden" name="words[]" value="fish"', $page); | ||
$this->assertStringContainsString('<input type="hidden" name="words[]" value="salmon"', $page); | ||
|
||
$page = $this->get_page([ 'step' => 'confirm', 'words[]' => ['fish', 'salmon']]); | ||
$this->assertStringContainsString('You will now receive email alerts on any day when [fish salmon] is mentioned in parliament', $page); | ||
} | ||
|
||
public function testKeyWordAndSectionAlertsCreationLoggedIn() { | ||
$page = $this->get_page(['step' => 'define']); | ||
$this->assertStringContainsString('What word or phrase would you like to recieve alerts about', $page); | ||
$this->assertStringContainsString('<input type="text" id="words0" name="words[]" aria-required="true" value=""', $page); | ||
|
||
$page = $this->get_page(['step' => 'review', 'words[]' => 'fish', 'search_section' => 'debates']); | ||
$this->assertStringContainsString('Review Your Alert', $page); | ||
$this->assertStringContainsString('<input type="hidden" name="words[]" value="fish"', $page); | ||
|
||
$page = $this->get_page(['step' => 'confirm', 'words[]' => 'fish', 'search_section' => 'debates']); | ||
$this->assertStringContainsString('You will now receive email alerts on any day when [fish] is mentioned in House of Commons debates', $page); | ||
} | ||
|
||
public function testKeyWordAndSpeakerAlertsCreationLoggedIn() { | ||
$page = $this->get_page(['step' => 'define']); | ||
$this->assertStringContainsString('What word or phrase would you like to recieve alerts about', $page); | ||
$this->assertStringContainsString('<input type="text" id="words0" name="words[]" aria-required="true" value=""', $page); | ||
|
||
$page = $this->get_page(['step' => 'review', 'words[]' => 'fish', 'representative' => 'Mrs Test Current-MP']); | ||
$this->assertStringContainsString('Review Your Alert', $page); | ||
$this->assertStringContainsString('<input type="hidden" name="words[]" value="fish"', $page); | ||
$this->assertStringContainsString('<input type="hidden" name="representative" value="Mrs Test Current-MP"', $page); | ||
|
||
$page = $this->get_page([ 'step' => 'confirm', 'words[]' => 'fish', 'representative' => 'Mrs Test Current-MP']); | ||
$this->assertStringContainsString('You will now receive email alerts on any day when Mrs Test Current-MP mentions [fish] in parliament', $page); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -150,6 +150,14 @@ | |
<table_data name="titles_ignored"> | ||
</table_data> | ||
<table_data name="users"> | ||
<row> | ||
<field name="user_id">1</field> | ||
<field name="firstname">Test</field> | ||
<field name="lastname">User</field> | ||
<field name="email">[email protected]</field> | ||
<field name="password">$2y$10$UNelQZqpPpO1jT.f7DLgeOdp.WBT81c5ECvOeTMFeQTBTyq3aCh8q</field> | ||
<field name="confirmed">1</field> | ||
</row> | ||
</table_data> | ||
<table_data name="uservotes"> | ||
</table_data> | ||
|