Skip to content

Commit

Permalink
[ticket/11305] Mock container for cache driver in functional create_u…
Browse files Browse the repository at this point in the history
…ser()

create_user has calls to fetch the cache driver from the container. This
PR mocks the container and returns a null cache driver in that case.

PHPBB3-11305
  • Loading branch information
igorw committed Jan 2, 2013
1 parent c8c6eb4 commit 0483971
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion tests/test_framework/phpbb_functional_test_case.php
Original file line number Diff line number Diff line change
Expand Up @@ -262,14 +262,22 @@ protected function create_user($username)
$config['rand_seed_last_update'] = time() + 600;

// Required by user_add
global $db, $cache, $phpbb_dispatcher;
global $db, $cache, $phpbb_dispatcher, $phpbb_container;
$db = $this->get_db();
if (!function_exists('phpbb_mock_null_cache'))
{
require_once(__DIR__ . '/../mock/null_cache.php');
}
$cache = new phpbb_mock_null_cache;

$cache_driver = new phpbb_cache_driver_null();
$phpbb_container = $this->getMock('Symfony\Component\DependencyInjection\ContainerInterface');
$phpbb_container
->expects($this->any())
->method('get')
->with('cache.driver')
->will($this->returnValue($cache_driver));

if (!function_exists('utf_clean_string'))
{
require_once(__DIR__ . '/../../phpBB/includes/utf/utf_tools.php');
Expand Down

0 comments on commit 0483971

Please sign in to comment.