Skip to content

Commit

Permalink
Add agreements display tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ajparsons committed Feb 8, 2024
1 parent 072c4bf commit 47239a5
Show file tree
Hide file tree
Showing 2 changed files with 177 additions and 0 deletions.
16 changes: 16 additions & 0 deletions tests/DivisionsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,22 @@ public function testSinglePolicy() {

}

public function testMPPageContainsAgreement()
{
// Checks this MP contains a reference to the agreement
$page = $this->fetch_page( array( 'pagetype' => 'divisions', 'pid' => 2, 'policy' => 363, 'url' => '/mp/2/test_current-mp/test_westminster_constituency/divisions' ) );
$this->assertStringContainsString('Example Agreement', $page);
}

public function testMPPageDoesNotContainsAgreement()
{
// Checks this MP does not contain agreement - should be out of time scope
$page = $this->fetch_page( array( 'pagetype' => 'divisions', 'pid' => 6, 'policy' => 363, 'url' => '/mp/6/test_current-mp/test_westminster_constituency/divisions' ) );
$this->assertStringNotContainsString('Example Agreement', $page);
$this->assertStringNotContainsString('This person has not voted on this policy', $page);

}

public function testVoteDirection() {
$page = $this->fetch_division_page();
$this->assertStringContainsString('Test Current-MP voted Agreed', $page);
Expand Down
161 changes: 161 additions & 0 deletions tests/_fixtures/divisions.xml
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,18 @@
<field name="person_id">5</field>
<field name="lastupdate">2013-08-07 11:15:47</field>
</row>
<row>
<field name="member_id">5</field>
<field name="house">1</field>
<field name="constituency">Test Westminster Constituency</field>
<field name="party">XB</field>
<field name="entered_house">2000-01-01</field>
<field name="left_house">2015-01-01</field>
<field name="entered_reason">appointed</field>
<field name="left_reason">retired</field>
<field name="person_id">6</field>
<field name="lastupdate">2013-08-07 15:06:22</field>
</row>
</table_data>
<table_data name="person_names">
<row>
Expand Down Expand Up @@ -144,6 +156,14 @@
<field name="person_id">5</field>
<field name="title">Ms</field>
</row>
<row>
<field name="given_name">Test</field>
<field name="family_name">Current-MP</field>
<field name="start_date">2000-01-01</field>
<field name="end_date">2015-01-01</field>
<field name="person_id">6</field>
<field name="title">Mrs</field>
</row>
</table_data>
<table_data name="persondivisionvotes">
<row>
Expand Down Expand Up @@ -255,6 +275,117 @@
<field name="person_id">2</field>
<field name="division_id">pw-3012-01-01-1-commons</field>
<field name="vote">aye</field>
</row>

<row>
<field name="person_id">6</field>
<field name="division_id">pw-2013-01-01-1-commons</field>
<field name="vote">Yes</field>
</row>
<row>
<field name="person_id">6</field>
<field name="division_id">pw-2013-01-01-2-commons</field>
<field name="vote">No</field>
</row>
<row>
<field name="person_id">6</field>
<field name="division_id">pw-2013-01-01-3-commons</field>
<field name="vote">absent</field>
</row>
<row>
<field name="person_id">6</field>
<field name="division_id">pw-2013-01-01-4-commons</field>
<field name="vote">both</field>
</row>
<row>
<field name="person_id">6</field>
<field name="division_id">pw-2013-01-01-5-commons</field>
<field name="vote">yes</field>
</row>
<row>
<field name="person_id">6</field>
<field name="division_id">pw-2013-01-01-6-commons</field>
<field name="vote">no</field>
</row>
<row>
<field name="person_id">6</field>
<field name="division_id">pw-2013-01-01-7-commons</field>
<field name="vote">tellno</field>
</row>
<row>
<field name="person_id">6</field>
<field name="division_id">pw-2013-01-01-8-commons</field>
<field name="vote">tellaye</field>
</row>
<row>
<field name="person_id">6</field>
<field name="division_id">pw-2012-01-01-1-commons</field>
<field name="vote">Yes</field>
</row>
<row>
<field name="person_id">6</field>
<field name="division_id">pw-2012-01-01-2-commons</field>
<field name="vote">Yes</field>
</row>
<row>
<field name="person_id">6</field>
<field name="division_id">pw-2012-01-01-3-commons</field>
<field name="vote">Yes</field>
</row>
<row>
<field name="person_id">6</field>
<field name="division_id">pw-2012-01-01-4-commons</field>
<field name="vote">Yes</field>
</row>
<row>
<field name="person_id">6</field>
<field name="division_id">pw-2012-01-01-5-commons</field>
<field name="vote">Yes</field>
</row>
<row>
<field name="person_id">6</field>
<field name="division_id">pw-2012-01-01-6-commons</field>
<field name="vote">Yes</field>
</row>
<row>
<field name="person_id">6</field>
<field name="division_id">pw-2012-01-01-7-commons</field>
<field name="vote">Yes</field>
</row>
<row>
<field name="person_id">6</field>
<field name="division_id">pw-2012-01-01-8-commons</field>
<field name="vote">Yes</field>
</row>
<row>
<field name="person_id">6</field>
<field name="division_id">pw-2012-01-01-9-commons</field>
<field name="vote">Yes</field>
</row>
<row>
<field name="person_id">6</field>
<field name="division_id">pw-2012-01-01-10-commons</field>
<field name="vote">Yes</field>
</row>
<row>
<field name="person_id">6</field>
<field name="division_id">pw-2012-01-01-11-commons</field>
<field name="vote">Yes</field>
</row>
<row>
<field name="person_id">6</field>
<field name="division_id">pw-2012-01-01-12-commons</field>
<field name="vote">Yes</field>
</row>
<row>
<field name="person_id">6</field>
<field name="division_id">pw-2012-01-01-13-commons</field>
<field name="vote">Yes</field>
</row>
<row>
<field name="person_id">6</field>
<field name="division_id">pw-3012-01-01-1-commons</field>
<field name="vote">aye</field>
</row>
</table_data>
<table_data name="memberinfo">
Expand Down Expand Up @@ -288,6 +419,36 @@
<field name="data_key">public_whip_dreammp810_has_strong_vote</field>
<field name="data_value">0</field>
</row>
<row>
<field name="member_id">5</field>
<field name="data_key">public_whip_dreammp363_distance</field>
<field name="data_value">0.87</field>
</row>
<row>
<field name="member_id">5</field>
<field name="data_key">public_whip_dreammp363_both_voted</field>
<field name="data_value">8</field>
</row>
<row>
<field name="member_id">5</field>
<field name="data_key">public_whip_dreammp363_has_strong_vote</field>
<field name="data_value">1</field>
</row>
<row>
<field name="member_id">5</field>
<field name="data_key">public_whip_dreammp810_distance</field>
<field name="data_value">0.87</field>
</row>
<row>
<field name="member_id">5</field>
<field name="data_key">public_whip_dreammp810_both_voted</field>
<field name="data_value">1</field>
</row>
<row>
<field name="member_id">5</field>
<field name="data_key">public_whip_dreammp810_has_strong_vote</field>
<field name="data_value">0</field>
</row>
</table_data>
<table_data name="mentions">
</table_data>
Expand Down

0 comments on commit 47239a5

Please sign in to comment.