1
0
mirror of https://github.com/danog/file.git synced 2024-11-30 04:19:39 +01:00

Fix failing testMkdirRmdir

This commit is contained in:
Niklas Keller 2017-06-17 15:36:51 +02:00
parent e6f3661e62
commit 7a96e10a35

View File

@ -20,7 +20,7 @@ abstract class DriverTest extends TestCase {
public function testScandir() { public function testScandir() {
$this->execute(function () { $this->execute(function () {
$fixtureDir = Fixture::path(); $fixtureDir = Fixture::path();
$actual = (yield File\scandir($fixtureDir)); $actual = yield File\scandir($fixtureDir);
$expected = ["dir", "small.txt"]; $expected = ["dir", "small.txt"];
$this->assertSame($expected, $actual); $this->assertSame($expected, $actual);
}); });
@ -101,6 +101,13 @@ abstract class DriverTest extends TestCase {
}); });
} }
public function testGet() {
$this->execute(function () {
$fixtureDir = Fixture::path();
$this->assertSame("small", yield File\get("{$fixtureDir}/small.txt"));
});
}
public function testSize() { public function testSize() {
$this->execute(function () { $this->execute(function () {
$fixtureDir = Fixture::path(); $fixtureDir = Fixture::path();
@ -219,7 +226,7 @@ abstract class DriverTest extends TestCase {
yield File\mkdir($dir); yield File\mkdir($dir);
$stat = yield File\stat($dir); $stat = yield File\stat($dir);
$this->assertTrue(($stat["mode"] & 0777) === 0644); $this->assertSame(0644, $stat["mode"] & 0777);
yield File\rmdir($dir); yield File\rmdir($dir);
$this->assertNull(yield File\stat($dir)); $this->assertNull(yield File\stat($dir));
@ -227,7 +234,7 @@ abstract class DriverTest extends TestCase {
yield File\mkdir($dir, 0764, true); // the umask is 022 by default yield File\mkdir($dir, 0764, true); // the umask is 022 by default
$stat = yield File\stat($dir); $stat = yield File\stat($dir);
$this->assertTrue(($stat["mode"] & 0777) == 0744); $this->assertSame(0764, $stat["mode"] & 0777);
}); });
} }