GlobalControllerTest::testIndexMain()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 26

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 26
rs 9.504
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
/**
3
 *
4
 * @copyright (c) 2013 phpBB Group
5
 * @license http://opensource.org/licenses/gpl-3.0.php GNU General Public License v3
6
 * @author MichaelC
7
 *
8
 */
9
10
namespace AppBundle\Tests\Controller;
11
12
use AppBundle\Tests\Controller;
13
14
class GlobalControllerTest extends BootstrapTestSuite
15
{
16
	public function testIndexMain()
17
	{
18
		$client = static::createClient();
19
		$this->setClient($client);
20
21
		$symfony_tables = array();
22
		$phpbb_tables = array('c_topics', 'c_posts');
23
		$this->setupDatabase($symfony_tables, $phpbb_tables);
24
25
		$client->enableProfiler();
26
		$crawler = $client->request('GET', '/');
27
		$response = $client->getResponse();
28
		$this->setupBootstrapping($client, $crawler, $response);
29
30
		// Title Check
31
		$expectedTitle = array('phpBB', 'Free and Open Source Forum Software');
32
33
		$this->assertTrue(strpos(($crawler->filter('title')->first()->text()), $expectedTitle[0]) !== false, 'Title contains phpBB');
34
		$this->assertTrue(strpos(($crawler->filter('title')->first()->text()), $expectedTitle[1]) !== false, 'Title contains Free and Open Source Forum Software');
35
36
		// Content Check
37
		$this->assertTrue($crawler->filter('html:contains("THE #1 FREE, OPEN SOURCE BULLETIN BOARD SOFTWARE")')->count() > 0, 'Homepage Content Check');
38
39
		// Standard All Page Checks
40
		$this->globalTests();
41
	}
42
43
	/**
44
	 * @depends testIndexMain
45
	 */
46
	public function testIndexAnnouncements()
47
	{
48
		$client = static::createClient();
49
		$this->setClient($client);
50
51
		$symfony_tables = array();
52
		$phpbb_tables = array('community_topics', 'community_posts');
53
		$this->setupDatabase($symfony_tables, $phpbb_tables);
54
55
		$client->enableProfiler();
56
		$crawler = $client->request('GET', '/');
57
		$response = $client->getResponse();
58
		$this->setupBootstrapping($client, $crawler, $response);
59
60
		/*$this->assertTrue($crawler->filter('html:contains("Lorem ipsum dolor sit amet")')->count() > 0, 'Announcement Content Check');
61
		$this->assertTrue($crawler->filter('html:contains("another")')->count() > 0, 'Announcement Title Check 1');
62
		$this->assertTrue($crawler->filter('html:contains("third")')->count() > 0, 'Announcement Title Check 2');
63
		$this->assertTrue($crawler->filter('html:contains("show")')->count() > 0, 'Announcement Title Check 3');
64
		$this->assertFalse($crawler->filter('html:contains("this should not show if it does die")')->count() > 0, 'Announcement Only Three Check');*/
65
	}
66
67
	public function testDemoMain()
68
	{
69
		$objs = $this->setupTest('/demo/');
70
		$crawler = $objs['crawler'];
71
72
		// Title Check
73
		$this->assertTrue(strpos(($crawler->filter('title')->first()->text()), 'Demo') !== false, 'Title contains Demo');
74
75
		// Content Check
76
		$this->assertTrue($crawler->filter('a:contains("Launch")')->count() > 0, 'Demo Link Check');
77
78
		// Standard All Page Checks
79
		$this->globalTests();
80
	}
81
82
	public function testCustomiseMain()
83
	{
84
		$objs = $this->setupTest('/customise/');
85
		$crawler = $objs['crawler'];
86
87
		// Title Check
88
		$this->assertTrue(strpos(($crawler->filter('title')->first()->text()), 'Customise phpBB') !== false, 'Title contains Customise phpBB');
89
90
		// Content Check
91
		$this->assertTrue($crawler->filter('html:contains("Styles")')->count() > 0, 'Customise Page Content Check');
92
93
		// Standard All Page Checks
94
		$this->globalTests();
95
	}
96
97
	public function testIdeasMain()
98
	{
99
		$this->setupTest('/ideas/');
100
101
		// Standard All Page Checks
102
		$this->globalTests();
103
	}
104
}
105