BuildTest::setup()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
dl 0
loc 8
rs 9.4285
c 2
b 0
f 0
cc 1
eloc 6
nc 1
nop 0
1
<?php
2
namespace Opine;
3
4
use PHPUnit_Framework_TestCase;
5
use Opine\Container\Service as Container;
6
use Opine\Config\Service as Config;
7
8
class BuildTest extends PHPUnit_Framework_TestCase
9
{
10
    private $build;
11
12
    public function setup()
13
    {
14
        $root = __DIR__.'/../public';
15
        $config = new Config($root);
16
        $config->cacheSet();
17
        $this->container = Container::instance($root, $config, $root.'/../config/containers/test-container.yml');
0 ignored issues
show
Bug introduced by
The property container does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
18
        $this->build = $this->container->get('build');
19
    }
20
21
    public function testBuild()
22
    {
23
        $cache = $this->build->project();
24
        $this->assertTrue(isset($cache['collections']));
25
        $this->assertTrue(isset($cache['forms']));
26
        $this->assertTrue(isset($cache['bundles']));
27
        $this->assertTrue(isset($cache['topics']));
28
        $this->assertTrue(isset($cache['routes']));
29
        $this->assertTrue(isset($cache['container']));
30
        $this->assertTrue(isset($cache['languages']));
31
        $this->assertTrue(isset($cache['config']));
32
    }
33
}
34