aboutsummaryrefslogtreecommitdiffstats
path: root/tests/di/create_container_test.php
diff options
context:
space:
mode:
authorIgor Wiedler <igor@wiedler.ch>2012-11-11 17:56:09 +0100
committerIgor Wiedler <igor@wiedler.ch>2012-11-11 17:56:09 +0100
commit1bf7f0bde73a8528f77b5f9cfffd6f113afcf63d (patch)
treee85c90d7bf1717f44920dd7580e40ccfc3604a19 /tests/di/create_container_test.php
parent00417fc723073a9e8acefe4a8a7660bf25017201 (diff)
downloadforums-1bf7f0bde73a8528f77b5f9cfffd6f113afcf63d.tar
forums-1bf7f0bde73a8528f77b5f9cfffd6f113afcf63d.tar.gz
forums-1bf7f0bde73a8528f77b5f9cfffd6f113afcf63d.tar.bz2
forums-1bf7f0bde73a8528f77b5f9cfffd6f113afcf63d.tar.xz
forums-1bf7f0bde73a8528f77b5f9cfffd6f113afcf63d.zip
[ticket/11152] Basic tests for the container functions
PHPBB3-11152
Diffstat (limited to 'tests/di/create_container_test.php')
-rw-r--r--tests/di/create_container_test.php72
1 files changed, 72 insertions, 0 deletions
diff --git a/tests/di/create_container_test.php b/tests/di/create_container_test.php
new file mode 100644
index 0000000000..c2b8a0fc0b
--- /dev/null
+++ b/tests/di/create_container_test.php
@@ -0,0 +1,72 @@
+<?php
+/**
+*
+* @package testing
+* @copyright (c) 2012 phpBB Group
+* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
+*
+*/
+
+require_once dirname(__FILE__) . '/../../phpBB/includes/functions.php';
+require_once dirname(__FILE__) . '/../../phpBB/includes/functions_container.php';
+require_once dirname(__FILE__) . '/../../phpBB/includes/db/dbal.php';
+
+class phpbb_di_container_test extends phpbb_test_case
+{
+ public function test_phpbb_create_container()
+ {
+ $phpbb_root_path = __DIR__ . '/../../phpBB/';
+ $extensions = array(
+ new phpbb_di_extension_config(__DIR__ . '/fixtures/config.php'),
+ new phpbb_di_extension_core($phpbb_root_path),
+ );
+ $container = phpbb_create_container($extensions, $phpbb_root_path, 'php');
+
+ $this->assertInstanceOf('Symfony\Component\DependencyInjection\ContainerBuilder', $container);
+ }
+
+ public function test_phpbb_create_install_container()
+ {
+ $phpbb_root_path = __DIR__ . '/../../phpBB/';
+ $extensions = array(
+ new phpbb_di_extension_config(__DIR__ . '/fixtures/config.php'),
+ new phpbb_di_extension_core($phpbb_root_path),
+ );
+ $container = phpbb_create_install_container($phpbb_root_path, 'php');
+
+ $this->assertInstanceOf('Symfony\Component\DependencyInjection\ContainerBuilder', $container);
+ $this->assertTrue($container->isFrozen());
+ }
+
+ public function test_phpbb_create_compiled_container()
+ {
+ $phpbb_root_path = __DIR__ . '/../../phpBB/';
+ $extensions = array(
+ new phpbb_di_extension_config(__DIR__ . '/fixtures/config.php'),
+ new phpbb_di_extension_core($phpbb_root_path),
+ );
+ $container = phpbb_create_compiled_container($extensions, array(), $phpbb_root_path, 'php');
+
+ $this->assertInstanceOf('Symfony\Component\DependencyInjection\ContainerBuilder', $container);
+ $this->assertTrue($container->isFrozen());
+ }
+}
+
+class dbal_container_mock extends dbal
+{
+ public function sql_connect()
+ {
+ }
+
+ public function sql_query()
+ {
+ }
+
+ public function sql_fetchrow()
+ {
+ }
+
+ public function sql_freeresult()
+ {
+ }
+}