ReadOnlyRepositoryTraitTest   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Importance

Changes 2
Bugs 0 Features 1
Metric Value
eloc 9
c 2
b 0
f 1
dl 0
loc 28
rs 10
wmc 4

4 Methods

Rating   Name   Duplication   Size   Complexity  
A testUpdate() 0 4 1
A testDelete() 0 4 1
A setUp() 0 3 1
A testCreate() 0 4 1
1
<?php
2
3
namespace GuillermoandraeTest\Repositories;
4
5
use PHPUnit\Framework\TestCase;
6
use Guillermoandrae\Repositories\ReadOnlyRepositoryTrait;
7
8
class ReadOnlyRepositoryTraitTest extends TestCase
9
{
10
    /**
11
     * @var ReadOnlyRepositoryTrait
12
     */
13
    private $repository;
14
15
    public function testCreate()
16
    {
17
        $this->expectExceptionMessage('The create method of this repository is not supported');
18
        $this->repository->create([]);
19
    }
20
21
    public function testUpdate()
22
    {
23
        $this->expectExceptionMessage('The update method of this repository is not supported');
24
        $this->repository->update('test', []);
25
    }
26
27
    public function testDelete()
28
    {
29
        $this->expectExceptionMessage('The delete method of this repository is not supported');
30
        $this->repository->delete('test');
31
    }
32
33
    protected function setUp(): void
34
    {
35
        $this->repository = $this->getMockForTrait(ReadOnlyRepositoryTrait::class);
0 ignored issues
show
Documentation Bug introduced by
It seems like $this->getMockForTrait(G...RepositoryTrait::class) of type PHPUnit\Framework\MockObject\MockObject is incompatible with the declared type Guillermoandrae\Reposito...ReadOnlyRepositoryTrait of property $repository.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
36
    }
37
}
38