Skip to content

Commit fbf9d87

Browse files
committed
Refactoring tests.
1 parent bd46166 commit fbf9d87

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

Tests/FilesystemTest.php

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ public function testCopyCreatesNewFile()
2626
$this->filesystem->copy($sourceFilePath, $targetFilePath);
2727

2828
$this->assertFileExists($targetFilePath);
29-
$this->assertEquals('SOURCE FILE', file_get_contents($targetFilePath));
29+
$this->assertStringEqualsFile($targetFilePath, 'SOURCE FILE');
3030
}
3131

3232
/**
@@ -73,7 +73,7 @@ public function testCopyOverridesExistingFileIfModified()
7373
$this->filesystem->copy($sourceFilePath, $targetFilePath);
7474

7575
$this->assertFileExists($targetFilePath);
76-
$this->assertEquals('SOURCE FILE', file_get_contents($targetFilePath));
76+
$this->assertStringEqualsFile($targetFilePath, 'SOURCE FILE');
7777
}
7878

7979
public function testCopyDoesNotOverrideExistingFileByDefault()
@@ -92,7 +92,7 @@ public function testCopyDoesNotOverrideExistingFileByDefault()
9292
$this->filesystem->copy($sourceFilePath, $targetFilePath);
9393

9494
$this->assertFileExists($targetFilePath);
95-
$this->assertEquals('TARGET FILE', file_get_contents($targetFilePath));
95+
$this->assertStringEqualsFile($targetFilePath, 'TARGET FILE');
9696
}
9797

9898
public function testCopyOverridesExistingFileIfForced()
@@ -111,7 +111,7 @@ public function testCopyOverridesExistingFileIfForced()
111111
$this->filesystem->copy($sourceFilePath, $targetFilePath, true);
112112

113113
$this->assertFileExists($targetFilePath);
114-
$this->assertEquals('SOURCE FILE', file_get_contents($targetFilePath));
114+
$this->assertStringEqualsFile($targetFilePath, 'SOURCE FILE');
115115
}
116116

117117
/**
@@ -153,7 +153,7 @@ public function testCopyCreatesTargetDirectoryIfItDoesNotExist()
153153

154154
$this->assertTrue(is_dir($targetFileDirectory));
155155
$this->assertFileExists($targetFilePath);
156-
$this->assertEquals('SOURCE FILE', file_get_contents($targetFilePath));
156+
$this->assertStringEqualsFile($targetFilePath, 'SOURCE FILE');
157157
}
158158

159159
/**
@@ -772,9 +772,9 @@ public function testRemoveSymlink()
772772

773773
$this->filesystem->remove($link);
774774

775-
$this->assertTrue(!is_link($link));
776-
$this->assertTrue(!is_file($link));
777-
$this->assertTrue(!is_dir($link));
775+
$this->assertFalse(is_link($link));
776+
$this->assertFalse(is_file($link));
777+
$this->assertFalse(is_dir($link));
778778
}
779779

780780
public function testSymlinkIsOverwrittenIfPointsToDifferentTarget()
@@ -1095,7 +1095,7 @@ public function testDumpFile()
10951095
$this->filesystem->dumpFile($filename, 'bar');
10961096

10971097
$this->assertFileExists($filename);
1098-
$this->assertSame('bar', file_get_contents($filename));
1098+
$this->assertStringEqualsFile($filename, 'bar');
10991099
}
11001100

11011101
/**
@@ -1108,7 +1108,7 @@ public function testDumpFileAndSetPermissions()
11081108
$this->filesystem->dumpFile($filename, 'bar', 0753);
11091109

11101110
$this->assertFileExists($filename);
1111-
$this->assertSame('bar', file_get_contents($filename));
1111+
$this->assertStringEqualsFile($filename, 'bar');
11121112

11131113
// skip mode check on Windows
11141114
if ('\\' !== DIRECTORY_SEPARATOR) {
@@ -1123,7 +1123,7 @@ public function testDumpFileWithNullMode()
11231123
$this->filesystem->dumpFile($filename, 'bar', null);
11241124

11251125
$this->assertFileExists($filename);
1126-
$this->assertSame('bar', file_get_contents($filename));
1126+
$this->assertStringEqualsFile($filename, 'bar');
11271127

11281128
// skip mode check on Windows
11291129
if ('\\' !== DIRECTORY_SEPARATOR) {
@@ -1139,7 +1139,7 @@ public function testDumpFileOverwritesAnExistingFile()
11391139
$this->filesystem->dumpFile($filename, 'bar');
11401140

11411141
$this->assertFileExists($filename);
1142-
$this->assertSame('bar', file_get_contents($filename));
1142+
$this->assertStringEqualsFile($filename, 'bar');
11431143
}
11441144

11451145
public function testDumpKeepsExistingPermissionsWhenOverwritingAnExistingFile()

0 commit comments

Comments
 (0)