Skip to content

Commit

Permalink
Merge branch '4.4' into 5.1
Browse files Browse the repository at this point in the history
* 4.4:
  Use ::class keyword when possible
  • Loading branch information
fabpot committed Jan 11, 2021
2 parents 03901f1 + a27af3b commit 4ff1d2e
Showing 1 changed file with 19 additions and 19 deletions.
38 changes: 19 additions & 19 deletions Tests/FilesystemTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public function testCopyCreatesNewFile()

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

Expand All @@ -42,7 +42,7 @@ public function testCopyFails()

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

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

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

Expand All @@ -240,7 +240,7 @@ public function testTouchCreatesEmptyFile()

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

$this->filesystem->touch($file);
Expand Down Expand Up @@ -396,7 +396,7 @@ public function testFilesExists()

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

public function testChownSymlinkFails()
{
$this->expectException('Symfony\Component\Filesystem\Exception\IOException');
$this->expectException(IOException::class);
$this->markAsSkippedIfSymlinkIsMissing();

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

public function testChownLinkFails()
{
$this->expectException('Symfony\Component\Filesystem\Exception\IOException');
$this->expectException(IOException::class);
$this->markAsSkippedIfLinkIsMissing();

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

public function testChownFail()
{
$this->expectException('Symfony\Component\Filesystem\Exception\IOException');
$this->expectException(IOException::class);
$this->markAsSkippedIfPosixIsMissing();

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

public function testChgrpSymlinkFails()
{
$this->expectException('Symfony\Component\Filesystem\Exception\IOException');
$this->expectException(IOException::class);
$this->markAsSkippedIfSymlinkIsMissing();

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

public function testChgrpLinkFails()
{
$this->expectException('Symfony\Component\Filesystem\Exception\IOException');
$this->expectException(IOException::class);
$this->markAsSkippedIfLinkIsMissing();

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

public function testChgrpFail()
{
$this->expectException('Symfony\Component\Filesystem\Exception\IOException');
$this->expectException(IOException::class);
$this->markAsSkippedIfPosixIsMissing();

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

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

Expand All @@ -849,7 +849,7 @@ public function testRenameOverwritesTheTargetIfItAlreadyExists()

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

Expand Down Expand Up @@ -1194,14 +1194,14 @@ public function providePathsForMakePathRelative()

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

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

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

Expand All @@ -1498,7 +1498,7 @@ public function testTempnamWithPHPTempSchemeFails()

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

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

Expand Down

0 comments on commit 4ff1d2e

Please sign in to comment.