Passed
Pull Request — master (#19)
by Victor
03:13
created

ViewTest   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 1
eloc 10
dl 0
loc 16
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A testShouldExecuteCallback() 0 14 1
1
<?php
2
declare(strict_types=1);
3
4
namespace Shoot\Shoot\Tests\Unit;
5
6
use PHPUnit\Framework\MockObject\MockObject;
7
use PHPUnit\Framework\TestCase;
8
use Shoot\Shoot\Tests\Fixtures\ViewFactory;
9
use stdClass;
10
11
final class ViewTest extends TestCase
12
{
13
    public function testShouldExecuteCallback(): void
14
    {
15
        /** @var callable|MockObject $callback */
16
        $callback = $this
17
            ->getMockBuilder(stdClass::class)
18
            ->setMethods(['__invoke'])
19
            ->getMock();
20
21
        $callback
22
            ->expects($this->once())
23
            ->method('__invoke');
24
25
        $view = ViewFactory::createWithCallback($callback);
0 ignored issues
show
Bug introduced by
$callback of type PHPUnit\Framework\MockObject\MockObject is incompatible with the type callable expected by parameter $callback of Shoot\Shoot\Tests\Fixtur...y::createWithCallback(). ( Ignorable by Annotation )

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

25
        $view = ViewFactory::createWithCallback(/** @scrutinizer ignore-type */ $callback);
Loading history...
26
        $view->render();
27
    }
28
}
29