From 47239a5208f6739dee5277c2634ee97d54c73a74 Mon Sep 17 00:00:00 2001 From: Alex Parsons Date: Thu, 8 Feb 2024 15:36:27 +0000 Subject: [PATCH] Add agreements display tests --- tests/DivisionsTest.php | 16 ++++ tests/_fixtures/divisions.xml | 161 ++++++++++++++++++++++++++++++++++ 2 files changed, 177 insertions(+) diff --git a/tests/DivisionsTest.php b/tests/DivisionsTest.php index 73d7cd1cf2..2545c34143 100644 --- a/tests/DivisionsTest.php +++ b/tests/DivisionsTest.php @@ -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); diff --git a/tests/_fixtures/divisions.xml b/tests/_fixtures/divisions.xml index 5f09034d48..aa139bd199 100644 --- a/tests/_fixtures/divisions.xml +++ b/tests/_fixtures/divisions.xml @@ -110,6 +110,18 @@ 5 2013-08-07 11:15:47 + + 5 + 1 + Test Westminster Constituency + XB + 2000-01-01 + 2015-01-01 + appointed + retired + 6 + 2013-08-07 15:06:22 + @@ -144,6 +156,14 @@ 5 Ms + + Test + Current-MP + 2000-01-01 + 2015-01-01 + 6 + Mrs + @@ -255,6 +275,117 @@ 2 pw-3012-01-01-1-commons aye + + + + 6 + pw-2013-01-01-1-commons + Yes + + + 6 + pw-2013-01-01-2-commons + No + + + 6 + pw-2013-01-01-3-commons + absent + + + 6 + pw-2013-01-01-4-commons + both + + + 6 + pw-2013-01-01-5-commons + yes + + + 6 + pw-2013-01-01-6-commons + no + + + 6 + pw-2013-01-01-7-commons + tellno + + + 6 + pw-2013-01-01-8-commons + tellaye + + + 6 + pw-2012-01-01-1-commons + Yes + + + 6 + pw-2012-01-01-2-commons + Yes + + + 6 + pw-2012-01-01-3-commons + Yes + + + 6 + pw-2012-01-01-4-commons + Yes + + + 6 + pw-2012-01-01-5-commons + Yes + + + 6 + pw-2012-01-01-6-commons + Yes + + + 6 + pw-2012-01-01-7-commons + Yes + + + 6 + pw-2012-01-01-8-commons + Yes + + + 6 + pw-2012-01-01-9-commons + Yes + + + 6 + pw-2012-01-01-10-commons + Yes + + + 6 + pw-2012-01-01-11-commons + Yes + + + 6 + pw-2012-01-01-12-commons + Yes + + + 6 + pw-2012-01-01-13-commons + Yes + + + 6 + pw-3012-01-01-1-commons + aye @@ -288,6 +419,36 @@ public_whip_dreammp810_has_strong_vote 0 + + 5 + public_whip_dreammp363_distance + 0.87 + + + 5 + public_whip_dreammp363_both_voted + 8 + + + 5 + public_whip_dreammp363_has_strong_vote + 1 + + + 5 + public_whip_dreammp810_distance + 0.87 + + + 5 + public_whip_dreammp810_both_voted + 1 + + + 5 + public_whip_dreammp810_has_strong_vote + 0 +