1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-03-13 20:28:44 +01:00

[ticket/11305] Mock container for cache driver in functional create_user()

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
This commit is contained in:
Igor Wiedler 2013-01-02 21:44:22 +01:00
parent c8c6eb46ec
commit 0483971f77

View File

@ -262,7 +262,7 @@ class phpbb_functional_test_case extends phpbb_test_case
$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'))
{
@ -270,6 +270,14 @@ class phpbb_functional_test_case extends phpbb_test_case
}
$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');