Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
13 / 13
100.00% covered (success)
100.00%
3 / 3
CRAP
100.00% covered (success)
100.00%
1 / 1
phpbb_config_php_file_test
100.00% covered (success)
100.00%
13 / 13
100.00% covered (success)
100.00%
3 / 3
3
100.00% covered (success)
100.00%
1 / 1
 test_default
100.00% covered (success)
100.00%
4 / 4
100.00% covered (success)
100.00%
1 / 1
1
 test_set_config_file
100.00% covered (success)
100.00%
5 / 5
100.00% covered (success)
100.00%
1 / 1
1
 test_non_existent_file
100.00% covered (success)
100.00%
4 / 4
100.00% covered (success)
100.00%
1 / 1
1
1<?php
2/**
3*
4* This file is part of the phpBB Forum Software package.
5*
6* @copyright (c) phpBB Limited <https://www.phpbb.com>
7* @license GNU General Public License, version 2 (GPL-2.0)
8*
9* For full copyright and license information, please see
10* the docs/CREDITS.txt file.
11*
12*/
13
14class phpbb_config_php_file_test extends phpbb_test_case
15{
16    public function test_default()
17    {
18        $config_php = new \phpbb\config_php_file(dirname( __FILE__ ) . '/fixtures/', 'php');
19        $this->assertSame('bar', $config_php->get('foo'));
20        $this->assertNull($config_php->get('bar'));
21        $this->assertSame(array('foo' => 'bar', 'foo_foo' => 'bar bar'), $config_php->get_all());
22    }
23
24    public function test_set_config_file()
25    {
26        $config_php = new \phpbb\config_php_file(dirname( __FILE__ ) . '/fixtures/', 'php');
27        $config_php->set_config_file(dirname( __FILE__ ) . '/fixtures/config_other.php');
28        $this->assertSame('foo', $config_php->get('bar'));
29        $this->assertNull($config_php->get('foo'));
30        $this->assertSame(array('bar' => 'foo', 'bar_bar' => 'foo foo'), $config_php->get_all());
31    }
32
33    public function test_non_existent_file()
34    {
35        $config_php = new \phpbb\config_php_file(dirname( __FILE__ ) . '/fixtures/non_existent/', 'php');
36        $this->assertNull($config_php->get('bar'));
37        $this->assertNull($config_php->get('foo'));
38        $this->assertSame(array(), $config_php->get_all());
39    }
40}