|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
declare(strict_types=1); |
|
4
|
|
|
|
|
5
|
|
|
namespace spec\hanneskod\readmetester\Expectation; |
|
6
|
|
|
|
|
7
|
|
|
use hanneskod\readmetester\Expectation\Success; |
|
8
|
|
|
use hanneskod\readmetester\Expectation\StatusInterface; |
|
9
|
|
|
use hanneskod\readmetester\Runner\OutcomeInterface; |
|
10
|
|
|
use PhpSpec\ObjectBehavior; |
|
11
|
|
|
use Prophecy\Argument; |
|
12
|
|
|
|
|
13
|
|
|
class SuccessSpec extends ObjectBehavior |
|
14
|
|
|
{ |
|
15
|
|
|
function let(OutcomeInterface $outcome) |
|
16
|
|
|
{ |
|
17
|
|
|
$this->beConstructedWith($outcome, 'foobar'); |
|
18
|
|
|
} |
|
19
|
|
|
|
|
20
|
|
|
function it_is_initializable() |
|
21
|
|
|
{ |
|
22
|
|
|
$this->shouldHaveType(Success::class); |
|
23
|
|
|
} |
|
24
|
|
|
|
|
25
|
|
|
function it_is_a_status() |
|
26
|
|
|
{ |
|
27
|
|
|
$this->shouldHaveType(StatusInterface::class); |
|
28
|
|
|
} |
|
29
|
|
|
|
|
30
|
|
|
function it_contains_outcome($outcome) |
|
31
|
|
|
{ |
|
32
|
|
|
$this->getOutcome()->shouldReturn($outcome); |
|
33
|
|
|
} |
|
34
|
|
|
|
|
35
|
|
|
function it_is_a_success() |
|
36
|
|
|
{ |
|
37
|
|
|
$this->shouldBeSuccess(); |
|
38
|
|
|
} |
|
39
|
|
|
|
|
40
|
|
|
function it_contains_content() |
|
41
|
|
|
{ |
|
42
|
|
|
$this->getContent()->shouldReturn('foobar'); |
|
43
|
|
|
} |
|
44
|
|
|
|
|
45
|
|
|
function it_can_truncated_content(OutcomeInterface $outcome) |
|
46
|
|
|
{ |
|
47
|
|
|
$this->beConstructedWith($outcome, '12345678901234567890'); |
|
48
|
|
|
$this->getTruncatedContent(10)->shouldReturn('1234567...'); |
|
49
|
|
|
} |
|
50
|
|
|
|
|
51
|
|
|
function it_does_not_truncate_short_content(OutcomeInterface $outcome) |
|
52
|
|
|
{ |
|
53
|
|
|
$this->beConstructedWith($outcome, '1234567890'); |
|
54
|
|
|
$this->getTruncatedContent(10)->shouldReturn('1234567890'); |
|
55
|
|
|
} |
|
56
|
|
|
|
|
57
|
|
|
function it_trims_truncated_content(OutcomeInterface $outcome) |
|
58
|
|
|
{ |
|
59
|
|
|
$this->beConstructedWith($outcome, ' 12345678901234567890 '); |
|
60
|
|
|
$this->getTruncatedContent(10)->shouldReturn('1234567...'); |
|
61
|
|
|
} |
|
62
|
|
|
|
|
63
|
|
|
function it_trims_short_content_on_truncate(OutcomeInterface $outcome) |
|
64
|
|
|
{ |
|
65
|
|
|
$this->beConstructedWith($outcome, ' 1234567890 '); |
|
66
|
|
|
$this->getTruncatedContent(10)->shouldReturn('1234567890'); |
|
67
|
|
|
} |
|
68
|
|
|
} |
|
69
|
|
|
|