Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 20 additions & 20 deletions tests/Adapters/DirectoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public function testCreate(LoopInterface $loop, FilesystemInterface $filesystem)
{
$dir = $this->tmpDir . 'path';
$this->await($filesystem->dir($dir)->createRecursive(), $loop);
$this->assertTrue(file_exists($dir));
$this->assertFileExists($dir);
$this->assertSame('0760', substr(sprintf('%o', fileperms($dir)), -4));
}

Expand All @@ -80,7 +80,7 @@ public function testCreateRecursive(LoopInterface $loop, FilesystemInterface $fi
{
$dir = $this->tmpDir . 'path' . DIRECTORY_SEPARATOR . 'to' . DIRECTORY_SEPARATOR . 'reactphp' . DIRECTORY_SEPARATOR . 'filesystem';
$this->await($filesystem->dir($dir)->createRecursive(), $loop);
$this->assertTrue(file_exists($dir));
$this->assertFileExists($dir);
}

/**
Expand All @@ -90,9 +90,9 @@ public function testRemove(LoopInterface $loop, FilesystemInterface $filesystem)
{
$dir = $this->tmpDir . 'path';
mkdir($dir);
$this->assertTrue(file_exists($dir));
$this->assertFileExists($dir);
$this->await($filesystem->dir($dir)->remove(), $loop);
$this->assertFalse(file_exists($dir));
$this->assertFileNotExists($dir);
}

/**
Expand All @@ -104,11 +104,11 @@ public function testRemoveSubDir(LoopInterface $loop, FilesystemInterface $files
$subDir = $this->tmpDir . 'path' . DIRECTORY_SEPARATOR . 'sub';
mkdir($dir);
mkdir($subDir);
$this->assertTrue(file_exists($dir));
$this->assertTrue(file_exists($subDir));
$this->assertFileExists($dir);
$this->assertFileExists($subDir);
$this->await($filesystem->dir($subDir)->remove(), $loop);
$this->assertTrue(file_exists($dir));
$this->assertFalse(file_exists($subDir));
$this->assertFileExists($dir);
$this->assertFileNotExists($subDir);
}

/**
Expand All @@ -120,11 +120,11 @@ public function testRemoveRecursive(LoopInterface $loop, FilesystemInterface $fi
$subDir = $this->tmpDir . 'path' . DIRECTORY_SEPARATOR . 'sub';
mkdir($dir);
mkdir($subDir);
$this->assertTrue(file_exists($dir));
$this->assertTrue(file_exists($subDir));
$this->assertFileExists($dir);
$this->assertFileExists($subDir);
$this->await($filesystem->dir($dir)->removeRecursive(), $loop);
$this->assertFalse(file_exists($subDir));
$this->assertFalse(file_exists($dir));
$this->assertFileNotExists($subDir);
$this->assertFileNotExists($dir);
}

/**
Expand All @@ -138,8 +138,8 @@ public function testChmod(LoopInterface $loop, FilesystemInterface $filesystem)
mkdir($subDir);
chmod($dir, 0777);
chmod($subDir, 0777);
$this->assertTrue(file_exists($dir));
$this->assertTrue(file_exists($subDir));
$this->assertFileExists($dir);
$this->assertFileExists($subDir);
$this->assertSame('0777', substr(sprintf('%o', fileperms($dir)), -4));
$this->assertSame('0777', substr(sprintf('%o', fileperms($subDir)), -4));
clearstatcache();
Expand All @@ -161,8 +161,8 @@ public function testChmodRecursive(LoopInterface $loop, FilesystemInterface $fil
mkdir($subDir);
chmod($dir, 0777);
chmod($subDir, 0777);
$this->assertTrue(file_exists($dir));
$this->assertTrue(file_exists($subDir));
$this->assertFileExists($dir);
$this->assertFileExists($subDir);
$this->assertSame('0777', substr(sprintf('%o', fileperms($dir)), -4));
$this->assertSame('0777', substr(sprintf('%o', fileperms($subDir)), -4));
clearstatcache();
Expand All @@ -183,8 +183,8 @@ public function testChown(LoopInterface $loop, FilesystemInterface $filesystem)
mkdir($dir, 0777);
mkdir($subDir, 0777);
clearstatcache();
$this->assertTrue(file_exists($dir));
$this->assertTrue(file_exists($subDir));
$this->assertFileExists($dir);
$this->assertFileExists($subDir);
clearstatcache();
$stat = stat($dir);
sleep(2);
Expand All @@ -203,8 +203,8 @@ public function testChownRecursive(LoopInterface $loop, FilesystemInterface $fil
$subDir = $this->tmpDir . 'path' . DIRECTORY_SEPARATOR . 'sub';
mkdir($dir, 0777);
mkdir($subDir, 0777);
$this->assertTrue(file_exists($dir));
$this->assertTrue(file_exists($subDir));
$this->assertFileExists($dir);
$this->assertFileExists($subDir);
clearstatcache();
$stat = stat($dir);
$subStat = stat($subDir);
Expand Down
18 changes: 9 additions & 9 deletions tests/Adapters/FileTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public function testTime(LoopInterface $loop, FilesystemInterface $filesystem)
{
$actualStat = lstat(__FILE__);
$result = $this->await($filesystem->file(__FILE__)->time(), $loop);
$this->assertSame(3, count($result));
$this->assertCount(3, $result);
$this->assertInstanceOf('DateTime', $result['atime']);
$this->assertEquals($actualStat['atime'], $result['atime']->format('U'));
$this->assertInstanceOf('DateTime', $result['mtime']);
Expand Down Expand Up @@ -105,7 +105,7 @@ public function testRemove(LoopInterface $loop, FilesystemInterface $filesystem)
$this->checkIfTimedOut();
} while (!file_exists($tempFile));
$this->await($filesystem->file($tempFile)->remove(), $loop);
$this->assertFalse(file_exists($tempFile));
$this->assertFileNotExists($tempFile);
}

/**
Expand All @@ -126,9 +126,9 @@ public function testCreate(LoopInterface $loop, FilesystemInterface $filesystem)
public function testTouch(LoopInterface $loop, FilesystemInterface $filesystem)
{
$tempFile = $this->tmpDir . uniqid('', true);
$this->assertFalse(file_exists($tempFile));
$this->assertFileNotExists($tempFile);
$this->await($filesystem->file($tempFile)->touch(), $loop);
$this->assertTrue(file_exists($tempFile));
$this->assertFileExists($tempFile);
}

/**
Expand All @@ -143,7 +143,7 @@ public function testGetContents(LoopInterface $loop, FilesystemInterface $filesy
usleep(500);
$this->checkIfTimedOut();
} while (!file_exists($tempFile));
$this->assertTrue(file_exists($tempFile));
$this->assertFileExists($tempFile);
$fileContents = $this->await($filesystem->file($tempFile)->getContents(), $loop);
$this->assertSame($contents, $fileContents);
}
Expand All @@ -161,10 +161,10 @@ public function testCopy(LoopInterface $loop, FilesystemInterface $filesystem)
usleep(500);
$this->checkIfTimedOut();
} while (!file_exists($tempFileSource));
$this->assertTrue(file_exists($tempFileSource));
$this->assertFileExists($tempFileSource);
$this->assertSame($contents, file_get_contents($tempFileSource));
$this->await($filesystem->file($tempFileSource)->copy($filesystem->file($tempFileDestination)), $loop);
$this->assertSame(file_get_contents($tempFileSource), file_get_contents($tempFileDestination));
$this->assertFileEquals($tempFileSource, $tempFileDestination);
}

/**
Expand All @@ -182,7 +182,7 @@ public function testCopyToDirectory(LoopInterface $loop, FilesystemInterface $fi
usleep(500);
$this->checkIfTimedOut();
} while (!file_exists($tempFileSource) && !file_exists($tempFileDestination));
$this->assertTrue(file_exists($tempFileSource));
$this->assertFileExists($tempFileSource);
$this->assertSame($contents, file_get_contents($tempFileSource));
$promise = $filesystem->file($tempFileSource)->copy($filesystem->dir($tempFileDestination));
$timer = $loop->addTimer(self::TIMEOUT, function () use ($loop) {
Expand All @@ -197,7 +197,7 @@ public function testCopyToDirectory(LoopInterface $loop, FilesystemInterface $fi
usleep(500);
$this->checkIfTimedOut();
} while (!file_exists($tempFileDestination . $filename) || stat($tempFileDestination . $filename)['size'] == 0);
$this->assertSame(file_get_contents($tempFileSource), file_get_contents($tempFileDestination . $filename));
$this->assertFileEquals($tempFileSource, $tempFileDestination . $filename);
}

/**
Expand Down
2 changes: 1 addition & 1 deletion tests/ChildProcess/ProcessTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public function testStat()
'mtime',
'ctime',
] as $item) {
$this->assertTrue(isset($result[$item]));
$this->assertArrayHasKey($item, $result);
}
$resultCallbackRan = true;
});
Expand Down
2 changes: 1 addition & 1 deletion tests/Eio/ConstTypeDetectorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public function testDetectUnknown()
(new ConstTypeDetector($filesystem))->detect([
'type' => 123,
])->otherwise(function ($result) use (&$callbackFired) {
$this->assertSame(null, $result);
$this->assertNull($result);
$callbackFired = true;
});

Expand Down
2 changes: 1 addition & 1 deletion tests/ModeTypeDetectorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public function testDetectUnknown()
(new ModeTypeDetector($filesystem))->detect([
'path' => 'foo.bar',
])->otherwise(function ($result) use (&$callbackFired) {
$this->assertSame(null, $result);
$this->assertNull($result);
$callbackFired = true;
});

Expand Down
2 changes: 1 addition & 1 deletion tests/Stream/WritableStreamTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ public function testIsNotWritable($className)

$stream = (new $className($path, $fd, $filesystem));
$stream->close();
$this->assertTrue(!$stream->isWritable());
$this->assertFalse($stream->isWritable());
}

/**
Expand Down