Skip to content

Commit 5b924ef

Browse files
committed
stop using deprecated PHPUnit APIs
1 parent cb00d72 commit 5b924ef

File tree

5 files changed

+9
-9
lines changed

5 files changed

+9
-9
lines changed

Tests/Encoder/Base64EncoderTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,17 +65,17 @@ public function testPadLength()
6565
$encoder = new Base64Encoder();
6666
for ($i = 0; $i < 30; ++$i) {
6767
$input = pack('C', random_int(0, 255));
68-
$this->assertRegExp('~^[a-zA-Z0-9/\+]{2}==$~', $encoder->encodeString($input), 'A single byte should have 2 bytes of padding');
68+
$this->assertMatchesRegularExpression('~^[a-zA-Z0-9/\+]{2}==$~', $encoder->encodeString($input), 'A single byte should have 2 bytes of padding');
6969
}
7070

7171
for ($i = 0; $i < 30; ++$i) {
7272
$input = pack('C*', random_int(0, 255), random_int(0, 255));
73-
$this->assertRegExp('~^[a-zA-Z0-9/\+]{3}=$~', $encoder->encodeString($input), 'Two bytes should have 1 byte of padding');
73+
$this->assertMatchesRegularExpression('~^[a-zA-Z0-9/\+]{3}=$~', $encoder->encodeString($input), 'Two bytes should have 1 byte of padding');
7474
}
7575

7676
for ($i = 0; $i < 30; ++$i) {
7777
$input = pack('C*', random_int(0, 255), random_int(0, 255), random_int(0, 255));
78-
$this->assertRegExp('~^[a-zA-Z0-9/\+]{4}$~', $encoder->encodeString($input), 'Three bytes should have no padding');
78+
$this->assertMatchesRegularExpression('~^[a-zA-Z0-9/\+]{4}$~', $encoder->encodeString($input), 'Three bytes should have no padding');
7979
}
8080
}
8181

Tests/Encoder/QpMimeHeaderEncoderTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public function testSpaceAndTabNeverAppear()
3131
*/
3232

3333
$encoder = new QpMimeHeaderEncoder();
34-
$this->assertNotRegExp('~[ \t]~', $encoder->encodeString("a \t b"), 'encoded-words in headers cannot contain LWSP as per RFC 2047.');
34+
$this->assertDoesNotMatchRegularExpression('~[ \t]~', $encoder->encodeString("a \t b"), 'encoded-words in headers cannot contain LWSP as per RFC 2047.');
3535
}
3636

3737
public function testSpaceIsRepresentedByUnderscore()

Tests/Encoder/Rfc2231EncoderTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public function testEncodingAsciiCharactersProducesValidToken()
3838
$encoded = $encoder->encodeString($string);
3939

4040
foreach (explode("\r\n", $encoded) as $line) {
41-
$this->assertRegExp($this->rfc2045Token, $line, 'Encoder should always return a valid RFC 2045 token.');
41+
$this->assertMatchesRegularExpression($this->rfc2045Token, $line, 'Encoder should always return a valid RFC 2045 token.');
4242
}
4343
}
4444

@@ -53,7 +53,7 @@ public function testEncodingNonAsciiCharactersProducesValidToken()
5353
$encoded = $encoder->encodeString($string);
5454

5555
foreach (explode("\r\n", $encoded) as $line) {
56-
$this->assertRegExp($this->rfc2045Token, $line, 'Encoder should always return a valid RFC 2045 token.');
56+
$this->assertMatchesRegularExpression($this->rfc2045Token, $line, 'Encoder should always return a valid RFC 2045 token.');
5757
}
5858
}
5959

Tests/Header/UnstructuredHeaderTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ public function testPrintableAsciiOnlyAppearsInHeaders()
7878

7979
$nonAsciiChar = pack('C', 0x8F);
8080
$header = new UnstructuredHeader('X-Test', $nonAsciiChar);
81-
$this->assertRegExp('~^[^:\x00-\x20\x80-\xFF]+: [^\x80-\xFF\r\n]+$~s', $header->toString());
81+
$this->assertMatchesRegularExpression('~^[^:\x00-\x20\x80-\xFF]+: [^\x80-\xFF\r\n]+$~s', $header->toString());
8282
}
8383

8484
public function testEncodedWordsFollowGeneralStructure()
@@ -91,7 +91,7 @@ public function testEncodedWordsFollowGeneralStructure()
9191

9292
$nonAsciiChar = pack('C', 0x8F);
9393
$header = new UnstructuredHeader('X-Test', $nonAsciiChar);
94-
$this->assertRegExp('~^X-Test: \=?.*?\?.*?\?.*?\?=$~s', $header->toString());
94+
$this->assertMatchesRegularExpression('~^X-Test: \=?.*?\?.*?\?.*?\?=$~s', $header->toString());
9595
}
9696

9797
public function testEncodedWordIncludesCharsetAndEncodingMethodAndText()

Tests/Part/Multipart/FormDataPartTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ public function testBoundaryContentTypeHeader()
9898
'file' => new DataPart('data.csv', 'data.csv', 'text/csv'),
9999
]);
100100
$headers = $f->getPreparedHeaders()->toArray();
101-
$this->assertRegExp(
101+
$this->assertMatchesRegularExpression(
102102
'/^Content-Type: multipart\/form-data; boundary=[a-zA-Z0-9\-_]{8}$/',
103103
$headers[0]
104104
);

0 commit comments

Comments
 (0)