From 18e82931dccbe0537a06f2e6570653e19db372dd Mon Sep 17 00:00:00 2001 From: Vjacheslav Trushkin Date: Sat, 11 May 2013 22:56:38 +0300 Subject: [PATCH] [ticket/develop/10772] Unit tests for forum specific style Unit tests for forum specific style for 3.1 branch PHPBB3-10772 --- tests/functional/forum_style_test.php | 53 +++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 tests/functional/forum_style_test.php diff --git a/tests/functional/forum_style_test.php b/tests/functional/forum_style_test.php new file mode 100644 index 0000000000..f9927454ad --- /dev/null +++ b/tests/functional/forum_style_test.php @@ -0,0 +1,53 @@ +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'); + } +}