1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Zenstruck\Foundry; |
4
|
|
|
|
5
|
|
|
use PHPUnit\Framework\Assert; |
|
|
|
|
6
|
|
|
|
7
|
|
|
/** |
8
|
|
|
* @author Kevin Bond <[email protected]> |
9
|
|
|
*/ |
10
|
|
|
final class RepositoryAssertions |
11
|
|
|
{ |
12
|
|
|
private $repository; |
13
|
|
|
|
14
|
|
|
public function __construct(RepositoryProxy $repository) |
15
|
|
|
{ |
16
|
|
|
$this->repository = $repository; |
17
|
|
|
} |
18
|
|
|
|
19
|
|
|
public function empty(string $message = ''): self |
20
|
|
|
{ |
21
|
|
|
return $this->count(0, $message); |
22
|
|
|
} |
23
|
|
|
|
24
|
|
|
public function count(int $expectedCount, string $message = ''): self |
25
|
|
|
{ |
26
|
|
|
Assert::assertSame($expectedCount, $this->repository->count(), $message); |
27
|
|
|
|
28
|
|
|
return $this; |
29
|
|
|
} |
30
|
|
|
|
31
|
|
|
public function countGreaterThan(int $expected, string $message = ''): self |
32
|
|
|
{ |
33
|
|
|
Assert::assertGreaterThan($expected, $this->repository->count(), $message); |
34
|
|
|
|
35
|
|
|
return $this; |
36
|
|
|
} |
37
|
|
|
|
38
|
|
|
public function countGreaterThanOrEqual(int $expected, string $message = ''): self |
39
|
|
|
{ |
40
|
|
|
Assert::assertGreaterThanOrEqual($expected, $this->repository->count(), $message); |
41
|
|
|
|
42
|
|
|
return $this; |
43
|
|
|
} |
44
|
|
|
|
45
|
|
|
public function countLessThan(int $expected, string $message = ''): self |
46
|
|
|
{ |
47
|
|
|
Assert::assertLessThan($expected, $this->repository->count(), $message); |
48
|
|
|
|
49
|
|
|
return $this; |
50
|
|
|
} |
51
|
|
|
|
52
|
|
|
public function countLessThanOrEqual(int $expected, string $message = ''): self |
53
|
|
|
{ |
54
|
|
|
Assert::assertLessThanOrEqual($expected, $this->repository->count(), $message); |
55
|
|
|
|
56
|
|
|
return $this; |
57
|
|
|
} |
58
|
|
|
|
59
|
|
|
/** |
60
|
|
|
* @param object|array|mixed $criteria |
61
|
|
|
*/ |
62
|
|
|
public function exists($criteria, string $message = ''): self |
63
|
|
|
{ |
64
|
|
|
Assert::assertNotNull($this->repository->find($criteria), $message); |
65
|
|
|
|
66
|
|
|
return $this; |
67
|
|
|
} |
68
|
|
|
|
69
|
|
|
/** |
70
|
|
|
* @param object|array|mixed $criteria |
71
|
|
|
*/ |
72
|
|
|
public function notExists($criteria, string $message = ''): self |
73
|
|
|
{ |
74
|
|
|
Assert::assertNull($this->repository->find($criteria), $message); |
75
|
|
|
|
76
|
|
|
return $this; |
77
|
|
|
} |
78
|
|
|
} |
79
|
|
|
|
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"]
, you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths