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

ControllerViewHydratorTest   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Importance

Changes 2
Bugs 0 Features 1
Metric Value
wmc 2
eloc 12
c 2
b 0
f 1
dl 0
loc 23
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A test_populatePath() 0 7 1
A test_initContentBlocks() 0 12 1
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
}