Completed
Push — master ( bd4c23...b341c0 )
by Filipe
10:29
created

ControllerSpec::it_accepts_a_controller_context()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 6
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 4
nc 1
nop 1
1
<?php
2
3
namespace spec\Slick\Mvc;
4
5
use Slick\Mvc\Controller;
6
use PhpSpec\ObjectBehavior;
7
use Prophecy\Argument;
8
9
class ControllerSpec extends ObjectBehavior
10
{
11
    function let()
12
    {
13
        $this->beAnInstanceOf(TestController::class);
14
    }
15
16
    function it_accepts_a_controller_context(
17
        Controller\ControllerContextInterface $context
18
    ) {
19
        $this->setContext($context)->shouldBe($this->getWrappedObject());
20
        $this->getContext()->shouldBe($context);
21
    }
22
23
    function it_can_set_view_data_model_variables()
24
    {
25
        $this->set('foo', 'bar')->shouldBe($this->getWrappedObject());
26
        $this->getViewData()->shouldHaveKeyWithValue('foo', 'bar');
27
    }
28
29
    function it_can_set_multiple_view_data_model_variables_passing_an_array()
30
    {
31
        $foo = 'bar';
32
        $bas = 'baz';
33
        $this->set(compact('foo', 'bas'));
34
        $this->getViewData()->shouldHaveKeyWithValue('bas', 'baz');
35
    }
36
}
37
38
class TestController extends Controller
0 ignored issues
show
Coding Style Compatibility introduced by
PSR1 recommends that each class should be in its own file to aid autoloaders.

Having each class in a dedicated file usually plays nice with PSR autoloaders and is therefore a well established practice. If you use other autoloaders, you might not want to follow this rule.

Loading history...
39
{
40
41
    public function getContext()
42
    {
43
        return $this->context;
44
    }
45
}
46