1
0
Fork 0

Fix more warnings

pull/9054/head
Jordi Boggiano 2020-09-11 11:27:26 +02:00
parent 711d4792ce
commit d942c65e0c
No known key found for this signature in database
GPG Key ID: 7BBD42C429EC80BC
10 changed files with 22 additions and 18 deletions

View File

@ -941,8 +941,8 @@ EOF;
$this->assertFileContentEquals(__DIR__.'/Fixtures/autoload_functions.php', $this->vendorDir.'/autoload.php'); $this->assertFileContentEquals(__DIR__.'/Fixtures/autoload_functions.php', $this->vendorDir.'/autoload.php');
$this->assertFileContentEquals(__DIR__.'/Fixtures/autoload_real_functions_with_removed_include_paths_and_autolad_files.php', $this->vendorDir.'/composer/autoload_real.php'); $this->assertFileContentEquals(__DIR__.'/Fixtures/autoload_real_functions_with_removed_include_paths_and_autolad_files.php', $this->vendorDir.'/composer/autoload_real.php');
$this->assertFileContentEquals(__DIR__.'/Fixtures/autoload_static_functions_with_removed_include_paths_and_autolad_files.php', $this->vendorDir.'/composer/autoload_static.php'); $this->assertFileContentEquals(__DIR__.'/Fixtures/autoload_static_functions_with_removed_include_paths_and_autolad_files.php', $this->vendorDir.'/composer/autoload_static.php');
$this->assertFileNotExists($this->vendorDir.'/composer/autoload_files.php'); $this->assertFileDoesNotExist($this->vendorDir.'/composer/autoload_files.php');
$this->assertFileNotExists($this->vendorDir.'/composer/include_paths.php'); $this->assertFileDoesNotExist($this->vendorDir.'/composer/include_paths.php');
} }
public function testFilesAutoloadOrderByDependencies() public function testFilesAutoloadOrderByDependencies()
@ -1223,7 +1223,7 @@ EOF;
$this->generator->dump($this->config, $this->repository, $package, $this->im, "composer", false, '_12'); $this->generator->dump($this->config, $this->repository, $package, $this->im, "composer", false, '_12');
$this->assertFileNotExists($this->vendorDir."/composer/include_paths.php"); $this->assertFileDoesNotExist($this->vendorDir."/composer/include_paths.php");
} }
public function testPreAndPostEventsAreDispatchedDuringAutoloadDump() public function testPreAndPostEventsAreDispatchedDuringAutoloadDump()

View File

@ -72,7 +72,7 @@ class CacheTest extends TestCase
$this->cache->gc(600, 1024 * 1024 * 1024); $this->cache->gc(600, 1024 * 1024 * 1024);
for ($i = 1; $i < 4; $i++) { for ($i = 1; $i < 4; $i++) {
$this->assertFileNotExists("{$this->root}/cached.file{$i}.zip"); $this->assertFileDoesNotExist("{$this->root}/cached.file{$i}.zip");
} }
$this->assertFileExists("{$this->root}/cached.file0.zip"); $this->assertFileExists("{$this->root}/cached.file0.zip");
} }
@ -101,7 +101,7 @@ class CacheTest extends TestCase
$this->cache->gc(600, 1500); $this->cache->gc(600, 1500);
for ($i = 0; $i < 3; $i++) { for ($i = 0; $i < 3; $i++) {
$this->assertFileNotExists("{$this->root}/cached.file{$i}.zip"); $this->assertFileDoesNotExist("{$this->root}/cached.file{$i}.zip");
} }
$this->assertFileExists("{$this->root}/cached.file3.zip"); $this->assertFileExists("{$this->root}/cached.file3.zip");
} }

View File

@ -36,7 +36,7 @@ class ArchiveDownloaderTest extends TestCase
->will($this->returnValue('/vendor')); ->will($this->returnValue('/vendor'));
$first = $method->invoke($downloader, $packageMock, '/path'); $first = $method->invoke($downloader, $packageMock, '/path');
$this->assertRegExp('#/vendor/composer/tmp-[a-z0-9]+\.js#', $first); $this->assertMatchesRegularExpression('#/vendor/composer/tmp-[a-z0-9]+\.js#', $first);
$this->assertSame($first, $method->invoke($downloader, $packageMock, '/path')); $this->assertSame($first, $method->invoke($downloader, $packageMock, '/path'));
} }

View File

@ -98,7 +98,7 @@ class FileDownloaderTest extends TestCase
->with('vendor-dir') ->with('vendor-dir')
->will($this->returnValue('/vendor')); ->will($this->returnValue('/vendor'));
$this->assertRegExp('#/vendor/composer/tmp-[a-z0-9]+\.js#', $method->invoke($downloader, $packageMock, '/path')); $this->assertMatchesRegularExpression('#/vendor/composer/tmp-[a-z0-9]+\.js#', $method->invoke($downloader, $packageMock, '/path'));
} }
public function testDownloadButFileIsUnsaved() public function testDownloadButFileIsUnsaved()

View File

@ -77,7 +77,7 @@ class XzDownloaderTest extends TestCase
$this->fail('Download of invalid tarball should throw an exception'); $this->fail('Download of invalid tarball should throw an exception');
} catch (\RuntimeException $e) { } catch (\RuntimeException $e) {
$this->assertRegexp('/(File format not recognized|Unrecognized archive format)/i', $e->getMessage()); $this->assertMatchesRegularExpression('/(File format not recognized|Unrecognized archive format)/i', $e->getMessage());
} }
} }
} }

View File

@ -71,7 +71,7 @@ class LibraryInstallerTest extends TestCase
$this->fs->removeDirectory($this->vendorDir); $this->fs->removeDirectory($this->vendorDir);
new LibraryInstaller($this->io, $this->composer); new LibraryInstaller($this->io, $this->composer);
$this->assertFileNotExists($this->vendorDir); $this->assertFileDoesNotExist($this->vendorDir);
} }
public function testInstallerCreationShouldNotCreateBinDirectory() public function testInstallerCreationShouldNotCreateBinDirectory()
@ -79,7 +79,7 @@ class LibraryInstallerTest extends TestCase
$this->fs->removeDirectory($this->binDir); $this->fs->removeDirectory($this->binDir);
new LibraryInstaller($this->io, $this->composer); new LibraryInstaller($this->io, $this->composer);
$this->assertFileNotExists($this->binDir); $this->assertFileDoesNotExist($this->binDir);
} }
public function testIsInstalled() public function testIsInstalled()

View File

@ -68,7 +68,7 @@ class ArchiveManagerTest extends ArchiverTest
$this->assertFileExists($target); $this->assertFileExists($target);
$tmppath = sys_get_temp_dir().'/composer_archiver/'.$this->manager->getPackageFilename($package); $tmppath = sys_get_temp_dir().'/composer_archiver/'.$this->manager->getPackageFilename($package);
$this->assertFileNotExists($tmppath); $this->assertFileDoesNotExist($tmppath);
unlink($target); unlink($target);
} }
@ -90,7 +90,7 @@ class ArchiveManagerTest extends ArchiverTest
$this->assertFileExists($target); $this->assertFileExists($target);
$tmppath = sys_get_temp_dir().'/composer_archiver/'.$this->manager->getPackageFilename($package); $tmppath = sys_get_temp_dir().'/composer_archiver/'.$this->manager->getPackageFilename($package);
$this->assertFileNotExists($tmppath); $this->assertFileDoesNotExist($tmppath);
unlink($target); unlink($target);
} }

View File

@ -35,7 +35,11 @@ class ErrorHandlerTest extends TestCase
*/ */
public function testErrorHandlerCaptureNotice() public function testErrorHandlerCaptureNotice()
{ {
$this->setExpectedException('\ErrorException', 'Undefined index: baz'); if (PHP_VERSION_ID >= 80000) {
$this->setExpectedException('\ErrorException', 'Undefined array key "baz"');
} else {
$this->setExpectedException('\ErrorException', 'Undefined index: baz');
}
$array = array('foo' => 'bar'); $array = array('foo' => 'bar');
$array['baz']; $array['baz'];

View File

@ -168,7 +168,7 @@ class FilesystemTest extends TestCase
$fs = new Filesystem; $fs = new Filesystem;
$this->assertTrue($fs->removeDirectoryPhp($this->workingDir)); $this->assertTrue($fs->removeDirectoryPhp($this->workingDir));
$this->assertFileNotExists($this->workingDir . "/level1/level2/hello.txt"); $this->assertFileDoesNotExist($this->workingDir . "/level1/level2/hello.txt");
} }
public function testFileSize() public function testFileSize()
@ -247,7 +247,7 @@ class FilesystemTest extends TestCase
$fs = new Filesystem(); $fs = new Filesystem();
$result = $fs->unlink($symlinked); $result = $fs->unlink($symlinked);
$this->assertTrue($result); $this->assertTrue($result);
$this->assertFileNotExists($symlinked); $this->assertFileDoesNotExist($symlinked);
} }
/** /**
@ -279,8 +279,8 @@ class FilesystemTest extends TestCase
$result = $fs->removeDirectory($symlinkedTrailingSlash); $result = $fs->removeDirectory($symlinkedTrailingSlash);
$this->assertTrue($result); $this->assertTrue($result);
$this->assertFileNotExists($symlinkedTrailingSlash); $this->assertFileDoesNotExist($symlinkedTrailingSlash);
$this->assertFileNotExists($symlinked); $this->assertFileDoesNotExist($symlinked);
} }
public function testJunctions() public function testJunctions()

View File

@ -253,7 +253,7 @@ class RemoteFilesystemTest extends TestCase
$res = $this->callGetOptionsForUrl($io, array('example.org', array('ssl' => array('cafile' => '/some/path/file.crt'))), array(), 'http://www.example.org'); $res = $this->callGetOptionsForUrl($io, array('example.org', array('ssl' => array('cafile' => '/some/path/file.crt'))), array(), 'http://www.example.org');
$this->assertTrue(isset($res['ssl']['ciphers'])); $this->assertTrue(isset($res['ssl']['ciphers']));
$this->assertRegExp('|!aNULL:!eNULL:!EXPORT:!DES:!RC4:!MD5:!PSK:!aECDH:!EDH-DSS-DES-CBC3-SHA:!EDH-RSA-DES-CBC3-SHA:!KRB5-DES-CBC3-SHA|', $res['ssl']['ciphers']); $this->assertMatchesRegularExpression('|!aNULL:!eNULL:!EXPORT:!DES:!RC4:!MD5:!PSK:!aECDH:!EDH-DSS-DES-CBC3-SHA:!EDH-RSA-DES-CBC3-SHA:!KRB5-DES-CBC3-SHA|', $res['ssl']['ciphers']);
$this->assertTrue($res['ssl']['verify_peer']); $this->assertTrue($res['ssl']['verify_peer']);
$this->assertTrue($res['ssl']['SNI_enabled']); $this->assertTrue($res['ssl']['SNI_enabled']);
$this->assertEquals(7, $res['ssl']['verify_depth']); $this->assertEquals(7, $res['ssl']['verify_depth']);