1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-08-13 04:04:12 +02:00

[ticket/14561] Refactor tests

PHPBB3-14561
This commit is contained in:
Matt Friedman
2016-03-26 12:59:23 -07:00
parent 16f9b4630c
commit 6291bfaca9
6 changed files with 208 additions and 299 deletions

View File

@@ -15,58 +15,39 @@ use Symfony\Component\Console\Application;
use Symfony\Component\Console\Tester\CommandTester;
use phpbb\console\command\user\activate;
class phpbb_console_command_user_activate_test extends phpbb_database_test_case
{
protected $db;
protected $config;
protected $user;
protected $language;
protected $log;
protected $notifications;
protected $command_name;
protected $phpbb_root_path;
protected $php_ext;
require_once dirname(__FILE__) . '/base.php';
public function getDataSet()
{
return $this->createXMLDataSet(dirname(__FILE__) . '/fixtures/config.xml');
}
class phpbb_console_user_activate_test extends phpbb_console_user_base
{
protected $notifications;
public function setUp()
{
global $config, $db, $user, $auth, $phpbb_dispatcher, $phpbb_root_path, $phpEx;
$auth = $this->getMock('\phpbb\auth\auth');
$phpbb_dispatcher = new phpbb_mock_event_dispatcher();
$config = $this->config = new \phpbb\config\config(array());
$db = $this->db = $this->new_dbal();
$this->language = $this->getMockBuilder('\phpbb\language\language')
->disableOriginalConstructor()
->getMock();
$this->language->expects($this->any())
->method('lang')
->will($this->returnArgument(0));
$user = $this->user = $this->getMock('\phpbb\user', array(), array(
$this->language,
'\phpbb\datetime'
));
$this->log = $this->getMockBuilder('\phpbb\log\log')
->disableOriginalConstructor()
->getMock();
parent::setUp();
$this->notifications = $this->getMockBuilder('\phpbb\notification\manager')
->disableOriginalConstructor()
->getMock();
}
$this->phpbb_root_path = $phpbb_root_path;
$this->php_ext = $phpEx;
public function get_command_tester()
{
$application = new Application();
$application->add(new activate(
$this->user,
$this->db,
$this->config,
$this->language,
$this->log,
$this->notifications,
$this->phpbb_root_path,
$this->php_ext
));
parent::setUp();
$command = $application->find('user:activate');
$this->command_name = $command->getName();
return new CommandTester($command);
}
public function activate_test_data()
@@ -101,24 +82,4 @@ class phpbb_console_command_user_activate_test extends phpbb_database_test_case
$this->assertContains($expected, $command_tester->getDisplay());
}
public function get_command_tester()
{
$application = new Application();
$application->add(new activate(
$this->user,
$this->db,
$this->config,
$this->language,
$this->log,
$this->notifications,
$this->phpbb_root_path,
$this->php_ext
));
$command = $application->find('user:activate');
$this->command_name = $command->getName();
return new CommandTester($command);
}
}