From 0483971f7786b10c3359dfbe4912501de0d6c7de Mon Sep 17 00:00:00 2001 From: Igor Wiedler Date: Wed, 2 Jan 2013 21:44:22 +0100 Subject: [PATCH] [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 --- tests/test_framework/phpbb_functional_test_case.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/tests/test_framework/phpbb_functional_test_case.php b/tests/test_framework/phpbb_functional_test_case.php index 59979e035d..e346223a4b 100644 --- a/tests/test_framework/phpbb_functional_test_case.php +++ b/tests/test_framework/phpbb_functional_test_case.php @@ -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');