1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-02-22 19:07:27 +01:00

[ticket/11152] Basic tests for the container functions

PHPBB3-11152
This commit is contained in:
Igor Wiedler 2012-11-11 17:56:09 +01:00
parent 00417fc723
commit 1bf7f0bde7
2 changed files with 83 additions and 0 deletions

View File

@ -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()
{
}
}

View File

@ -0,0 +1,11 @@
<?php
// phpBB 3.1.x auto-generated configuration file
// Do not change anything in this file!
$dbms = 'container_mock';
$dbhost = '127.0.0.1';
$dbport = '';
$dbname = 'phpbb';
$dbuser = 'root';
$dbpasswd = '';
$table_prefix = 'phpbb_';
$acm_type = 'phpbb_cache_driver_null';