File tree Expand file tree Collapse file tree 2 files changed +13
-16
lines changed Expand file tree Collapse file tree 2 files changed +13
-16
lines changed Original file line number Diff line number Diff line change @@ -51,12 +51,12 @@ public function accept(): bool
51
51
return true ;
52
52
}
53
53
54
- $ tmp = Test::describe ($ test );
54
+ $ tmp = \ PHPUnit \ Util \ Test::describe ($ test, false );
55
55
56
56
if ($ test instanceof WarningTestCase) {
57
57
$ name = $ test ->getMessage ();
58
58
} else {
59
- if ($ tmp [0 ] != '' ) {
59
+ if ($ tmp [0 ] !== '' ) {
60
60
$ name = \implode (':: ' , $ tmp );
61
61
} else {
62
62
$ name = $ tmp [1 ];
@@ -70,7 +70,7 @@ public function accept(): bool
70
70
$ accepted = $ set >= $ this ->filterMin && $ set <= $ this ->filterMax ;
71
71
}
72
72
73
- return $ accepted ;
73
+ return ( bool ) $ accepted ;
74
74
}
75
75
76
76
/**
Original file line number Diff line number Diff line change 10
10
namespace PHPUnit \Runner \Filter ;
11
11
12
12
use PHPUnit \Framework \TestCase ;
13
+ use PHPUnit \Framework \TestSuite ;
13
14
14
15
class NameFilterIteratorTest extends TestCase
15
16
{
16
17
public function testCaseSensitiveMatch ()
17
18
{
18
- $ iterator = $ this ->getTestSuiteItteratorMock ();
19
- $ filter = new NameFilterIterator ($ iterator , 'Success ' );
20
- $ this ->assertTrue ((bool ) $ filter ->accept ());
19
+ $ this ->assertTrue ($ this ->createFilter ('BankAccountTest ' )->accept ());
21
20
}
22
21
23
22
public function testCaseInsensitiveMatch ()
24
23
{
25
- $ iterator = $ this ->getTestSuiteItteratorMock ();
26
- $ filter = new NameFilterIterator ($ iterator , 'success ' );
27
- $ this ->assertTrue ((bool ) $ filter ->accept ());
24
+ $ this ->assertTrue ($ this ->createFilter ('bankaccounttest ' )->accept ());
28
25
}
29
26
30
- /**
31
- * @return \PHPUnit\Framework\TestSuiteIterator
32
- */
33
- private function getTestSuiteItteratorMock ()
27
+ private function createFilter (string $ filter ): NameFilterIterator
34
28
{
35
- $ success = new \Success ();
36
- $ iterator = $ this ->createMock (\PHPUnit \Framework \TestSuiteIterator::class);
37
- $ iterator ->expects ($ this ->once ())->method ('current ' )->willReturn ($ success );
29
+ $ suite = new TestSuite ;
30
+ $ suite ->addTest (new \BankAccountTest ('testBalanceIsInitiallyZero ' ));
31
+
32
+ $ iterator = new NameFilterIterator ($ suite ->getIterator (), $ filter );
33
+
34
+ $ iterator ->rewind ();
38
35
39
36
return $ iterator ;
40
37
}
You can’t perform that action at this time.
0 commit comments