Issues (4)

tests/src/NameFactoryTest.php (1 issue)

Labels
Severity
1
<?php
2
3
namespace ByTIC\Namefy\Tests;
4
5
use ByTIC\Namefy\Name;
6
use ByTIC\Namefy\NameFactory;
7
use ByTIC\Namefy\Strategies\AbstractStrategy;
8
use Mockery\Mock;
9
10
/**
11
 * Class NameFactoryTest
12
 * @package ByTIC\Namefy\Tests
13
 */
14
class NameFactoryTest extends AbstractTest
15
{
16
    public function test_from()
17
    {
18
        /** @var Mock|AbstractStrategy $strategy */
19
        $strategy = \Mockery::mock(AbstractStrategy::class)->makePartial();
20
        $strategy->shouldReceive('fromRepository')->andReturn('resource');
21
        $strategy->shouldReceive('toModel')->andReturn('model');
22
        $strategy->shouldReceive('toController')->andReturn('controller');
23
24
        $name = NameFactory::from('books', 'repository', $strategy);
0 ignored issues
show
$strategy of type Mockery\Mock is incompatible with the type ByTIC\Namefy\Strategies\AbstractStrategy expected by parameter $strategy of ByTIC\Namefy\NameFactory::from(). ( Ignorable by Annotation )

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

24
        $name = NameFactory::from('books', 'repository', /** @scrutinizer ignore-type */ $strategy);
Loading history...
25
26
        self::assertInstanceOf(Name::class, $name);
27
28
        self::assertSame('resource', $name->resource());
29
        self::assertSame('model', $name->model());
30
        self::assertSame('controller', $name->controller());
31
    }
32
}
33