From 3c11052fb3896b43685f596dc6e52f9cc07d6807 Mon Sep 17 00:00:00 2001 From: Joseph Warner Date: Thu, 11 Jul 2013 10:54:55 -0400 Subject: [PATCH 01/17] [feature/auth-refactor] Have a base auth class PHPBB3-9734 --- phpBB/includes/auth/provider/apache.php | 19 +------ phpBB/includes/auth/provider/base.php | 69 +++++++++++++++++++++++++ phpBB/includes/auth/provider/db.php | 43 +-------------- phpBB/includes/auth/provider/ldap.php | 27 +--------- 4 files changed, 75 insertions(+), 83 deletions(-) create mode 100644 phpBB/includes/auth/provider/base.php diff --git a/phpBB/includes/auth/provider/apache.php b/phpBB/includes/auth/provider/apache.php index 5f6f2862b6..e0217725d6 100644 --- a/phpBB/includes/auth/provider/apache.php +++ b/phpBB/includes/auth/provider/apache.php @@ -20,7 +20,8 @@ if (!defined('IN_PHPBB')) * * @package auth */ -class phpbb_auth_provider_apache implements phpbb_auth_provider_interface +class phpbb_auth_provider_apache extends phpbb_auth_provider_base + implements phpbb_auth_provider_interface { /** * Apache Authentication Constructor @@ -256,20 +257,4 @@ class phpbb_auth_provider_apache implements phpbb_auth_provider_interface return false; } - - /** - * {@inheritdoc} - */ - public function acp($new) - { - return; - } - - /** - * {@inheritdoc} - */ - public function logout($data, $new_session) - { - return; - } } diff --git a/phpBB/includes/auth/provider/base.php b/phpBB/includes/auth/provider/base.php new file mode 100644 index 0000000000..e053a1829b --- /dev/null +++ b/phpBB/includes/auth/provider/base.php @@ -0,0 +1,69 @@ +php_ext = $php_ext; } - /** - * {@inheritdoc} - */ - public function init() - { - return; - } - /** * {@inheritdoc} */ @@ -302,36 +295,4 @@ class phpbb_auth_provider_db implements phpbb_auth_provider_interface 'user_row' => $row, ); } - - /** - * {@inheritdoc} - */ - public function autologin() - { - return; - } - - /** - * {@inheritdoc} - */ - public function acp($new) - { - return; - } - - /** - * {@inheritdoc} - */ - public function logout($data, $new_session) - { - return; - } - - /** - * {@inheritdoc} - */ - public function validate_session($user) - { - return; - } } diff --git a/phpBB/includes/auth/provider/ldap.php b/phpBB/includes/auth/provider/ldap.php index f67c1e9247..dbb569f466 100644 --- a/phpBB/includes/auth/provider/ldap.php +++ b/phpBB/includes/auth/provider/ldap.php @@ -22,7 +22,8 @@ if (!defined('IN_PHPBB')) * * @package auth */ -class phpbb_auth_provider_ldap implements phpbb_auth_provider_interface +class phpbb_auth_provider_ldap extends phpbb_auth_provider_base + implements phpbb_auth_provider_interface { /** * LDAP Authentication Constructor @@ -283,14 +284,6 @@ class phpbb_auth_provider_ldap implements phpbb_auth_provider_interface ); } - /** - * {@inheritdoc} - */ - public function autologin() - { - return; - } - /** * {@inheritdoc} */ @@ -367,20 +360,4 @@ class phpbb_auth_provider_ldap implements phpbb_auth_provider_interface { return str_replace(array('*', '\\', '(', ')'), array('\\*', '\\\\', '\\(', '\\)'), $string); } - - /** - * {@inheritdoc} - */ - public function logout($data, $new_session) - { - return; - } - - /** - * {@inheritdoc} - */ - public function validate_session($user) - { - return; - } } From 69c1b1aea89f3c705c19d69aab70c35a7d09747a Mon Sep 17 00:00:00 2001 From: Joseph Warner Date: Thu, 11 Jul 2013 11:06:34 -0400 Subject: [PATCH 02/17] [feature/auth-refactor] Prevent fatal error in php < 5.3.23 PHPBB3-9734 --- phpBB/includes/auth/provider/base.php | 5 ----- 1 file changed, 5 deletions(-) diff --git a/phpBB/includes/auth/provider/base.php b/phpBB/includes/auth/provider/base.php index e053a1829b..7961bf4dde 100644 --- a/phpBB/includes/auth/provider/base.php +++ b/phpBB/includes/auth/provider/base.php @@ -30,11 +30,6 @@ abstract class phpbb_auth_provider_base implements phpbb_auth_provider_interface return; } - /** - * {@inheritdoc} - */ - abstract public function login($username, $password); - /** * {@inheritdoc} */ From 021eb083abc1fe11d18d756adf12f72b903b13ed Mon Sep 17 00:00:00 2001 From: Joseph Warner Date: Thu, 11 Jul 2013 11:09:25 -0400 Subject: [PATCH 03/17] [feature/auth-refactor] Remove implements on classes extending base PHPBB3-9734 --- phpBB/includes/auth/provider/apache.php | 1 - phpBB/includes/auth/provider/db.php | 3 +-- phpBB/includes/auth/provider/ldap.php | 1 - 3 files changed, 1 insertion(+), 4 deletions(-) diff --git a/phpBB/includes/auth/provider/apache.php b/phpBB/includes/auth/provider/apache.php index e0217725d6..2e80436f78 100644 --- a/phpBB/includes/auth/provider/apache.php +++ b/phpBB/includes/auth/provider/apache.php @@ -21,7 +21,6 @@ if (!defined('IN_PHPBB')) * @package auth */ class phpbb_auth_provider_apache extends phpbb_auth_provider_base - implements phpbb_auth_provider_interface { /** * Apache Authentication Constructor diff --git a/phpBB/includes/auth/provider/db.php b/phpBB/includes/auth/provider/db.php index b9b808cb5d..0934c56d9b 100644 --- a/phpBB/includes/auth/provider/db.php +++ b/phpBB/includes/auth/provider/db.php @@ -22,8 +22,7 @@ if (!defined('IN_PHPBB')) * * @package auth */ -class phpbb_auth_provider_db extends phpbb_auth_provider_base - implements phpbb_auth_provider_interface +class phpbb_auth_provider_db extends phpbb_auth_provider_base { /** diff --git a/phpBB/includes/auth/provider/ldap.php b/phpBB/includes/auth/provider/ldap.php index dbb569f466..e10986abf0 100644 --- a/phpBB/includes/auth/provider/ldap.php +++ b/phpBB/includes/auth/provider/ldap.php @@ -23,7 +23,6 @@ if (!defined('IN_PHPBB')) * @package auth */ class phpbb_auth_provider_ldap extends phpbb_auth_provider_base - implements phpbb_auth_provider_interface { /** * LDAP Authentication Constructor From ccef1ae5ab406f6e6c4110467e1077ab58135e30 Mon Sep 17 00:00:00 2001 From: Joseph Warner Date: Thu, 11 Jul 2013 11:26:59 -0400 Subject: [PATCH 04/17] [feature/auth-refactor] Change 'must' to 'should' PHPBB3-9734 --- phpBB/includes/auth/provider/base.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/includes/auth/provider/base.php b/phpBB/includes/auth/provider/base.php index 7961bf4dde..307988f00a 100644 --- a/phpBB/includes/auth/provider/base.php +++ b/phpBB/includes/auth/provider/base.php @@ -16,7 +16,7 @@ if (!defined('IN_PHPBB')) } /** - * Base authentication provider class that all other providers must implement. + * Base authentication provider class that all other providers should implement. * * @package auth */ From 177e340764ccb929d3ebfe978ce05ceba271f479 Mon Sep 17 00:00:00 2001 From: Joseph Warner Date: Thu, 11 Jul 2013 11:31:50 -0400 Subject: [PATCH 05/17] [feature/auth-refactor] Code style fix for doc blocks PHPBB3-9734 --- phpBB/includes/auth/provider/base.php | 28 +++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/phpBB/includes/auth/provider/base.php b/phpBB/includes/auth/provider/base.php index 307988f00a..046674e55e 100644 --- a/phpBB/includes/auth/provider/base.php +++ b/phpBB/includes/auth/provider/base.php @@ -16,47 +16,47 @@ if (!defined('IN_PHPBB')) } /** - * Base authentication provider class that all other providers should implement. - * - * @package auth - */ +* Base authentication provider class that all other providers should implement. +* +* @package auth +*/ abstract class phpbb_auth_provider_base implements phpbb_auth_provider_interface { /** - * {@inheritdoc} - */ + * {@inheritdoc} + */ public function init() { return; } /** - * {@inheritdoc} - */ + * {@inheritdoc} + */ public function autologin() { return; } /** - * {@inheritdoc} - */ + * {@inheritdoc} + */ public function acp($new) { return; } /** - * {@inheritdoc} - */ + * {@inheritdoc} + */ public function logout($data, $new_session) { return; } /** - * {@inheritdoc} - */ + * {@inheritdoc} + */ public function validate_session($user) { return; From e674838d6951adb4df76195863df918f3b5852fd Mon Sep 17 00:00:00 2001 From: Joseph Warner Date: Thu, 11 Jul 2013 12:06:48 -0400 Subject: [PATCH 06/17] [feature/auth-refactor] Remove full stop PHPBB3-9734 --- phpBB/includes/auth/provider/base.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/includes/auth/provider/base.php b/phpBB/includes/auth/provider/base.php index 046674e55e..f28f352e2c 100644 --- a/phpBB/includes/auth/provider/base.php +++ b/phpBB/includes/auth/provider/base.php @@ -16,7 +16,7 @@ if (!defined('IN_PHPBB')) } /** -* Base authentication provider class that all other providers should implement. +* Base authentication provider class that all other providers should implement * * @package auth */ From e2435f25d90913455e0b8ffd92fb0918cf6f376f Mon Sep 17 00:00:00 2001 From: Joseph Warner Date: Thu, 11 Jul 2013 14:54:00 -0400 Subject: [PATCH 07/17] [feature/auth-refactor] Check that providers implement auth interface PHPBB3-9734 --- phpBB/includes/acp/acp_board.php | 6 ++++++ phpBB/includes/session.php | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/phpBB/includes/acp/acp_board.php b/phpBB/includes/acp/acp_board.php index 24b913260b..19219f6323 100644 --- a/phpBB/includes/acp/acp_board.php +++ b/phpBB/includes/acp/acp_board.php @@ -563,6 +563,12 @@ class acp_board if (array_key_exists('auth.provider.' . $method, $auth_providers)) { $provider = $auth_providers['auth.provider.' . $method]; + + if (!($provider instanceof phpbb_auth_provider_interface)) + { + throw new \RuntimeException($provider . ' must implement phpbb_auth_provider_interface'); + } + if ($error = $provider->init()) { foreach ($old_auth_config as $config_name => $config_value) diff --git a/phpBB/includes/session.php b/phpBB/includes/session.php index 66bf053f7d..e0585b1523 100644 --- a/phpBB/includes/session.php +++ b/phpBB/includes/session.php @@ -404,6 +404,12 @@ class phpbb_session $method = basename(trim($config['auth_method'])); $provider = $phpbb_container->get('auth.provider.' . $method); + + if (!($provider instanceof phpbb_auth_provider_interface)) + { + throw new \RuntimeException($provider . ' must implement phpbb_auth_provider_interface'); + } + $ret = $provider->validate_session($this->data); if ($ret !== null && !$ret) { From 9c0495664d8d89c5ee8e6187e40afbe353acf033 Mon Sep 17 00:00:00 2001 From: Joseph Warner Date: Thu, 11 Jul 2013 15:45:44 -0400 Subject: [PATCH 08/17] [feature/auth-refactor] Remove invalid providers from acp select PHPBB3-9734 --- phpBB/includes/acp/acp_board.php | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/phpBB/includes/acp/acp_board.php b/phpBB/includes/acp/acp_board.php index 19219f6323..f142801b72 100644 --- a/phpBB/includes/acp/acp_board.php +++ b/phpBB/includes/acp/acp_board.php @@ -563,12 +563,6 @@ class acp_board if (array_key_exists('auth.provider.' . $method, $auth_providers)) { $provider = $auth_providers['auth.provider.' . $method]; - - if (!($provider instanceof phpbb_auth_provider_interface)) - { - throw new \RuntimeException($provider . ' must implement phpbb_auth_provider_interface'); - } - if ($error = $provider->init()) { foreach ($old_auth_config as $config_name => $config_value) @@ -686,6 +680,10 @@ class acp_board foreach($auth_providers as $key => $value) { + if (!($provider instanceof phpbb_auth_provider_interface)) + { + continue; + } $auth_plugins[] = str_replace('auth.provider.', '', $key); } From a64a042830d3b0189e35ff0abe0649bff7105a1b Mon Sep 17 00:00:00 2001 From: Joseph Warner Date: Thu, 11 Jul 2013 17:39:34 -0400 Subject: [PATCH 09/17] [feature/auth-refactor] Fix typo PHPBB3-9734 --- phpBB/includes/acp/acp_board.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/includes/acp/acp_board.php b/phpBB/includes/acp/acp_board.php index f142801b72..7a3c4990d5 100644 --- a/phpBB/includes/acp/acp_board.php +++ b/phpBB/includes/acp/acp_board.php @@ -680,7 +680,7 @@ class acp_board foreach($auth_providers as $key => $value) { - if (!($provider instanceof phpbb_auth_provider_interface)) + if (!($value instanceof phpbb_auth_provider_interface)) { continue; } From f4f29a1c0ae04c3a3d41aee822d7c858f39f5295 Mon Sep 17 00:00:00 2001 From: Joseph Warner Date: Thu, 11 Jul 2013 17:43:20 -0400 Subject: [PATCH 10/17] [feature/auth-refactor] Fix style issue PHPBB3-9734 --- phpBB/includes/acp/acp_board.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/includes/acp/acp_board.php b/phpBB/includes/acp/acp_board.php index 7a3c4990d5..7627ff0b56 100644 --- a/phpBB/includes/acp/acp_board.php +++ b/phpBB/includes/acp/acp_board.php @@ -678,7 +678,7 @@ class acp_board $auth_plugins = array(); $auth_providers = $phpbb_container->get('auth.provider_collection'); - foreach($auth_providers as $key => $value) + foreach ($auth_providers as $key => $value) { if (!($value instanceof phpbb_auth_provider_interface)) { From c17f8a5d373e103fd397766358e3ff7fc3891192 Mon Sep 17 00:00:00 2001 From: Joseph Warner Date: Thu, 11 Jul 2013 18:15:22 -0400 Subject: [PATCH 11/17] [feature/auth-refactor] Test that acp_board excludes invalid providers PHPBB3-9734 --- tests/acp_board/select_auth_method_test.php | 43 +++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 tests/acp_board/select_auth_method_test.php diff --git a/tests/acp_board/select_auth_method_test.php b/tests/acp_board/select_auth_method_test.php new file mode 100644 index 0000000000..f81cf19db3 --- /dev/null +++ b/tests/acp_board/select_auth_method_test.php @@ -0,0 +1,43 @@ +set('auth.provider_collection', array( + 'auth.provider.acp_board_valid' => new phpbb_auth_provider_acp_board_valid, + 'auth.provider.acp_board_invalid' => new phpbb_auth_provider_acp_board_invalid, + ) + ); + + $acp_board = new acp_board(); + + $expected = ''; + $this->assertEquals($expected, $acp_board->select_auth_method('acp_board_valid')); + } +} + +class phpbb_auth_provider_acp_board_valid extends phpbb_auth_provider_base +{ + public function login($username, $password) + { + return; + } +} + +class phpbb_auth_provider_acp_board_invalid +{ + +} From 0fbf8f8c81e2ec3eddda58498c52812cf8e4a419 Mon Sep 17 00:00:00 2001 From: Joseph Warner Date: Thu, 11 Jul 2013 18:21:50 -0400 Subject: [PATCH 12/17] [feature/auth-refactor] Move test classes into separate directory PHPBB3-9734 --- tests/acp_board/auth_provider/invalid.php | 13 +++++++++++++ tests/acp_board/auth_provider/valid.php | 16 ++++++++++++++++ tests/acp_board/select_auth_method_test.php | 15 ++------------- 3 files changed, 31 insertions(+), 13 deletions(-) create mode 100644 tests/acp_board/auth_provider/invalid.php create mode 100644 tests/acp_board/auth_provider/valid.php diff --git a/tests/acp_board/auth_provider/invalid.php b/tests/acp_board/auth_provider/invalid.php new file mode 100644 index 0000000000..c12851afe6 --- /dev/null +++ b/tests/acp_board/auth_provider/invalid.php @@ -0,0 +1,13 @@ +assertEquals($expected, $acp_board->select_auth_method('acp_board_valid')); } } - -class phpbb_auth_provider_acp_board_valid extends phpbb_auth_provider_base -{ - public function login($username, $password) - { - return; - } -} - -class phpbb_auth_provider_acp_board_invalid -{ - -} From 8b2ca35b54e1678c443082b8945a393fb5d58e35 Mon Sep 17 00:00:00 2001 From: Joseph Warner Date: Thu, 11 Jul 2013 18:25:04 -0400 Subject: [PATCH 13/17] [feature/auth-refactor] Code style change PHPBB3-9734 --- tests/acp_board/select_auth_method_test.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/acp_board/select_auth_method_test.php b/tests/acp_board/select_auth_method_test.php index 922ddda1d6..8453ec6b3b 100644 --- a/tests/acp_board/select_auth_method_test.php +++ b/tests/acp_board/select_auth_method_test.php @@ -7,9 +7,9 @@ * */ -require_once dirname(__FILE__).'/../../phpBB/includes/acp/acp_board.php'; -require_once dirname(__FILE__).'/auth_provider/invalid.php'; -require_once dirname(__FILE__).'/auth_provider/valid.php'; +require_once dirname(__FILE__) . '/../../phpBB/includes/acp/acp_board.php'; +require_once dirname(__FILE__) . '/auth_provider/invalid.php'; +require_once dirname(__FILE__) . '/auth_provider/valid.php'; class phpbb_acp_board_select_auth_method_test extends PHPUnit_Framework_TestCase { From 4bd676e4aedd6bc0737781a61bbc6d8dc0b26809 Mon Sep 17 00:00:00 2001 From: Joseph Warner Date: Thu, 11 Jul 2013 18:26:39 -0400 Subject: [PATCH 14/17] [feature/auth-refactor] Test selecting invalid provider as well PHPBB3-9734 --- tests/acp_board/select_auth_method_test.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tests/acp_board/select_auth_method_test.php b/tests/acp_board/select_auth_method_test.php index 8453ec6b3b..d93522d93a 100644 --- a/tests/acp_board/select_auth_method_test.php +++ b/tests/acp_board/select_auth_method_test.php @@ -21,12 +21,14 @@ class phpbb_acp_board_select_auth_method_test extends PHPUnit_Framework_TestCase $phpbb_container->set('auth.provider_collection', array( 'auth.provider.acp_board_valid' => new phpbb_auth_provider_acp_board_valid, 'auth.provider.acp_board_invalid' => new phpbb_auth_provider_acp_board_invalid, - ) - ); + )); $acp_board = new acp_board(); $expected = ''; $this->assertEquals($expected, $acp_board->select_auth_method('acp_board_valid')); + + $expected = ''; + $this->assertEquals($expected, $acp_board->select_auth_method('acp_board_invalid')); } } From e5f1e0f98471f5b757c22b85bf38be4d505c4f72 Mon Sep 17 00:00:00 2001 From: Joseph Warner Date: Thu, 11 Jul 2013 18:35:41 -0400 Subject: [PATCH 15/17] [feature/auth-refactor] DataProvider for acp_board test PHPBB3-9734 --- tests/acp_board/select_auth_method_test.php | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/tests/acp_board/select_auth_method_test.php b/tests/acp_board/select_auth_method_test.php index d93522d93a..2172436aa2 100644 --- a/tests/acp_board/select_auth_method_test.php +++ b/tests/acp_board/select_auth_method_test.php @@ -11,9 +11,20 @@ require_once dirname(__FILE__) . '/../../phpBB/includes/acp/acp_board.php'; require_once dirname(__FILE__) . '/auth_provider/invalid.php'; require_once dirname(__FILE__) . '/auth_provider/valid.php'; -class phpbb_acp_board_select_auth_method_test extends PHPUnit_Framework_TestCase +class phpbb_acp_board_select_auth_method_test extends phpbb_test_case { - public function test_invalid_provider() + public static function function_return() + { + return array( + array('acp_board_valid', ''), + array('acp_board_invalid', ''), + ); + } + + /** + * @dataProvider function_return + */ + public function test_invalid_provider($selected, $expected) { global $phpbb_container; $phpbb_container = new phpbb_mock_container_builder(); @@ -25,10 +36,6 @@ class phpbb_acp_board_select_auth_method_test extends PHPUnit_Framework_TestCase $acp_board = new acp_board(); - $expected = ''; - $this->assertEquals($expected, $acp_board->select_auth_method('acp_board_valid')); - - $expected = ''; - $this->assertEquals($expected, $acp_board->select_auth_method('acp_board_invalid')); + $this->assertEquals($expected, $acp_board->select_auth_method($selected)); } } From 79f0866b781853769c561138bc1a5646a9287b81 Mon Sep 17 00:00:00 2001 From: Joseph Warner Date: Thu, 11 Jul 2013 18:47:42 -0400 Subject: [PATCH 16/17] [feature/auth-refactor] Changes PHPBB3-9734 --- tests/acp_board/select_auth_method_test.php | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/tests/acp_board/select_auth_method_test.php b/tests/acp_board/select_auth_method_test.php index 2172436aa2..34ca013824 100644 --- a/tests/acp_board/select_auth_method_test.php +++ b/tests/acp_board/select_auth_method_test.php @@ -13,7 +13,9 @@ require_once dirname(__FILE__) . '/auth_provider/valid.php'; class phpbb_acp_board_select_auth_method_test extends phpbb_test_case { - public static function function_return() + protected $acp_board; + + public static function select_auth_method_data() { return array( array('acp_board_valid', ''), @@ -21,10 +23,7 @@ class phpbb_acp_board_select_auth_method_test extends phpbb_test_case ); } - /** - * @dataProvider function_return - */ - public function test_invalid_provider($selected, $expected) + public function setUp() { global $phpbb_container; $phpbb_container = new phpbb_mock_container_builder(); @@ -34,8 +33,14 @@ class phpbb_acp_board_select_auth_method_test extends phpbb_test_case 'auth.provider.acp_board_invalid' => new phpbb_auth_provider_acp_board_invalid, )); - $acp_board = new acp_board(); + $this->acp_board = new acp_board(); + } - $this->assertEquals($expected, $acp_board->select_auth_method($selected)); + /** + * @dataProvider select_auth_method_data + */ + public function test_select_auth_method($selected, $expected) + { + $this->assertEquals($expected, $this->acp_board->select_auth_method($selected)); } } From b9f33e5a872af35128629872b5bb60032d25f932 Mon Sep 17 00:00:00 2001 From: Joseph Warner Date: Thu, 11 Jul 2013 21:57:03 -0400 Subject: [PATCH 17/17] [feature/auth-refactor] Add parent::setUp() in setUp() PHPBB3-9734 --- tests/acp_board/select_auth_method_test.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/acp_board/select_auth_method_test.php b/tests/acp_board/select_auth_method_test.php index 34ca013824..91aa5d1232 100644 --- a/tests/acp_board/select_auth_method_test.php +++ b/tests/acp_board/select_auth_method_test.php @@ -25,6 +25,8 @@ class phpbb_acp_board_select_auth_method_test extends phpbb_test_case public function setUp() { + parent::setUp(); + global $phpbb_container; $phpbb_container = new phpbb_mock_container_builder();