BuildTest   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Importance

Changes 2
Bugs 0 Features 0
Metric Value
wmc 2
lcom 1
cbo 3
dl 0
loc 26
rs 10
c 2
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A setup() 0 8 1
A testBuild() 0 12 1
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