diff options
-rw-r--r-- | phpBB/posting.php | 2 | ||||
-rw-r--r-- | tests/files/types_remote_test.php | 12 | ||||
-rw-r--r-- | tests/test_framework/phpbb_database_test_connection_manager.php | 15 |
3 files changed, 18 insertions, 11 deletions
diff --git a/phpBB/posting.php b/phpBB/posting.php index 3174626f6b..6cfb877f75 100644 --- a/phpBB/posting.php +++ b/phpBB/posting.php @@ -482,7 +482,7 @@ if ($mode == 'delete' || $mode == 'soft_delete') } $delete_reason = $request->variable('delete_reason', '', true); - phpbb_handle_post_delete($forum_id, $topic_id, $post_id, $post_data, ($mode == 'soft_delete'), $delete_reason); + phpbb_handle_post_delete($forum_id, $topic_id, $post_id, $post_data, ($mode == 'soft_delete' && !$request->is_set_post('delete_permanent')), $delete_reason); return; } diff --git a/tests/files/types_remote_test.php b/tests/files/types_remote_test.php index a85844ee78..caed5c9e05 100644 --- a/tests/files/types_remote_test.php +++ b/tests/files/types_remote_test.php @@ -85,8 +85,8 @@ class phpbb_files_types_remote_test extends phpbb_test_case array('500k', 'http://example.com/foo/bar.png'), array('500M', 'http://example.com/foo/bar.png'), array('500m', 'http://example.com/foo/bar.png'), - array('500k', 'http://google.com/.png', 'DISALLOWED_CONTENT'), - array('1', 'http://google.com/.png', 'WRONG_FILESIZE'), + array('500k', 'http://google.com/?.png', array('DISALLOWED_EXTENSION', 'DISALLOWED_CONTENT')), + array('1', 'http://google.com/?.png', array('WRONG_FILESIZE')), array('500g', 'http://example.com/foo/bar.png'), array('foobar', 'http://example.com/foo/bar.png'), array('-5k', 'http://example.com/foo/bar.png'), @@ -96,7 +96,7 @@ class phpbb_files_types_remote_test extends phpbb_test_case /** * @dataProvider data_get_max_file_size */ - public function test_get_max_file_size($max_file_size, $link, $expected = 'URL_NOT_FOUND') + public function test_get_max_file_size($max_file_size, $link, $expected = array('URL_NOT_FOUND')) { $php_ini = $this->getMock('\bantu\IniGetWrapper\IniGetWrapper', array('getString')); $php_ini->expects($this->any()) @@ -109,7 +109,7 @@ class phpbb_files_types_remote_test extends phpbb_test_case $file = $type_remote->upload($link); - $this->assertSame(array($expected), $file->error); + $this->assertSame($expected, $file->error); } public function test_upload_timeout() @@ -120,7 +120,7 @@ class phpbb_files_types_remote_test extends phpbb_test_case $type_remote->set_upload($upload); $upload->upload_timeout = -5; - $file = $type_remote->upload('http://google.com/.png'); + $file = $type_remote->upload('http://google.com/?.png'); $this->assertSame(array('REMOTE_UPLOAD_TIMEOUT'), $file->error); } @@ -133,7 +133,7 @@ class phpbb_files_types_remote_test extends phpbb_test_case $type_remote->set_upload($upload); $type_remote::$tempnam_path = $this->phpbb_root_path . 'cache/wrong/path'; - $file = $type_remote->upload('http://google.com/.png'); + $file = $type_remote->upload('http://google.com/?.png'); $this->assertSame(array('NOT_UPLOADED'), $file->error); $type_remote::$tempnam_path = ''; diff --git a/tests/test_framework/phpbb_database_test_connection_manager.php b/tests/test_framework/phpbb_database_test_connection_manager.php index fa50d89a70..27ac64e21d 100644 --- a/tests/test_framework/phpbb_database_test_connection_manager.php +++ b/tests/test_framework/phpbb_database_test_connection_manager.php @@ -84,11 +84,18 @@ class phpbb_database_test_connection_manager break; default: - $dsn .= 'host=' . $this->config['dbhost']; - - if ($this->config['dbport']) + if (!empty($this->config['dbport']) && !is_numeric($this->config['dbport']) && $this->dbms['PDO'] != 'pgsql') + { + $dsn .= 'unix_socket=' . $this->config['dbport']; + } + else { - $dsn .= ';port=' . $this->config['dbport']; + $dsn .= 'host=' . $this->config['dbhost']; + + if ($this->config['dbport']) + { + $dsn .= ';port=' . $this->config['dbport']; + } } if ($use_db) |