diff options
Diffstat (limited to 'tests/console/cron')
| -rw-r--r-- | tests/console/cron/cron_list_test.php | 7 | ||||
| -rw-r--r-- | tests/console/cron/run_test.php | 14 | 
2 files changed, 18 insertions, 3 deletions
| diff --git a/tests/console/cron/cron_list_test.php b/tests/console/cron/cron_list_test.php index 22423304be..3bbe2078ba 100644 --- a/tests/console/cron/cron_list_test.php +++ b/tests/console/cron/cron_list_test.php @@ -32,7 +32,12 @@ class phpbb_console_command_cron_list_test extends phpbb_test_case  	protected function setUp()  	{ -		$this->user = $this->getMock('\phpbb\user', array(), array('\phpbb\datetime')); +		global $phpbb_root_path, $phpEx; + +		$this->user = $this->getMock('\phpbb\user', array(), array( +			new \phpbb\language\language(new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx)), +			'\phpbb\datetime' +		));  		$this->user->method('lang')->will($this->returnArgument(0));  	} diff --git a/tests/console/cron/run_test.php b/tests/console/cron/run_test.php index f76e967484..d6c7b21781 100644 --- a/tests/console/cron/run_test.php +++ b/tests/console/cron/run_test.php @@ -39,10 +39,12 @@ class phpbb_console_command_cron_run_test extends phpbb_database_test_case  		$db = $this->db = $this->new_dbal();  		$config = $this->config = new \phpbb\config\config(array('cron_lock' => '0')); -		set_config(null, null, null, $this->config);  		$this->lock = new \phpbb\lock\db('cron_lock', $this->config, $this->db); -		$this->user = $this->getMock('\phpbb\user', array(), array('\phpbb\datetime')); +		$this->user = $this->getMock('\phpbb\user', array(), array( +			new \phpbb\language\language(new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx)), +			'\phpbb\datetime' +		));  		$this->user->method('lang')->will($this->returnArgument(0));  		$this->task = new phpbb_cron_task_simple(); @@ -76,6 +78,10 @@ class phpbb_console_command_cron_run_test extends phpbb_database_test_case  		$this->assertSame(false, $this->lock->owns_lock());  	} +	/** +	 * @expectedException \phpbb\exception\runtime_exception +	 * @expectedExceptionMessage CRON_LOCK_ERROR +	 */  	public function test_error_lock()  	{  		$this->lock->acquire(); @@ -124,6 +130,10 @@ class phpbb_console_command_cron_run_test extends phpbb_database_test_case  		$this->assertSame(false, $this->lock->owns_lock());  	} +	/** +	 * @expectedException \phpbb\exception\runtime_exception +	 * @expectedExceptionMessage CRON_NO_SUCH_TASK +	 */  	public function test_arg_invalid()  	{  		$command_tester = $this->get_command_tester(); | 
