Passed
Push — master ( 148695...692a71 )
by Gabriel
04:05 queued 10s
created

test_initContentBlocks()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 12
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 7
c 1
b 0
f 0
dl 0
loc 12
rs 10
cc 1
nc 1
nop 0
1
<?php
2
3
namespace Nip\Controllers\Tests\View;
4
5
use Mockery\Mock;
6
use Nip\Controllers\Tests\AbstractTest;
7
use Nip\Controllers\Tests\Fixtures\Controllers\ViewController;
8
use Nip\Controllers\View\ControllerViewHydrator;
9
use Nip\View;
10
11
/**
12
 * Class ControllerViewHydratorTest
13
 * @package Nip\Controllers\Tests\View
14
 */
15
class ControllerViewHydratorTest extends AbstractTest
16
{
17
    public function test_populatePath()
18
    {
19
        $view = new View();
20
        $controller = new ViewController();
21
        ControllerViewHydrator::populatePath($view, $controller);
22
23
        self::assertStringStartsWith($controller->generateViewPath(), $view->getBasePath());
24
    }
25
26
    public function test_initContentBlocks()
27
    {
28
        /** @var View\View|Mock $view */
29
        $view = \Mockery::mock(View::class)->makePartial();
30
        $view->shouldReceive('load')->with('/test_name/test_action')->andReturnTrue();
31
32
        $controller = new ViewController();
33
        $controller->setName('testName');
34
        $controller->setAction('testAction');
35
        ControllerViewHydrator::initContentBlocks($view, $controller);
0 ignored issues
show
Bug introduced by
$view of type Mockery\Mock is incompatible with the type Nip\View\View expected by parameter $view of Nip\Controllers\View\Con...or::initContentBlocks(). ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

35
        ControllerViewHydrator::initContentBlocks(/** @scrutinizer ignore-type */ $view, $controller);
Loading history...
36
37
        self::assertNull($view->render('content'));
38
    }
39
}