|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
declare(strict_types = 1); |
|
4
|
|
|
|
|
5
|
|
|
namespace spec\hanneskod\readmetester\Expectation; |
|
6
|
|
|
|
|
7
|
|
|
use hanneskod\readmetester\Expectation\ErrorExpectation; |
|
8
|
|
|
use hanneskod\readmetester\Expectation\ExpectationInterface; |
|
9
|
|
|
use hanneskod\readmetester\Expectation\Failure; |
|
10
|
|
|
use hanneskod\readmetester\Expectation\Success; |
|
11
|
|
|
use hanneskod\readmetester\Runner\OutcomeInterface; |
|
12
|
|
|
use hanneskod\readmetester\Utils\Regexp; |
|
13
|
|
|
use PhpSpec\ObjectBehavior; |
|
|
|
|
|
|
14
|
|
|
use Prophecy\Argument; |
|
|
|
|
|
|
15
|
|
|
|
|
16
|
|
|
class ErrorExpectationSpec extends ObjectBehavior |
|
17
|
|
|
{ |
|
18
|
|
|
function let(Regexp $regexp) |
|
|
|
|
|
|
19
|
|
|
{ |
|
20
|
|
|
$this->beConstructedWith($regexp); |
|
21
|
|
|
} |
|
22
|
|
|
|
|
23
|
|
|
function it_is_initializable() |
|
|
|
|
|
|
24
|
|
|
{ |
|
25
|
|
|
$this->shouldHaveType(ErrorExpectation::CLASS); |
|
|
|
|
|
|
26
|
|
|
} |
|
27
|
|
|
|
|
28
|
|
|
function it_is_an_expectation() |
|
29
|
|
|
{ |
|
30
|
|
|
$this->shouldHaveType(ExpectationInterface::CLASS); |
|
|
|
|
|
|
31
|
|
|
} |
|
32
|
|
|
|
|
33
|
|
|
function it_can_be_converted_to_string($regexp) |
|
34
|
|
|
{ |
|
35
|
|
|
$regexp->getRegexp()->willReturn('foobar')->shouldBeCalled(); |
|
36
|
|
|
$this->getDescription(); |
|
37
|
|
|
} |
|
38
|
|
|
|
|
39
|
|
|
function it_handles_errors(OutcomeInterface $outcome) |
|
40
|
|
|
{ |
|
41
|
|
|
$outcome->getType()->willReturn(OutcomeInterface::TYPE_ERROR); |
|
42
|
|
|
$this->handles($outcome)->shouldReturn(true); |
|
43
|
|
|
} |
|
44
|
|
|
|
|
45
|
|
|
function it_does_not_handle_other_outcomes(OutcomeInterface $outcome) |
|
46
|
|
|
{ |
|
47
|
|
|
$outcome->getType()->willReturn('foo'); |
|
48
|
|
|
$this->handles($outcome)->shouldReturn(false); |
|
49
|
|
|
} |
|
50
|
|
|
|
|
51
|
|
|
function it_returns_failure_on_no_match($regexp, OutcomeInterface $outcome) |
|
52
|
|
|
{ |
|
53
|
|
|
$outcome->getContent()->willReturn('foobar'); |
|
54
|
|
|
$regexp->isMatch('foobar')->willReturn(false); |
|
55
|
|
|
$regexp->getRegexp()->willReturn(''); |
|
56
|
|
|
$this->handle($outcome)->shouldHaveType(Failure::CLASS); |
|
|
|
|
|
|
57
|
|
|
} |
|
58
|
|
|
|
|
59
|
|
|
function it_returns_success_on_match($regexp, OutcomeInterface $outcome) |
|
60
|
|
|
{ |
|
61
|
|
|
$outcome->getContent()->willReturn('foobar'); |
|
62
|
|
|
$regexp->isMatch('foobar')->willReturn(true); |
|
63
|
|
|
$regexp->getRegexp()->willReturn(''); |
|
64
|
|
|
$this->handle($outcome)->shouldHaveType(Success::CLASS); |
|
|
|
|
|
|
65
|
|
|
} |
|
66
|
|
|
} |
|
67
|
|
|
|
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