aboutsummaryrefslogtreecommitdiffstats
path: root/tests/functional/forum_style_test.php
blob: f9927454addd1a3d64965902b2577fa0c073adb3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
<?php
/**
*
* @package testing
* @copyright (c) 2011 phpBB Group
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
*
*/

/**
* @group functional
*/
class phpbb_functional_forum_style_test extends phpbb_functional_test_case
{
	public function test_forum_style()
	{
		// Test with default style
		$crawler = $this->request('GET', 'viewtopic.php?t=1&f=2');
		$this->assert_response_success();
		$this->assertContains('styles/prosilver/theme/print.css', $this->client->getResponse()->getContent());

		$crawler = $this->request('GET', 'viewtopic.php?t=1&f=2&view=next');
		$this->assert_response_success();
		$this->assertContains('styles/prosilver/theme/print.css', $this->client->getResponse()->getContent());

		// Insert new style and change forum style
		$db = $this->get_db();
		$db->sql_multi_insert(STYLES_TABLE, array(
			'style_id' => 2,
			'style_name' => 'test_style',
			'style_copyright' => '',
			'style_active' => 1,
			'style_path' => 'test_style',
			'bbcode_bitfield' => 'kNg=',
			'style_parent_id' => 1,
			'style_parent_tree' => 'prosilver',
		));
		$db->sql_query('UPDATE ' . FORUMS_TABLE . ' SET forum_style = 2 WHERE forum_id = 2');

		// Test with custom style
		$crawler = $this->request('GET', 'viewtopic.php?t=1&f=2');
		$this->assert_response_success();
		$this->assertContains('styles/test_style/theme/print.css', $this->client->getResponse()->getContent());

		$crawler = $this->request('GET', 'viewtopic.php?t=1&f=2&view=next');
		$this->assert_response_success();
		$this->assertContains('styles/test_style/theme/print.css', $this->client->getResponse()->getContent());

		// Undo changes
		$db->sql_query('UPDATE ' . FORUMS_TABLE . ' SET forum_style = 0 WHERE forum_id = 2');
		$db->sql_query('DELETE FROM ' . STYLES_TABLE . ' WHERE style_id = 2');
	}
}