@@ -93,9 +93,9 @@ public function testGetHeaderLine()
9393
9494 $ message = $ this ->getMessage ()->withAddedHeader ('content-type ' , 'text/html ' );
9595 $ message = $ message ->withAddedHeader ('content-type ' , 'text/plain ' );
96- $ this ->assertRegExp ('|text/html, ?text/plain| ' , $ message ->getHeaderLine ('content-type ' ));
97- $ this ->assertRegExp ('|text/html, ?text/plain| ' , $ message ->getHeaderLine ('Content-Type ' ));
98- $ this ->assertRegExp ('|text/html, ?text/plain| ' , $ message ->getHeaderLine ('CONTENT-TYPE ' ));
96+ $ this ->assertMatchesRegexp ('|text/html, ?text/plain| ' , $ message ->getHeaderLine ('content-type ' ));
97+ $ this ->assertMatchesRegexp ('|text/html, ?text/plain| ' , $ message ->getHeaderLine ('Content-Type ' ));
98+ $ this ->assertMatchesRegexp ('|text/html, ?text/plain| ' , $ message ->getHeaderLine ('CONTENT-TYPE ' ));
9999
100100 $ this ->assertSame ('' , $ message ->getHeaderLine ('Bar ' ));
101101 }
@@ -121,7 +121,7 @@ public function testWithHeader()
121121 $ this ->assertEquals ('text/script ' , $ message ->getHeaderLine ('content-type ' ));
122122
123123 $ message = $ initialMessage ->withHeader ('x-foo ' , ['bar ' , 'baz ' ]);
124- $ this ->assertRegExp ('|bar, ?baz| ' , $ message ->getHeaderLine ('x-foo ' ));
124+ $ this ->assertMatchesRegexp ('|bar, ?baz| ' , $ message ->getHeaderLine ('x-foo ' ));
125125
126126 $ message = $ initialMessage ->withHeader ('Bar ' , '' );
127127 $ this ->assertTrue ($ message ->hasHeader ('Bar ' ));
@@ -162,8 +162,8 @@ public function testWithAddedHeader()
162162
163163 $ message = $ this ->getMessage ()->withAddedHeader ('content-type ' , 'text/html ' );
164164 $ message = $ message ->withAddedHeader ('CONTENT-type ' , 'text/plain ' );
165- $ this ->assertRegExp ('|text/html, ?text/plain| ' , $ message ->getHeaderLine ('content-type ' ));
166- $ this ->assertRegExp ('|text/html, ?text/plain| ' , $ message ->getHeaderLine ('Content-Type ' ));
165+ $ this ->assertMatchesRegexp ('|text/html, ?text/plain| ' , $ message ->getHeaderLine ('content-type ' ));
166+ $ this ->assertMatchesRegexp ('|text/html, ?text/plain| ' , $ message ->getHeaderLine ('Content-Type ' ));
167167 }
168168
169169 /**
@@ -192,9 +192,9 @@ public function testWithAddedHeaderArrayValue()
192192 $ message = $ message ->withAddedHeader ('content-type ' , ['text/plain ' , 'application/json ' ]);
193193
194194 $ headerLine = $ message ->getHeaderLine ('content-type ' );
195- $ this ->assertRegExp ('|text/html| ' , $ headerLine );
196- $ this ->assertRegExp ('|text/plain| ' , $ headerLine );
197- $ this ->assertRegExp ('|application/json| ' , $ headerLine );
195+ $ this ->assertMatchesRegexp ('|text/html| ' , $ headerLine );
196+ $ this ->assertMatchesRegexp ('|text/plain| ' , $ headerLine );
197+ $ this ->assertMatchesRegexp ('|application/json| ' , $ headerLine );
198198 }
199199
200200 /**
@@ -210,9 +210,9 @@ public function testWithAddedHeaderArrayValueAndKeys()
210210 $ message = $ message ->withAddedHeader ('content-type ' , ['foo ' => 'text/plain ' , 'bar ' => 'application/json ' ]);
211211
212212 $ headerLine = $ message ->getHeaderLine ('content-type ' );
213- $ this ->assertRegExp ('|text/html| ' , $ headerLine );
214- $ this ->assertRegExp ('|text/plain| ' , $ headerLine );
215- $ this ->assertRegExp ('|application/json| ' , $ headerLine );
213+ $ this ->assertMatchesRegexp ('|text/html| ' , $ headerLine );
214+ $ this ->assertMatchesRegexp ('|text/plain| ' , $ headerLine );
215+ $ this ->assertMatchesRegexp ('|application/json| ' , $ headerLine );
216216 }
217217
218218 public function testWithoutHeader ()
@@ -251,4 +251,14 @@ public function testBody()
251251
252252 $ this ->assertEquals ($ stream , $ message ->getBody ());
253253 }
254+
255+ private function assertMatchesRegexp (string $ pattern , string $ string , string $ message = '' ): void
256+ {
257+ // @TODO remove when package require phpunit 9.1
258+ if (function_exists ('PHPUnit\Framework\assertMatchesRegularExpression ' )) {
259+ $ this ->assertMatchesRegularExpression ($ pattern , $ string , $ message );
260+ } else {
261+ $ this ->assertRegExp ($ pattern , $ string , $ message );
262+ }
263+ }
254264}
0 commit comments