Skip to content

Commit 4ff1d2e

Browse files
committed
Merge branch '4.4' into 5.1
* 4.4: Use ::class keyword when possible
2 parents 03901f1 + a27af3b commit 4ff1d2e

File tree

1 file changed

+19
-19
lines changed

1 file changed

+19
-19
lines changed

Tests/FilesystemTest.php

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public function testCopyCreatesNewFile()
3333

3434
public function testCopyFails()
3535
{
36-
$this->expectException('Symfony\Component\Filesystem\Exception\IOException');
36+
$this->expectException(IOException::class);
3737
$sourceFilePath = $this->workspace.\DIRECTORY_SEPARATOR.'copy_source_file';
3838
$targetFilePath = $this->workspace.\DIRECTORY_SEPARATOR.'copy_target_file';
3939

@@ -42,7 +42,7 @@ public function testCopyFails()
4242

4343
public function testCopyUnreadableFileFails()
4444
{
45-
$this->expectException('Symfony\Component\Filesystem\Exception\IOException');
45+
$this->expectException(IOException::class);
4646
// skip test on Windows; PHP can't easily set file as unreadable on Windows
4747
if ('\\' === \DIRECTORY_SEPARATOR) {
4848
$this->markTestSkipped('This test cannot run on Windows.');
@@ -118,7 +118,7 @@ public function testCopyOverridesExistingFileIfForced()
118118

119119
public function testCopyWithOverrideWithReadOnlyTargetFails()
120120
{
121-
$this->expectException('Symfony\Component\Filesystem\Exception\IOException');
121+
$this->expectException(IOException::class);
122122
// skip test on Windows; PHP can't easily set file as unwritable on Windows
123123
if ('\\' === \DIRECTORY_SEPARATOR) {
124124
$this->markTestSkipped('This test cannot run on Windows.');
@@ -220,7 +220,7 @@ public function testMkdirCreatesDirectoriesFromTraversableObject()
220220

221221
public function testMkdirCreatesDirectoriesFails()
222222
{
223-
$this->expectException('Symfony\Component\Filesystem\Exception\IOException');
223+
$this->expectException(IOException::class);
224224
$basePath = $this->workspace.\DIRECTORY_SEPARATOR;
225225
$dir = $basePath.'2';
226226

@@ -240,7 +240,7 @@ public function testTouchCreatesEmptyFile()
240240

241241
public function testTouchFails()
242242
{
243-
$this->expectException('Symfony\Component\Filesystem\Exception\IOException');
243+
$this->expectException(IOException::class);
244244
$file = $this->workspace.\DIRECTORY_SEPARATOR.'1'.\DIRECTORY_SEPARATOR.'2';
245245

246246
$this->filesystem->touch($file);
@@ -396,7 +396,7 @@ public function testFilesExists()
396396

397397
public function testFilesExistsFails()
398398
{
399-
$this->expectException('Symfony\Component\Filesystem\Exception\IOException');
399+
$this->expectException(IOException::class);
400400
if ('\\' !== \DIRECTORY_SEPARATOR) {
401401
$this->markTestSkipped('Long file names are an issue on Windows');
402402
}
@@ -637,7 +637,7 @@ public function testChownLink()
637637

638638
public function testChownSymlinkFails()
639639
{
640-
$this->expectException('Symfony\Component\Filesystem\Exception\IOException');
640+
$this->expectException(IOException::class);
641641
$this->markAsSkippedIfSymlinkIsMissing();
642642

643643
$file = $this->workspace.\DIRECTORY_SEPARATOR.'file';
@@ -652,7 +652,7 @@ public function testChownSymlinkFails()
652652

653653
public function testChownLinkFails()
654654
{
655-
$this->expectException('Symfony\Component\Filesystem\Exception\IOException');
655+
$this->expectException(IOException::class);
656656
$this->markAsSkippedIfLinkIsMissing();
657657

658658
$file = $this->workspace.\DIRECTORY_SEPARATOR.'file';
@@ -667,7 +667,7 @@ public function testChownLinkFails()
667667

668668
public function testChownFail()
669669
{
670-
$this->expectException('Symfony\Component\Filesystem\Exception\IOException');
670+
$this->expectException(IOException::class);
671671
$this->markAsSkippedIfPosixIsMissing();
672672

673673
$dir = $this->workspace.\DIRECTORY_SEPARATOR.'dir';
@@ -770,7 +770,7 @@ public function testChgrpLink()
770770

771771
public function testChgrpSymlinkFails()
772772
{
773-
$this->expectException('Symfony\Component\Filesystem\Exception\IOException');
773+
$this->expectException(IOException::class);
774774
$this->markAsSkippedIfSymlinkIsMissing();
775775

776776
$file = $this->workspace.\DIRECTORY_SEPARATOR.'file';
@@ -785,7 +785,7 @@ public function testChgrpSymlinkFails()
785785

786786
public function testChgrpLinkFails()
787787
{
788-
$this->expectException('Symfony\Component\Filesystem\Exception\IOException');
788+
$this->expectException(IOException::class);
789789
$this->markAsSkippedIfLinkIsMissing();
790790

791791
$file = $this->workspace.\DIRECTORY_SEPARATOR.'file';
@@ -800,7 +800,7 @@ public function testChgrpLinkFails()
800800

801801
public function testChgrpFail()
802802
{
803-
$this->expectException('Symfony\Component\Filesystem\Exception\IOException');
803+
$this->expectException(IOException::class);
804804
$this->markAsSkippedIfPosixIsMissing();
805805

806806
$dir = $this->workspace.\DIRECTORY_SEPARATOR.'dir';
@@ -823,7 +823,7 @@ public function testRename()
823823

824824
public function testRenameThrowsExceptionIfTargetAlreadyExists()
825825
{
826-
$this->expectException('Symfony\Component\Filesystem\Exception\IOException');
826+
$this->expectException(IOException::class);
827827
$file = $this->workspace.\DIRECTORY_SEPARATOR.'file';
828828
$newPath = $this->workspace.\DIRECTORY_SEPARATOR.'new_file';
829829

@@ -849,7 +849,7 @@ public function testRenameOverwritesTheTargetIfItAlreadyExists()
849849

850850
public function testRenameThrowsExceptionOnError()
851851
{
852-
$this->expectException('Symfony\Component\Filesystem\Exception\IOException');
852+
$this->expectException(IOException::class);
853853
$file = $this->workspace.\DIRECTORY_SEPARATOR.uniqid('fs_test_', true);
854854
$newPath = $this->workspace.\DIRECTORY_SEPARATOR.'new_file';
855855

@@ -1194,14 +1194,14 @@ public function providePathsForMakePathRelative()
11941194

11951195
public function testMakePathRelativeWithRelativeStartPath()
11961196
{
1197-
$this->expectException('Symfony\Component\Filesystem\Exception\InvalidArgumentException');
1197+
$this->expectException(\Symfony\Component\Filesystem\Exception\InvalidArgumentException::class);
11981198
$this->expectExceptionMessage('The start path "var/lib/symfony/src/Symfony/Component" is not absolute.');
11991199
$this->assertSame('../../../', $this->filesystem->makePathRelative('/var/lib/symfony/', 'var/lib/symfony/src/Symfony/Component'));
12001200
}
12011201

12021202
public function testMakePathRelativeWithRelativeEndPath()
12031203
{
1204-
$this->expectException('Symfony\Component\Filesystem\Exception\InvalidArgumentException');
1204+
$this->expectException(\Symfony\Component\Filesystem\Exception\InvalidArgumentException::class);
12051205
$this->expectExceptionMessage('The end path "var/lib/symfony/" is not absolute.');
12061206
$this->assertSame('../../../', $this->filesystem->makePathRelative('var/lib/symfony/', '/var/lib/symfony/src/Symfony/Component'));
12071207
}
@@ -1475,7 +1475,7 @@ public function testTempnamWithMockScheme()
14751475

14761476
public function testTempnamWithZlibSchemeFails()
14771477
{
1478-
$this->expectException('Symfony\Component\Filesystem\Exception\IOException');
1478+
$this->expectException(IOException::class);
14791479
$scheme = 'compress.zlib://';
14801480
$dirname = $scheme.$this->workspace;
14811481

@@ -1498,7 +1498,7 @@ public function testTempnamWithPHPTempSchemeFails()
14981498

14991499
public function testTempnamWithPharSchemeFails()
15001500
{
1501-
$this->expectException('Symfony\Component\Filesystem\Exception\IOException');
1501+
$this->expectException(IOException::class);
15021502
// Skip test if Phar disabled phar.readonly must be 0 in php.ini
15031503
if (!\Phar::canWrite()) {
15041504
$this->markTestSkipped('This test cannot run when phar.readonly is 1.');
@@ -1515,7 +1515,7 @@ public function testTempnamWithPharSchemeFails()
15151515

15161516
public function testTempnamWithHTTPSchemeFails()
15171517
{
1518-
$this->expectException('Symfony\Component\Filesystem\Exception\IOException');
1518+
$this->expectException(IOException::class);
15191519
$scheme = 'http://';
15201520
$dirname = $scheme.$this->workspace;
15211521

0 commit comments

Comments
 (0)