diff options
author | Tristan Darricau <github@nicofuma.fr> | 2014-11-11 19:10:43 +0100 |
---|---|---|
committer | Tristan Darricau <github@nicofuma.fr> | 2014-11-20 21:01:03 +0100 |
commit | 0a1db77ea85116adf24f9d3f0b92a44f818a107f (patch) | |
tree | 5ded6ced21caab395317997844ab08e4cb262e55 /tests/di | |
parent | [ticket/12620] Use the container to get the environment name (diff) | |
download | phpbb-0a1db77ea85116adf24f9d3f0b92a44f818a107f.tar.gz phpbb-0a1db77ea85116adf24f9d3f0b92a44f818a107f.tar.bz2 phpbb-0a1db77ea85116adf24f9d3f0b92a44f818a107f.zip |
[ticket/12620] Add a test using a custom DI extension in an extension
PHPBB3-12620
Diffstat (limited to 'tests/di')
-rw-r--r-- | tests/di/create_container_test.php | 3 | ||||
-rw-r--r-- | tests/di/fixtures/ext/vendor/enabled_4/di/extension.php | 31 | ||||
-rw-r--r-- | tests/di/fixtures/ext/vendor/enabled_4/environment.yml | 2 |
3 files changed, 36 insertions, 0 deletions
diff --git a/tests/di/create_container_test.php b/tests/di/create_container_test.php index 4e47751999..9cc714db40 100644 --- a/tests/di/create_container_test.php +++ b/tests/di/create_container_test.php @@ -16,6 +16,7 @@ namespace define('PHPBB_ENVIRONMENT', 'production'); require_once dirname(__FILE__) . '/../../phpBB/includes/functions.php'; + require_once dirname(__FILE__) . '/fixtures/ext/vendor/enabled_4/di/extension.php'; class phpbb_di_container_test extends \phpbb_test_case { @@ -61,6 +62,7 @@ namespace $this->assertTrue($container->hasParameter('enabled')); $this->assertTrue($container->hasParameter('enabled_2')); $this->assertTrue($container->hasParameter('enabled_3')); + $this->assertTrue($container->hasParameter('enabled_4')); $this->assertFalse($container->hasParameter('disabled')); $this->assertFalse($container->hasParameter('available')); @@ -204,6 +206,7 @@ namespace phpbb\db\driver array('ext_name' => 'vendor/enabled'), array('ext_name' => 'vendor/enabled-2'), array('ext_name' => 'vendor/enabled-3'), + array('ext_name' => 'vendor/enabled_4'), ); } } diff --git a/tests/di/fixtures/ext/vendor/enabled_4/di/extension.php b/tests/di/fixtures/ext/vendor/enabled_4/di/extension.php new file mode 100644 index 0000000000..8342625687 --- /dev/null +++ b/tests/di/fixtures/ext/vendor/enabled_4/di/extension.php @@ -0,0 +1,31 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace vendor\enabled_4\di; + +use phpbb\extension\di\extension_base; +use Symfony\Component\Config\FileLocator; +use Symfony\Component\DependencyInjection\ContainerBuilder; +use Symfony\Component\DependencyInjection\Loader\YamlFileLoader; + +/** +* Container core extension +*/ +class extension extends extension_base +{ + protected function load_services(ContainerBuilder $container) + { + $loader = new YamlFileLoader($container, new FileLocator(phpbb_realpath($this->ext_path))); + $loader->load('environment.yml'); + } +} diff --git a/tests/di/fixtures/ext/vendor/enabled_4/environment.yml b/tests/di/fixtures/ext/vendor/enabled_4/environment.yml new file mode 100644 index 0000000000..d0affe4fd6 --- /dev/null +++ b/tests/di/fixtures/ext/vendor/enabled_4/environment.yml @@ -0,0 +1,2 @@ +parameters: + enabled_4: true |