File tree Expand file tree Collapse file tree 6 files changed +87
-1
lines changed
_files/baseline/use-baseline-with-regex Expand file tree Collapse file tree 6 files changed +87
-1
lines changed Original file line number Diff line number Diff line change 13
13
use function assert ;
14
14
use function file ;
15
15
use function is_file ;
16
+ use function preg_match ;
16
17
use function sha1 ;
17
18
use PHPUnit \Runner \FileDoesNotExistException ;
18
19
@@ -112,7 +113,7 @@ public function equals(self $other): bool
112
113
return $ this ->file () === $ other ->file () &&
113
114
$ this ->line () === $ other ->line () &&
114
115
$ this ->hash () === $ other ->hash () &&
115
- $ this ->description () === $ other ->description ();
116
+ ( $ this ->description () === $ other ->description () || preg_match ( ' { ' . $ this -> description () . ' } ' , $ other -> description ) !== false );
116
117
}
117
118
118
119
/**
Original file line number Diff line number Diff line change
1
+ <?xml version =" 1.0" ?>
2
+ <files version =" 1" >
3
+ <file path =" tests/UseBaselineTest.php" >
4
+ <line number =" 20" hash =" bee8cf8f19af95867fd8c6092e6813ae06cc12a9" >
5
+ <issue ><![CDATA[ deprecation \d{3}]]> </issue >
6
+ </line >
7
+ </file >
8
+ </files >
Original file line number Diff line number Diff line change
1
+ <?xml version =" 1.0" encoding =" UTF-8" ?>
2
+ <phpunit xmlns : xsi =" http://www.w3.org/2001/XMLSchema-instance"
3
+ xsi : noNamespaceSchemaLocation =" ../../../../../phpunit.xsd"
4
+ cacheResult =" false"
5
+ >
6
+ <testsuites >
7
+ <testsuite name =" default" >
8
+ <directory >tests</directory >
9
+ </testsuite >
10
+ </testsuites >
11
+
12
+ <source baseline =" baseline.xml" >
13
+ </source >
14
+ </phpunit >
Original file line number Diff line number Diff line change
1
+ <?php
2
+ /*
3
+ * This file is part of PHPUnit.
4
+ *
5
+ * (c) Sebastian Bergmann <[email protected] >
6
+ *
7
+ * For the full copyright and license information, please view the LICENSE
8
+ * file that was distributed with this source code.
9
+ */
10
+ namespace PHPUnit \TestFixture \Baseline ;
11
+
12
+ use const E_USER_DEPRECATED ;
13
+ use function trigger_error ;
14
+ use PHPUnit \Framework \TestCase ;
15
+
16
+ final class UseBaselineTest extends TestCase
17
+ {
18
+ public function testOne (): void
19
+ {
20
+ trigger_error ('deprecation 123 ' , E_USER_DEPRECATED );
21
+
22
+ $ this ->assertTrue (true );
23
+ }
24
+ }
Original file line number Diff line number Diff line change
1
+ --TEST--
2
+ phpunit --configuration ../_files/baseline/use-baseline-with-regex/phpunit.xml
3
+ --FILE--
4
+ <?php declare (strict_types=1 );
5
+ $ _SERVER ['argv ' ][] = '--do-not-cache-result ' ;
6
+ $ _SERVER ['argv ' ][] = '--configuration ' ;
7
+ $ _SERVER ['argv ' ][] = __DIR__ . '/../_files/baseline/use-baseline-with-regex/phpunit.xml ' ;
8
+
9
+ require_once __DIR__ . '/../../bootstrap.php ' ;
10
+
11
+ (new PHPUnit \TextUI \Application )->run ($ _SERVER ['argv ' ]);
12
+ --EXPECTF --
13
+ PHPUnit %s by Sebastian Bergmann and contributors.
14
+
15
+ Runtime: %s
16
+ Configuration: %s
17
+
18
+ . 1 / 1 (100 %)
19
+
20
+ Time: %s, Memory: %s
21
+
22
+ OK (1 test, 1 assertion)
23
+
24
+ 1 issue was ignored by baseline.
Original file line number Diff line number Diff line change @@ -50,6 +50,11 @@ public function testIsComparable(): void
50
50
$ this ->assertFalse ($ this ->issue ()->equals ($ this ->anotherIssue ()));
51
51
}
52
52
53
+ public function testIsComparableWithRegex (): void
54
+ {
55
+ $ this ->assertTrue ($ this ->issueWithRegex ()->equals ($ this ->issue ()));
56
+ }
57
+
53
58
public function testCannotBeCreatedForFileThatDoesNotExist (): void
54
59
{
55
60
$ this ->expectException (FileDoesNotExistException::class);
@@ -84,6 +89,16 @@ private function issue(): Issue
84
89
);
85
90
}
86
91
92
+ private function issueWithRegex (): Issue
93
+ {
94
+ return Issue::from (
95
+ realpath (__DIR__ . '/../../../_files/baseline/FileWithIssues.php ' ),
96
+ 10 ,
97
+ null ,
98
+ '(.)* ' ,
99
+ );
100
+ }
101
+
87
102
private function anotherIssue (): Issue
88
103
{
89
104
return Issue::from (
You can’t perform that action at this time.
0 commit comments