private function create_cron_manager($tasks) { global $phpbb_root_path, $phpEx; $mock_config = new \phpbb\config\config(array('force_server_vars' => false, 'enable_mod_rewrite' => '')); $mock_router = $this->getMockBuilder('\\phpbb\\routing\\router')->setMethods(array('setContext', 'generate'))->disableOriginalConstructor()->getMock(); $mock_router->method('setContext')->willReturn(true); $mock_router->method('generate')->willReturn('foobar'); $request = new \phpbb\request\request(); $request->enable_super_globals(); $routing_helper = new \phpbb\routing\helper($mock_config, $mock_router, new \phpbb\symfony_request($request), $request, new \phpbb\filesystem\filesystem(), $phpbb_root_path, $phpEx); return new \phpbb\cron\manager($tasks, $routing_helper, $phpbb_root_path, $phpEx); }
public function test_no_task_verbose() { $tasks = array(); $mock_config = new \phpbb\config\config(array('force_server_vars' => false, 'enable_mod_rewrite' => '')); $mock_router = $this->getMockBuilder('\\phpbb\\routing\\router')->setMethods(array('setContext', 'generate'))->disableOriginalConstructor()->getMock(); $mock_router->method('setContext')->willReturn(true); $mock_router->method('generate')->willReturn('foobar'); $request = new \phpbb\request\request(); $request->enable_super_globals(); $routing_helper = new \phpbb\routing\helper($mock_config, $mock_router, new \phpbb\symfony_request($request), $request, new \phpbb\filesystem\filesystem(), $phpbb_root_path, $phpEx); $this->cron_manager = new \phpbb\cron\manager($tasks, $routing_helper, $phpbb_root_path, $phpEx); $command_tester = $this->get_command_tester(); $exit_status = $command_tester->execute(array('command' => $this->command_name, '--verbose' => true)); $this->assertContains('CRON_NO_TASK', $command_tester->getDisplay()); $this->assertSame(0, $exit_status); $this->assertSame(false, $this->lock->owns_lock()); }