Issues (104)

tests/TestCase/Orm/RepoTestCase.php (2 issues)

1
<?php
2
3
declare(strict_types=1);
4
5
namespace AbterPhp\Admin\TestCase\Orm;
6
7
use Opulence\Orm\DataMappers\IDataMapper;
8
use Opulence\Orm\IUnitOfWork;
9
use PHPUnit\Framework\MockObject\MockObject;
10
use PHPUnit\Framework\TestCase;
11
12
abstract class RepoTestCase extends TestCase
13
{
14
    /** @var string */
15
    protected $className = 'Foo';
16
17
    /** @var IDataMapper|MockObject */
18
    protected $dataMapperMock;
19
20
    /** @var IUnitOfWork|MockObject */
21
    protected $unitOfWorkMock;
22
23
    public function setUp(): void
24
    {
25
        parent::setUp();
26
27
        $this->dataMapperMock = $this->createDataMapperMock();
28
29
        $this->unitOfWorkMock = $this->createUnitOfWorkMock();
30
    }
31
32
    /**
33
     * @return IDataMapper|MockObject
34
     */
35
    protected function createDataMapperMock(): IDataMapper
36
    {
37
        /** @var IDataMapper|MockObject $mock */
38
        $mock = $this->createMock(IDataMapper::class);
39
40
        return $mock;
0 ignored issues
show
Bug Best Practice introduced by
The expression return $mock returns the type PHPUnit\Framework\MockObject\MockObject which is incompatible with the type-hinted return Opulence\Orm\DataMappers\IDataMapper.
Loading history...
41
    }
42
43
    /**
44
     * @return IUnitOfWork|MockObject
45
     */
46
    protected function createUnitOfWorkMock(): IUnitOfWork
47
    {
48
        /** @var IUnitOfWork|MockObject $mock */
49
        $mock = $this->createMock(IUnitOfWork::class);
50
51
        return $mock;
0 ignored issues
show
Bug Best Practice introduced by
The expression return $mock returns the type PHPUnit\Framework\MockObject\MockObject which is incompatible with the type-hinted return Opulence\Orm\IUnitOfWork.
Loading history...
52
    }
53
}
54