Completed
Push — master ( 4eb33b...9d87b5 )
by Marco
11s queued 10s
created

ChangeTest::testSkippedDueToFailure()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 9
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 7
nc 1
nop 0
dl 0
loc 9
rs 10
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace RoaveTest\BackwardCompatibility;
6
7
use Exception;
8
use PHPUnit\Framework\TestCase;
9
use Roave\BackwardCompatibility\Change;
10
use function uniqid;
11
12
/**
13
 * @covers \Roave\BackwardCompatibility\Change
14
 */
15
final class ChangeTest extends TestCase
16
{
17
    public function testAdded() : void
18
    {
19
        $changeText = uniqid('changeText', true);
20
        $change     = Change::added($changeText, false);
21
        self::assertSame('     ADDED: ' . $changeText, (string) $change);
0 ignored issues
show
Bug introduced by
' ADDED: ' . $changeText of type string is incompatible with the type PHPUnit\Framework\T expected by parameter $expected of PHPUnit\Framework\Assert::assertSame(). ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

21
        self::assertSame(/** @scrutinizer ignore-type */ '     ADDED: ' . $changeText, (string) $change);
Loading history...
Bug Best Practice introduced by
The method PHPUnit\Framework\Assert::assertSame() is not static, but was called statically. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

21
        self::/** @scrutinizer ignore-call */ 
22
              assertSame('     ADDED: ' . $changeText, (string) $change);
Loading history...
22
        self::assertTrue($change->isAdded());
23
        self::assertFalse($change->isChanged());
24
        self::assertFalse($change->isRemoved());
25
        self::assertFalse($change->isSkipped());
26
    }
27
28
    public function testBcAdded() : void
29
    {
30
        $changeText = uniqid('changeText', true);
31
        $change     = Change::added($changeText, true);
32
        self::assertSame('[BC] ADDED: ' . $changeText, (string) $change);
0 ignored issues
show
Bug Best Practice introduced by
The method PHPUnit\Framework\Assert::assertSame() is not static, but was called statically. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

32
        self::/** @scrutinizer ignore-call */ 
33
              assertSame('[BC] ADDED: ' . $changeText, (string) $change);
Loading history...
Bug introduced by
'[BC] ADDED: ' . $changeText of type string is incompatible with the type PHPUnit\Framework\T expected by parameter $expected of PHPUnit\Framework\Assert::assertSame(). ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

32
        self::assertSame(/** @scrutinizer ignore-type */ '[BC] ADDED: ' . $changeText, (string) $change);
Loading history...
33
        self::assertTrue($change->isAdded());
34
        self::assertFalse($change->isChanged());
35
        self::assertFalse($change->isRemoved());
36
        self::assertFalse($change->isSkipped());
37
    }
38
39
    public function testChanged() : void
40
    {
41
        $changeText = uniqid('changeText', true);
42
        $change     = Change::changed($changeText, false);
43
        self::assertSame('     CHANGED: ' . $changeText, (string) $change);
0 ignored issues
show
Bug introduced by
' CHANGED: ' . $changeText of type string is incompatible with the type PHPUnit\Framework\T expected by parameter $expected of PHPUnit\Framework\Assert::assertSame(). ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

43
        self::assertSame(/** @scrutinizer ignore-type */ '     CHANGED: ' . $changeText, (string) $change);
Loading history...
Bug Best Practice introduced by
The method PHPUnit\Framework\Assert::assertSame() is not static, but was called statically. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

43
        self::/** @scrutinizer ignore-call */ 
44
              assertSame('     CHANGED: ' . $changeText, (string) $change);
Loading history...
44
        self::assertFalse($change->isAdded());
45
        self::assertTrue($change->isChanged());
46
        self::assertFalse($change->isRemoved());
47
    }
48
49
    public function testBcChanged() : void
50
    {
51
        $changeText = uniqid('changeText', true);
52
        $change     = Change::changed($changeText, true);
53
        self::assertSame('[BC] CHANGED: ' . $changeText, (string) $change);
0 ignored issues
show
Bug Best Practice introduced by
The method PHPUnit\Framework\Assert::assertSame() is not static, but was called statically. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

53
        self::/** @scrutinizer ignore-call */ 
54
              assertSame('[BC] CHANGED: ' . $changeText, (string) $change);
Loading history...
Bug introduced by
'[BC] CHANGED: ' . $changeText of type string is incompatible with the type PHPUnit\Framework\T expected by parameter $expected of PHPUnit\Framework\Assert::assertSame(). ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

53
        self::assertSame(/** @scrutinizer ignore-type */ '[BC] CHANGED: ' . $changeText, (string) $change);
Loading history...
54
        self::assertFalse($change->isAdded());
55
        self::assertTrue($change->isChanged());
56
        self::assertFalse($change->isRemoved());
57
        self::assertFalse($change->isSkipped());
58
    }
59
60
    public function testRemoved() : void
61
    {
62
        $changeText = uniqid('changeText', true);
63
        $change     = Change::removed($changeText, false);
64
        self::assertSame('     REMOVED: ' . $changeText, (string) $change);
0 ignored issues
show
Bug Best Practice introduced by
The method PHPUnit\Framework\Assert::assertSame() is not static, but was called statically. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

64
        self::/** @scrutinizer ignore-call */ 
65
              assertSame('     REMOVED: ' . $changeText, (string) $change);
Loading history...
Bug introduced by
' REMOVED: ' . $changeText of type string is incompatible with the type PHPUnit\Framework\T expected by parameter $expected of PHPUnit\Framework\Assert::assertSame(). ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

64
        self::assertSame(/** @scrutinizer ignore-type */ '     REMOVED: ' . $changeText, (string) $change);
Loading history...
65
        self::assertFalse($change->isAdded());
66
        self::assertFalse($change->isChanged());
67
        self::assertTrue($change->isRemoved());
68
        self::assertFalse($change->isSkipped());
69
    }
70
71
    public function testBcRemoved() : void
72
    {
73
        $changeText = uniqid('changeText', true);
74
        $change     = Change::removed($changeText, true);
75
        self::assertSame('[BC] REMOVED: ' . $changeText, (string) $change);
0 ignored issues
show
Bug introduced by
'[BC] REMOVED: ' . $changeText of type string is incompatible with the type PHPUnit\Framework\T expected by parameter $expected of PHPUnit\Framework\Assert::assertSame(). ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

75
        self::assertSame(/** @scrutinizer ignore-type */ '[BC] REMOVED: ' . $changeText, (string) $change);
Loading history...
Bug Best Practice introduced by
The method PHPUnit\Framework\Assert::assertSame() is not static, but was called statically. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

75
        self::/** @scrutinizer ignore-call */ 
76
              assertSame('[BC] REMOVED: ' . $changeText, (string) $change);
Loading history...
76
        self::assertFalse($change->isAdded());
77
        self::assertFalse($change->isChanged());
78
        self::assertTrue($change->isRemoved());
79
        self::assertFalse($change->isSkipped());
80
    }
81
82
    public function testSkippedDueToFailure() : void
83
    {
84
        $failure = new Exception('changeText');
85
        $change  = Change::skippedDueToFailure($failure);
86
        self::assertSame('[BC] SKIPPED: ' . $failure->getMessage(), (string) $change);
0 ignored issues
show
Bug introduced by
'[BC] SKIPPED: ' . $failure->getMessage() of type string is incompatible with the type PHPUnit\Framework\T expected by parameter $expected of PHPUnit\Framework\Assert::assertSame(). ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

86
        self::assertSame(/** @scrutinizer ignore-type */ '[BC] SKIPPED: ' . $failure->getMessage(), (string) $change);
Loading history...
Bug Best Practice introduced by
The method PHPUnit\Framework\Assert::assertSame() is not static, but was called statically. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

86
        self::/** @scrutinizer ignore-call */ 
87
              assertSame('[BC] SKIPPED: ' . $failure->getMessage(), (string) $change);
Loading history...
87
        self::assertFalse($change->isAdded());
88
        self::assertFalse($change->isChanged());
89
        self::assertFalse($change->isRemoved());
90
        self::assertTrue($change->isSkipped());
91
    }
92
}
93