aboutsummaryrefslogtreecommitdiffstats
path: root/tests/di/create_container_test.php
blob: 6de8803df98560a921e295cc2385857a9d330874 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
<?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';

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 phpbb_db_driver_container_mock extends phpbb_db_driver
{
    public function sql_connect()
    {
    }

    public function sql_query()
    {
    }

    public function sql_fetchrow()
    {
    }

    public function sql_freeresult()
    {
    }
}