Permalink
Browse files

tests for topics pages

  • Loading branch information...
struan committed Feb 28, 2017
1 parent ed9a116 commit 5de44697713504d5b87c9d3087ffa668cf8506de
Showing with 466 additions and 0 deletions.
  1. +64 −0 tests/TopicsTest.php
  2. +8 −0 tests/_fixtures/acceptance.xml
  3. +394 −0 tests/_fixtures/topics.xml
View
@@ -0,0 +1,64 @@
<?php
/**
* Provides test methods for topics functionality.
*/
class TopicsTest extends FetchPageTestCase
{
/**
* Loads the topics testing fixture.
*/
public function getDataSet()
{
return $this->createMySQLXMLDataSet(dirname(__FILE__).'/_fixtures/topics.xml');
}
private function fetch_topics_page($vars)
{
return $this->base_fetch_page($vars, 'topic', 'index.php', '/topic/index.php');
}
private function fetch_topic_page($vars)
{
return $this->base_fetch_page($vars, 'topic', 'topic.php', '/topic/topic.php');
}
public function testTopicsPage() {
$page = $this->fetch_topics_page(array('url' => '/topic/'));
$this->assertContains('Topics', $page);
$this->assertContains('NHS', $page);
$this->assertContains('Welfare', $page);
}
public function testTopicsOnFrontPage() {
return $this->base_fetch_page(array('url' => '/'), '/');
$this->assertContains('NHS', $page);
$this->assertNotContains('Welfare', $page);
}
public function testTopicPage() {
$page = $this->fetch_topic_page(array('topic' => 'nhs', 'url' => '/topic/nhs'));
$this->assertContains('NHS', $page);
$this->assertNotContains('Welfare', $page);
$this->assertContains('Test Hansard Section', $page);
$this->assertNotContains('foundation hospitals', $page);
$this->assertNotContains('Sign up for email alerts', $page);
}
public function testTopicPageWithSearch() {
$page = $this->fetch_topic_page(array('topic' => 'welfare', 'url' => '/topic/welfare'));
$this->assertContains('Welfare', $page);
$this->assertNotContains('NHS', $page);
$this->assertNotContains('Test Hansard Section', $page);
}
public function testTopicPageWithMP() {
$page = $this->fetch_topic_page(array('pc' => 'SW1 1AA', 'topic' => 'nhs', 'url' => '/topic/nhs'));
$this->assertContains('NHS', $page);
$this->assertNotContains('Welfare', $page);
$this->assertContains('Test Current-MP', $page);
$this->assertContains('Test Hansard Section', $page);
$this->assertContains('foundation hospitals', $page);
}
}
@@ -254,6 +254,14 @@
</table_data>
<table_data name="titles_ignored">
</table_data>
<table_data name="topics">
</table_data>
<table_data name="topic_policysets">
</table_data>
<table_data name="topic_policies">
</table_data>
<table_data name="topic_epobjects">
</table_data>
<table_data name="trackbacks">
</table_data>
<table_data name="users">
Oops, something went wrong.

0 comments on commit 5de4469

Please sign in to comment.