aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/auth/provider_oauth_token_storage_test.php8
-rw-r--r--tests/avatar/manager_test.php5
-rw-r--r--tests/functional/extension_acp_test.php2
-rw-r--r--tests/functional/extension_global_lang_test.php7
-rw-r--r--tests/functional/feed_test.php6
-rw-r--r--tests/functional/metadata_manager_test.php7
-rw-r--r--tests/functional/plupload_test.php1
-rw-r--r--tests/functional/posting_test.php25
-rw-r--r--tests/functions/user_delete_test.php1
-rw-r--r--tests/test_framework/phpbb_functional_test_case.php1
-rw-r--r--tests/text_processing/tickets_data/PHPBB3-12221.html1
-rw-r--r--tests/text_processing/tickets_data/PHPBB3-12221.txt1
-rw-r--r--tests/text_processing/tickets_data/PHPBB3-14405.html1
-rw-r--r--tests/text_processing/tickets_data/PHPBB3-14405.txt1
14 files changed, 62 insertions, 5 deletions
diff --git a/tests/auth/provider_oauth_token_storage_test.php b/tests/auth/provider_oauth_token_storage_test.php
index 78b936ee8e..ae5de6aa7e 100644
--- a/tests/auth/provider_oauth_token_storage_test.php
+++ b/tests/auth/provider_oauth_token_storage_test.php
@@ -22,6 +22,7 @@ class phpbb_auth_provider_oauth_token_storage_test extends phpbb_database_test_c
protected $session_id;
protected $token_storage;
protected $token_storage_table;
+ protected $state_table;
protected $user;
protected function setup()
@@ -36,6 +37,7 @@ class phpbb_auth_provider_oauth_token_storage_test extends phpbb_database_test_c
$this->user = new \phpbb\user($lang, '\phpbb\datetime');
$this->service_name = 'auth.provider.oauth.service.testing';
$this->token_storage_table = 'phpbb_oauth_tokens';
+ $this->state_table = 'phpbb_oauth_states';
// Give the user a session_id that we will remember
$this->session_id = '12345';
@@ -44,7 +46,7 @@ class phpbb_auth_provider_oauth_token_storage_test extends phpbb_database_test_c
// Set the user id to anonymous
$this->user->data['user_id'] = ANONYMOUS;
- $this->token_storage = new \phpbb\auth\provider\oauth\token_storage($this->db, $this->user, $this->token_storage_table);
+ $this->token_storage = new \phpbb\auth\provider\oauth\token_storage($this->db, $this->user, $this->token_storage_table, $this->state_table);
}
public function getDataSet()
@@ -98,7 +100,7 @@ class phpbb_auth_provider_oauth_token_storage_test extends phpbb_database_test_c
$expected_token = new StdOAuth2Token('access', 'refresh', StdOAuth2Token::EOL_NEVER_EXPIRES);
// Store a token in the database
- $temp_storage = new \phpbb\auth\provider\oauth\token_storage($this->db, $this->user, $this->token_storage_table);
+ $temp_storage = new \phpbb\auth\provider\oauth\token_storage($this->db, $this->user, $this->token_storage_table, $this->state_table);
$temp_storage->storeAccessToken($this->service_name, $expected_token);
unset($temp_storage);
@@ -129,7 +131,7 @@ class phpbb_auth_provider_oauth_token_storage_test extends phpbb_database_test_c
$expected_token = new StdOAuth2Token('access', 'refresh', StdOAuth2Token::EOL_NEVER_EXPIRES);
// Store a token in the database
- $temp_storage = new \phpbb\auth\provider\oauth\token_storage($this->db, $this->user, $this->token_storage_table);
+ $temp_storage = new \phpbb\auth\provider\oauth\token_storage($this->db, $this->user, $this->token_storage_table, $this->state_table);
$temp_storage->storeAccessToken($this->service_name, $expected_token);
unset($temp_storage);
diff --git a/tests/avatar/manager_test.php b/tests/avatar/manager_test.php
index 9003f72de2..924f1319a2 100644
--- a/tests/avatar/manager_test.php
+++ b/tests/avatar/manager_test.php
@@ -67,10 +67,13 @@ class phpbb_avatar_manager_test extends \phpbb_database_test_case
->method('get_name')
->will($this->returnValue('avatar.driver.foobar'));
// barfoo driver can't be mocked with constructor arguments
- $this->avatar_barfoo = $this->getMock('\phpbb\avatar\driver\barfoo', array('get_name'));
+ $this->avatar_barfoo = $this->getMock('\phpbb\avatar\driver\barfoo', array('get_name', 'get_config_name'));
$this->avatar_barfoo->expects($this->any())
->method('get_name')
->will($this->returnValue('avatar.driver.barfoo'));
+ $this->avatar_barfoo->expects($this->any())
+ ->method('get_config_name')
+ ->will($this->returnValue('barfoo'));
$avatar_drivers = array($this->avatar_foobar, $this->avatar_barfoo);
$files_factory = new \phpbb\files\factory($phpbb_container);
diff --git a/tests/functional/extension_acp_test.php b/tests/functional/extension_acp_test.php
index 7be8957ec7..8a71a5ce04 100644
--- a/tests/functional/extension_acp_test.php
+++ b/tests/functional/extension_acp_test.php
@@ -41,6 +41,8 @@ class phpbb_functional_extension_acp_test extends phpbb_functional_test_case
{
parent::setUp();
+ $this->purge_cache();
+
$this->get_db();
// Clear the phpbb_ext table
diff --git a/tests/functional/extension_global_lang_test.php b/tests/functional/extension_global_lang_test.php
index 53bb9af5ca..f615114c08 100644
--- a/tests/functional/extension_global_lang_test.php
+++ b/tests/functional/extension_global_lang_test.php
@@ -52,6 +52,13 @@ class phpbb_functional_extension_global_lang_test extends phpbb_functional_test_
$this->purge_cache();
}
+ public function tearDown()
+ {
+ parent::tearDown();
+
+ $this->purge_cache();
+ }
+
public function test_load_extension_lang_globally()
{
$this->phpbb_extension_manager->enable('foo/bar');
diff --git a/tests/functional/feed_test.php b/tests/functional/feed_test.php
index 16afced238..dad5ca7e1a 100644
--- a/tests/functional/feed_test.php
+++ b/tests/functional/feed_test.php
@@ -22,6 +22,12 @@ class phpbb_functional_feed_test extends phpbb_functional_test_case
static public $init_values = array();
+ public function setUp()
+ {
+ parent::setUp();
+ $this->purge_cache();
+ }
+
public function __construct($name = null, array $data = array(), $dataName = '')
{
parent::__construct($name, $data, $dataName);
diff --git a/tests/functional/metadata_manager_test.php b/tests/functional/metadata_manager_test.php
index 080822d249..0d2fdf082e 100644
--- a/tests/functional/metadata_manager_test.php
+++ b/tests/functional/metadata_manager_test.php
@@ -24,6 +24,13 @@ class phpbb_functional_metadata_manager_test extends phpbb_functional_test_case
'foo/bar/',
);
+ public function tearDown()
+ {
+ $this->purge_cache();
+
+ parent::tearDown();
+ }
+
static public function setUpBeforeClass()
{
parent::setUpBeforeClass();
diff --git a/tests/functional/plupload_test.php b/tests/functional/plupload_test.php
index ee71597ffc..d358681ad1 100644
--- a/tests/functional/plupload_test.php
+++ b/tests/functional/plupload_test.php
@@ -33,6 +33,7 @@ class phpbb_functional_plupload_test extends phpbb_functional_test_case
public function setUp()
{
parent::setUp();
+ $this->purge_cache();
$this->set_extension_group_permission(1);
$this->path = __DIR__ . '/fixtures/files/';
$this->add_lang('posting');
diff --git a/tests/functional/posting_test.php b/tests/functional/posting_test.php
index 724c42b289..bf9e3eb51a 100644
--- a/tests/functional/posting_test.php
+++ b/tests/functional/posting_test.php
@@ -205,4 +205,29 @@ class phpbb_functional_posting_test extends phpbb_functional_test_case
$crawler->filter('#preview .signature')->html()
);
}
+
+ /**
+ * @ticket PHPBB3-10628
+ */
+ public function test_www_links_preview()
+ {
+ $text = 'www.example.org';
+ $url = 'http://' . $text;
+
+ $this->add_lang('posting');
+ $this->login();
+
+ $crawler = self::request('GET', 'posting.php?mode=post&f=2');
+ $form = $crawler->selectButton('Preview')->form(array(
+ 'subject' => 'Test subject',
+ 'message' => $text
+ ));
+ $crawler = self::submit($form);
+
+ // Test that the textarea remains unchanged
+ $this->assertEquals($text, $crawler->filter('#message')->text());
+
+ // Test that the preview contains the correct link
+ $this->assertEquals($url, $crawler->filter('#preview a')->attr('href'));
+ }
}
diff --git a/tests/functions/user_delete_test.php b/tests/functions/user_delete_test.php
index 21561492fd..bd6b53c59f 100644
--- a/tests/functions/user_delete_test.php
+++ b/tests/functions/user_delete_test.php
@@ -68,6 +68,7 @@ class phpbb_functions_user_delete_test extends phpbb_database_test_case
$request,
$user,
'phpbb_oauth_tokens',
+ 'phpbb_oauth_states',
'phpbb_oauth_accounts',
$oauth_provider_collection,
'phpbb_users',
diff --git a/tests/test_framework/phpbb_functional_test_case.php b/tests/test_framework/phpbb_functional_test_case.php
index 323d97ff42..b91894f9c0 100644
--- a/tests/test_framework/phpbb_functional_test_case.php
+++ b/tests/test_framework/phpbb_functional_test_case.php
@@ -89,7 +89,6 @@ class phpbb_functional_test_case extends phpbb_test_case
// that were added in other tests are gone
$this->lang = array();
$this->add_lang('common');
- $this->purge_cache();
$db = $this->get_db();
diff --git a/tests/text_processing/tickets_data/PHPBB3-12221.html b/tests/text_processing/tickets_data/PHPBB3-12221.html
new file mode 100644
index 0000000000..567f552e84
--- /dev/null
+++ b/tests/text_processing/tickets_data/PHPBB3-12221.html
@@ -0,0 +1 @@
+<a href="https://example.com/test/#?javascript:lolhax" class="postlink">https://example.com/test/#?javascript:lolhax</a> \ No newline at end of file
diff --git a/tests/text_processing/tickets_data/PHPBB3-12221.txt b/tests/text_processing/tickets_data/PHPBB3-12221.txt
new file mode 100644
index 0000000000..01a0bf8667
--- /dev/null
+++ b/tests/text_processing/tickets_data/PHPBB3-12221.txt
@@ -0,0 +1 @@
+https://example.com/test/#?javascript:lolhax \ No newline at end of file
diff --git a/tests/text_processing/tickets_data/PHPBB3-14405.html b/tests/text_processing/tickets_data/PHPBB3-14405.html
new file mode 100644
index 0000000000..5e76e032ec
--- /dev/null
+++ b/tests/text_processing/tickets_data/PHPBB3-14405.html
@@ -0,0 +1 @@
+[url=<a href="http://example.org" class="postlink">http://example.org</a>]... \ No newline at end of file
diff --git a/tests/text_processing/tickets_data/PHPBB3-14405.txt b/tests/text_processing/tickets_data/PHPBB3-14405.txt
new file mode 100644
index 0000000000..7005b36b23
--- /dev/null
+++ b/tests/text_processing/tickets_data/PHPBB3-14405.txt
@@ -0,0 +1 @@
+[url=http://example.org]... \ No newline at end of file