Php unit dedicate assert (#10881)
Co-authored-by: Jordi Boggiano <j.boggiano@seld.be>pull/10893/head
parent
4131f7cf4c
commit
d17c724f23
|
@ -1820,7 +1820,7 @@ EOF;
|
||||||
$this->generator->dump($this->config, $this->repository, $package, $this->im, 'composer', true, '_1');
|
$this->generator->dump($this->config, $this->repository, $package, $this->im, 'composer', true, '_1');
|
||||||
|
|
||||||
if (null === $expectedFixture) {
|
if (null === $expectedFixture) {
|
||||||
$this->assertFalse(file_exists($this->vendorDir . '/composer/platform_check.php'));
|
$this->assertFileDoesNotExist($this->vendorDir . '/composer/platform_check.php');
|
||||||
$this->assertStringNotContainsString("require __DIR__ . '/platform_check.php';", (string) file_get_contents($this->vendorDir.'/composer/autoload_real.php'));
|
$this->assertStringNotContainsString("require __DIR__ . '/platform_check.php';", (string) file_get_contents($this->vendorDir.'/composer/autoload_real.php'));
|
||||||
} else {
|
} else {
|
||||||
$this->assertFileContentEquals(__DIR__ . '/Fixtures/platform/' . $expectedFixture . '.php', $this->vendorDir . '/composer/platform_check.php');
|
$this->assertFileContentEquals(__DIR__ . '/Fixtures/platform/' . $expectedFixture . '.php', $this->vendorDir . '/composer/platform_check.php');
|
||||||
|
|
|
@ -42,7 +42,7 @@ class NullIOTest extends TestCase
|
||||||
{
|
{
|
||||||
$io = new NullIO();
|
$io = new NullIO();
|
||||||
|
|
||||||
$this->assertTrue(is_array($io->getAuthentications())); // @phpstan-ignore-line
|
$this->assertIsArray($io->getAuthentications()); // @phpstan-ignore-line
|
||||||
$this->assertEmpty($io->getAuthentications());
|
$this->assertEmpty($io->getAuthentications());
|
||||||
$this->assertEquals(array('username' => null, 'password' => null), $io->getAuthentication('foo'));
|
$this->assertEquals(array('username' => null, 'password' => null), $io->getAuthentication('foo'));
|
||||||
}
|
}
|
||||||
|
|
|
@ -123,7 +123,7 @@ class CompositeRepositoryTest extends TestCase
|
||||||
|
|
||||||
$repo = new CompositeRepository(array($arrayRepoOne, $arrayRepoTwo));
|
$repo = new CompositeRepository(array($arrayRepoOne, $arrayRepoTwo));
|
||||||
|
|
||||||
$this->assertEquals(2, count($repo), "Should return '2' for count(\$repo)");
|
$this->assertCount(2, $repo, "Should return '2' for count(\$repo)");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -324,9 +324,9 @@ class FilesystemTest extends TestCase
|
||||||
$this->assertTrue($fs->isJunction($junction . '/../junction'), $junction . '/../junction: is a junction');
|
$this->assertTrue($fs->isJunction($junction . '/../junction'), $junction . '/../junction: is a junction');
|
||||||
|
|
||||||
// Remove junction
|
// Remove junction
|
||||||
$this->assertTrue(is_dir($junction), $junction . ' is a directory');
|
$this->assertDirectoryExists($junction, $junction . ' is a directory');
|
||||||
$this->assertTrue($fs->removeJunction($junction), $junction . ' has been removed');
|
$this->assertTrue($fs->removeJunction($junction), $junction . ' has been removed');
|
||||||
$this->assertFalse(is_dir($junction), $junction . ' is not a directory');
|
$this->assertDirectoryDoesNotExist($junction, $junction . ' is not a directory');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testCopy(): void
|
public function testCopy(): void
|
||||||
|
@ -342,16 +342,16 @@ class FilesystemTest extends TestCase
|
||||||
|
|
||||||
$result1 = $fs->copy($this->workingDir . '/foo', $this->workingDir . '/foop');
|
$result1 = $fs->copy($this->workingDir . '/foo', $this->workingDir . '/foop');
|
||||||
$this->assertTrue($result1, 'Copying directory failed.');
|
$this->assertTrue($result1, 'Copying directory failed.');
|
||||||
$this->assertTrue(is_dir($this->workingDir . '/foop'), 'Not a directory: ' . $this->workingDir . '/foop');
|
$this->assertDirectoryExists($this->workingDir . '/foop', 'Not a directory: ' . $this->workingDir . '/foop');
|
||||||
$this->assertTrue(is_dir($this->workingDir . '/foop/bar'), 'Not a directory: ' . $this->workingDir . '/foop/bar');
|
$this->assertDirectoryExists($this->workingDir . '/foop/bar', 'Not a directory: ' . $this->workingDir . '/foop/bar');
|
||||||
$this->assertTrue(is_dir($this->workingDir . '/foop/baz'), 'Not a directory: ' . $this->workingDir . '/foop/baz');
|
$this->assertDirectoryExists($this->workingDir . '/foop/baz', 'Not a directory: ' . $this->workingDir . '/foop/baz');
|
||||||
$this->assertTrue(is_file($this->workingDir . '/foop/foo.file'), 'Not a file: ' . $this->workingDir . '/foop/foo.file');
|
$this->assertFileExists($this->workingDir . '/foop/foo.file', 'Not a file: ' . $this->workingDir . '/foop/foo.file');
|
||||||
$this->assertTrue(is_file($this->workingDir . '/foop/bar/foobar.file'), 'Not a file: ' . $this->workingDir . '/foop/bar/foobar.file');
|
$this->assertFileExists($this->workingDir . '/foop/bar/foobar.file', 'Not a file: ' . $this->workingDir . '/foop/bar/foobar.file');
|
||||||
$this->assertTrue(is_file($this->workingDir . '/foop/baz/foobaz.file'), 'Not a file: ' . $this->workingDir . '/foop/baz/foobaz.file');
|
$this->assertFileExists($this->workingDir . '/foop/baz/foobaz.file', 'Not a file: ' . $this->workingDir . '/foop/baz/foobaz.file');
|
||||||
|
|
||||||
$result2 = $fs->copy($this->testFile, $this->workingDir . '/testfile.file');
|
$result2 = $fs->copy($this->testFile, $this->workingDir . '/testfile.file');
|
||||||
$this->assertTrue($result2);
|
$this->assertTrue($result2);
|
||||||
$this->assertTrue(is_file($this->workingDir . '/testfile.file'));
|
$this->assertFileExists($this->workingDir . '/testfile.file');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testCopyThenRemove(): void
|
public function testCopyThenRemove(): void
|
||||||
|
@ -366,14 +366,14 @@ class FilesystemTest extends TestCase
|
||||||
$fs = new Filesystem();
|
$fs = new Filesystem();
|
||||||
|
|
||||||
$fs->copyThenRemove($this->testFile, $this->workingDir . '/testfile.file');
|
$fs->copyThenRemove($this->testFile, $this->workingDir . '/testfile.file');
|
||||||
$this->assertFalse(is_file($this->testFile), 'Still a file: ' . $this->testFile);
|
$this->assertFileDoesNotExist($this->testFile, 'Still a file: ' . $this->testFile);
|
||||||
|
|
||||||
$fs->copyThenRemove($this->workingDir . '/foo', $this->workingDir . '/foop');
|
$fs->copyThenRemove($this->workingDir . '/foo', $this->workingDir . '/foop');
|
||||||
$this->assertFalse(is_file($this->workingDir . '/foo/baz/foobaz.file'), 'Still a file: ' . $this->workingDir . '/foo/baz/foobaz.file');
|
$this->assertFileDoesNotExist($this->workingDir . '/foo/baz/foobaz.file', 'Still a file: ' . $this->workingDir . '/foo/baz/foobaz.file');
|
||||||
$this->assertFalse(is_file($this->workingDir . '/foo/bar/foobar.file'), 'Still a file: ' . $this->workingDir . '/foo/bar/foobar.file');
|
$this->assertFileDoesNotExist($this->workingDir . '/foo/bar/foobar.file', 'Still a file: ' . $this->workingDir . '/foo/bar/foobar.file');
|
||||||
$this->assertFalse(is_file($this->workingDir . '/foo/foo.file'), 'Still a file: ' . $this->workingDir . '/foo/foo.file');
|
$this->assertFileDoesNotExist($this->workingDir . '/foo/foo.file', 'Still a file: ' . $this->workingDir . '/foo/foo.file');
|
||||||
$this->assertFalse(is_dir($this->workingDir . '/foo/baz'), 'Still a directory: ' . $this->workingDir . '/foo/baz');
|
$this->assertDirectoryDoesNotExist($this->workingDir . '/foo/baz', 'Still a directory: ' . $this->workingDir . '/foo/baz');
|
||||||
$this->assertFalse(is_dir($this->workingDir . '/foo/bar'), 'Still a directory: ' . $this->workingDir . '/foo/bar');
|
$this->assertDirectoryDoesNotExist($this->workingDir . '/foo/bar', 'Still a directory: ' . $this->workingDir . '/foo/bar');
|
||||||
$this->assertFalse(is_dir($this->workingDir . '/foo'), 'Still a directory: ' . $this->workingDir . '/foo');
|
$this->assertDirectoryDoesNotExist($this->workingDir . '/foo', 'Still a directory: ' . $this->workingDir . '/foo');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue