aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xphpBB/bin/phpbbcli.php1
-rw-r--r--phpBB/config/console.yml11
-rw-r--r--phpBB/phpbb/console/command/cache/purge.php62
-rw-r--r--tests/avatar/manager_test.php20
-rw-r--r--tests/bbcode/parser_test.php2
-rw-r--r--tests/cache/null_driver_test.php6
-rw-r--r--tests/class_loader/class_loader_test.php2
-rw-r--r--tests/cron/manager_test.php2
-rw-r--r--tests/passwords/drivers_test.php2
-rw-r--r--tests/passwords/manager_test.php6
10 files changed, 94 insertions, 20 deletions
diff --git a/phpBB/bin/phpbbcli.php b/phpBB/bin/phpbbcli.php
index 02d6b88943..dd5c8fa774 100755
--- a/phpBB/bin/phpbbcli.php
+++ b/phpBB/bin/phpbbcli.php
@@ -21,6 +21,7 @@ require($phpbb_root_path . 'includes/startup.' . $phpEx);
require($phpbb_root_path . 'config.' . $phpEx);
require($phpbb_root_path . 'includes/constants.' . $phpEx);
require($phpbb_root_path . 'includes/functions.' . $phpEx);
+require($phpbb_root_path . 'includes/functions_admin.' . $phpEx);
require($phpbb_root_path . 'includes/functions_container.' . $phpEx);
require($phpbb_root_path . 'includes/utf/utf_tools.' . $phpEx);
require($phpbb_root_path . 'phpbb/class_loader.' . $phpEx);
diff --git a/phpBB/config/console.yml b/phpBB/config/console.yml
index 3d57c257dd..1340d9c0d7 100644
--- a/phpBB/config/console.yml
+++ b/phpBB/config/console.yml
@@ -1,4 +1,15 @@
services:
+ console.command.cache.purge:
+ class: phpbb\console\command\cache\purge
+ arguments:
+ - @cache.driver
+ - @dbal.conn
+ - @auth
+ - @log
+ - @user
+ tags:
+ - { name: console.command }
+
console.command.config.delete:
class: phpbb\console\command\config\delete
arguments:
diff --git a/phpBB/phpbb/console/command/cache/purge.php b/phpBB/phpbb/console/command/cache/purge.php
new file mode 100644
index 0000000000..017bdc5144
--- /dev/null
+++ b/phpBB/phpbb/console/command/cache/purge.php
@@ -0,0 +1,62 @@
+<?php
+/**
+*
+* @package phpBB3
+* @copyright (c) 2014 phpBB Group
+* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
+*
+*/
+namespace phpbb\console\command\cache;
+
+use Symfony\Component\Console\Input\InputInterface;
+use Symfony\Component\Console\Output\OutputInterface;
+
+class purge extends \phpbb\console\command\command
+{
+ /** @var \phpbb\cache\driver\driver_interface */
+ protected $cache;
+
+ /** @var \phpbb\db\driver\driver_interface */
+ protected $db;
+
+ /** @var \phpbb\auth\auth */
+ protected $auth;
+
+ /** @var \phpbb\log\log */
+ protected $log;
+
+ /** @var \phpbb\user */
+ protected $user;
+
+ function __construct(\phpbb\cache\driver\driver_interface $cache, \phpbb\db\driver\driver_interface $db, \phpbb\auth\auth $auth, \phpbb\log\log $log, \phpbb\user $user)
+ {
+ $this->cache = $cache;
+ $this->db = $db;
+ $this->auth = $auth;
+ $this->log = $log;
+ $this->user = $user;
+ $this->user->add_lang(array('acp/common'));
+ parent::__construct();
+ }
+
+ protected function configure()
+ {
+ $this
+ ->setName('cache:purge')
+ ->setDescription('Purge the cache.')
+ ;
+ }
+
+ protected function execute(InputInterface $input, OutputInterface $output)
+ {
+ $this->cache->purge();
+
+ // Clear permissions
+ $this->auth->acl_clear_prefetch();
+ phpbb_cache_moderators($this->db, $this->cache, $this->auth);
+
+ $this->log->add('admin', ANONYMOUS, '', 'LOG_PURGE_CACHE', time(), array());
+
+ $output->writeln($this->user->lang('PURGE_CACHE_SUCCESS'));
+ }
+}
diff --git a/tests/avatar/manager_test.php b/tests/avatar/manager_test.php
index 527bb223d5..69d4280b9a 100644
--- a/tests/avatar/manager_test.php
+++ b/tests/avatar/manager_test.php
@@ -9,29 +9,33 @@
require_once dirname(__FILE__) . '/driver/foobar.php';
-class phpbb_avatar_manager_test extends PHPUnit_Framework_TestCase
+class phpbb_avatar_manager_test extends \phpbb_test_case
{
+ /** @var \phpbb\avatar\manager */
+ protected $manager;
+ protected $avatar_foobar;
+ protected $avatar_barfoo;
+
public function setUp()
{
global $phpbb_root_path, $phpEx;
// Mock phpbb_container
- $this->phpbb_container = $this->getMock('Symfony\Component\DependencyInjection\ContainerInterface');
- $this->phpbb_container->expects($this->any())
+ $phpbb_container = $this->getMock('Symfony\Component\DependencyInjection\ContainerInterface');
+ $phpbb_container->expects($this->any())
->method('get')
->will($this->returnArgument(0));
// Prepare dependencies for avatar manager and driver
$config = new \phpbb\config\config(array());
- $request = $this->getMock('\phpbb\request\request');
$cache = $this->getMock('\phpbb\cache\driver\driver_interface');
$path_helper = new \phpbb\path_helper(
new \phpbb\symfony_request(
new phpbb_mock_request()
),
new \phpbb\filesystem(),
- $this->phpbb_root_path,
- $this->phpEx
+ $phpbb_root_path,
+ $phpEx
);
// $this->avatar_foobar will be needed later on
@@ -60,7 +64,7 @@ class phpbb_avatar_manager_test extends PHPUnit_Framework_TestCase
$config['allow_avatar_' . get_class($this->avatar_barfoo)] = false;
// Set up avatar manager
- $this->manager = new \phpbb\avatar\manager($config, $avatar_drivers, $this->phpbb_container);
+ $this->manager = new \phpbb\avatar\manager($config, $avatar_drivers, $phpbb_container);
}
protected function avatar_drivers()
@@ -222,8 +226,6 @@ class phpbb_avatar_manager_test extends PHPUnit_Framework_TestCase
*/
public function test_clean_row(array $input, array $output, $prefix = '')
{
- $cleaned_row = array();
-
$cleaned_row = \phpbb\avatar\manager::clean_row($input, $prefix);
foreach ($output as $key => $value)
{
diff --git a/tests/bbcode/parser_test.php b/tests/bbcode/parser_test.php
index d0dcce5bbf..4bf5037f45 100644
--- a/tests/bbcode/parser_test.php
+++ b/tests/bbcode/parser_test.php
@@ -12,7 +12,7 @@ require_once dirname(__FILE__) . '/../../phpBB/includes/functions_content.php';
require_once dirname(__FILE__) . '/../../phpBB/includes/bbcode.php';
require_once dirname(__FILE__) . '/../../phpBB/includes/message_parser.php';
-class phpbb_bbcode_parser_test extends PHPUnit_Framework_TestCase
+class phpbb_bbcode_parser_test extends \phpbb_test_case
{
public function bbcode_firstpass_data()
{
diff --git a/tests/cache/null_driver_test.php b/tests/cache/null_driver_test.php
index 58e57f2b3a..049d0412b6 100644
--- a/tests/cache/null_driver_test.php
+++ b/tests/cache/null_driver_test.php
@@ -35,14 +35,12 @@ class phpbb_cache_null_driver_test extends phpbb_database_test_case
public function test_purge()
{
- // does nothing
- $this->driver->purge();
+ $this->assertNull($this->driver->purge());
}
public function test_destroy()
{
- // does nothing
- $this->driver->destroy('foo');
+ $this->assertNull($this->driver->destroy('foo'));
}
public function test_cache_sql()
diff --git a/tests/class_loader/class_loader_test.php b/tests/class_loader/class_loader_test.php
index 6e551f658a..d3c7bb0579 100644
--- a/tests/class_loader/class_loader_test.php
+++ b/tests/class_loader/class_loader_test.php
@@ -7,7 +7,7 @@
*
*/
-class phpbb_class_loader_test extends PHPUnit_Framework_TestCase
+class phpbb_class_loader_test extends \phpbb_test_case
{
public function setUp()
{
diff --git a/tests/cron/manager_test.php b/tests/cron/manager_test.php
index 713f44c1e2..937add252f 100644
--- a/tests/cron/manager_test.php
+++ b/tests/cron/manager_test.php
@@ -14,7 +14,7 @@ require_once dirname(__FILE__) . '/tasks/simple_ready.php';
require_once dirname(__FILE__) . '/tasks/simple_not_runnable.php';
require_once dirname(__FILE__) . '/tasks/simple_should_not_run.php';
-class phpbb_cron_manager_test extends PHPUnit_Framework_TestCase
+class phpbb_cron_manager_test extends \phpbb_test_case
{
public function setUp()
{
diff --git a/tests/passwords/drivers_test.php b/tests/passwords/drivers_test.php
index 40bb110185..df1474419b 100644
--- a/tests/passwords/drivers_test.php
+++ b/tests/passwords/drivers_test.php
@@ -7,7 +7,7 @@
*
*/
-class phpbb_passwords_helper_test extends PHPUnit_Framework_TestCase
+class phpbb_passwords_helper_test extends \phpbb_test_case
{
public function setUp()
{
diff --git a/tests/passwords/manager_test.php b/tests/passwords/manager_test.php
index 008f222696..561c4d1189 100644
--- a/tests/passwords/manager_test.php
+++ b/tests/passwords/manager_test.php
@@ -7,7 +7,7 @@
*
*/
-class phpbb_passwords_manager_test extends PHPUnit_Framework_TestCase
+class phpbb_passwords_manager_test extends \phpbb_test_case
{
protected $passwords_drivers;
@@ -176,7 +176,7 @@ class phpbb_passwords_manager_test extends PHPUnit_Framework_TestCase
}
}
- public function test_combined_hash_data()
+ public function combined_hash_data()
{
if (version_compare(PHP_VERSION, '5.3.7', '<'))
{
@@ -242,7 +242,7 @@ class phpbb_passwords_manager_test extends PHPUnit_Framework_TestCase
}
/**
- * @dataProvider test_combined_hash_data
+ * @dataProvider combined_hash_data
*/
public function test_combined_hash_password($first_type, $second_type, $expected = true)
{