Skip to content

Commit a27af3b

Browse files
committed
Use ::class keyword when possible
1 parent 5dfa00b commit a27af3b

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
}
@@ -623,7 +623,7 @@ public function testChownLink()
623623

624624
public function testChownSymlinkFails()
625625
{
626-
$this->expectException('Symfony\Component\Filesystem\Exception\IOException');
626+
$this->expectException(IOException::class);
627627
$this->markAsSkippedIfSymlinkIsMissing();
628628

629629
$file = $this->workspace.\DIRECTORY_SEPARATOR.'file';
@@ -638,7 +638,7 @@ public function testChownSymlinkFails()
638638

639639
public function testChownLinkFails()
640640
{
641-
$this->expectException('Symfony\Component\Filesystem\Exception\IOException');
641+
$this->expectException(IOException::class);
642642
$this->markAsSkippedIfLinkIsMissing();
643643

644644
$file = $this->workspace.\DIRECTORY_SEPARATOR.'file';
@@ -653,7 +653,7 @@ public function testChownLinkFails()
653653

654654
public function testChownFail()
655655
{
656-
$this->expectException('Symfony\Component\Filesystem\Exception\IOException');
656+
$this->expectException(IOException::class);
657657
$this->markAsSkippedIfPosixIsMissing();
658658

659659
$dir = $this->workspace.\DIRECTORY_SEPARATOR.'dir';
@@ -726,7 +726,7 @@ public function testChgrpLink()
726726

727727
public function testChgrpSymlinkFails()
728728
{
729-
$this->expectException('Symfony\Component\Filesystem\Exception\IOException');
729+
$this->expectException(IOException::class);
730730
$this->markAsSkippedIfSymlinkIsMissing();
731731

732732
$file = $this->workspace.\DIRECTORY_SEPARATOR.'file';
@@ -741,7 +741,7 @@ public function testChgrpSymlinkFails()
741741

742742
public function testChgrpLinkFails()
743743
{
744-
$this->expectException('Symfony\Component\Filesystem\Exception\IOException');
744+
$this->expectException(IOException::class);
745745
$this->markAsSkippedIfLinkIsMissing();
746746

747747
$file = $this->workspace.\DIRECTORY_SEPARATOR.'file';
@@ -756,7 +756,7 @@ public function testChgrpLinkFails()
756756

757757
public function testChgrpFail()
758758
{
759-
$this->expectException('Symfony\Component\Filesystem\Exception\IOException');
759+
$this->expectException(IOException::class);
760760
$this->markAsSkippedIfPosixIsMissing();
761761

762762
$dir = $this->workspace.\DIRECTORY_SEPARATOR.'dir';
@@ -779,7 +779,7 @@ public function testRename()
779779

780780
public function testRenameThrowsExceptionIfTargetAlreadyExists()
781781
{
782-
$this->expectException('Symfony\Component\Filesystem\Exception\IOException');
782+
$this->expectException(IOException::class);
783783
$file = $this->workspace.\DIRECTORY_SEPARATOR.'file';
784784
$newPath = $this->workspace.\DIRECTORY_SEPARATOR.'new_file';
785785

@@ -805,7 +805,7 @@ public function testRenameOverwritesTheTargetIfItAlreadyExists()
805805

806806
public function testRenameThrowsExceptionOnError()
807807
{
808-
$this->expectException('Symfony\Component\Filesystem\Exception\IOException');
808+
$this->expectException(IOException::class);
809809
$file = $this->workspace.\DIRECTORY_SEPARATOR.uniqid('fs_test_', true);
810810
$newPath = $this->workspace.\DIRECTORY_SEPARATOR.'new_file';
811811

@@ -1150,14 +1150,14 @@ public function providePathsForMakePathRelative()
11501150

11511151
public function testMakePathRelativeWithRelativeStartPath()
11521152
{
1153-
$this->expectException('Symfony\Component\Filesystem\Exception\InvalidArgumentException');
1153+
$this->expectException(\Symfony\Component\Filesystem\Exception\InvalidArgumentException::class);
11541154
$this->expectExceptionMessage('The start path "var/lib/symfony/src/Symfony/Component" is not absolute.');
11551155
$this->assertSame('../../../', $this->filesystem->makePathRelative('/var/lib/symfony/', 'var/lib/symfony/src/Symfony/Component'));
11561156
}
11571157

11581158
public function testMakePathRelativeWithRelativeEndPath()
11591159
{
1160-
$this->expectException('Symfony\Component\Filesystem\Exception\InvalidArgumentException');
1160+
$this->expectException(\Symfony\Component\Filesystem\Exception\InvalidArgumentException::class);
11611161
$this->expectExceptionMessage('The end path "var/lib/symfony/" is not absolute.');
11621162
$this->assertSame('../../../', $this->filesystem->makePathRelative('var/lib/symfony/', '/var/lib/symfony/src/Symfony/Component'));
11631163
}
@@ -1440,7 +1440,7 @@ public function testTempnamWithMockScheme()
14401440

14411441
public function testTempnamWithZlibSchemeFails()
14421442
{
1443-
$this->expectException('Symfony\Component\Filesystem\Exception\IOException');
1443+
$this->expectException(IOException::class);
14441444
$scheme = 'compress.zlib://';
14451445
$dirname = $scheme.$this->workspace;
14461446

@@ -1463,7 +1463,7 @@ public function testTempnamWithPHPTempSchemeFails()
14631463

14641464
public function testTempnamWithPharSchemeFails()
14651465
{
1466-
$this->expectException('Symfony\Component\Filesystem\Exception\IOException');
1466+
$this->expectException(IOException::class);
14671467
// Skip test if Phar disabled phar.readonly must be 0 in php.ini
14681468
if (!\Phar::canWrite()) {
14691469
$this->markTestSkipped('This test cannot run when phar.readonly is 1.');
@@ -1480,7 +1480,7 @@ public function testTempnamWithPharSchemeFails()
14801480

14811481
public function testTempnamWithHTTPSchemeFails()
14821482
{
1483-
$this->expectException('Symfony\Component\Filesystem\Exception\IOException');
1483+
$this->expectException(IOException::class);
14841484
$scheme = 'http://';
14851485
$dirname = $scheme.$this->workspace;
14861486

0 commit comments

Comments
 (0)