diff --git a/phpstan/config.neon b/phpstan/config.neon index 5f77d5cd1..7c0122f9a 100644 --- a/phpstan/config.neon +++ b/phpstan/config.neon @@ -29,9 +29,11 @@ parameters: - '~^Undefined variable: \$vendorDir$~' - '~^Undefined variable: \$baseDir$~' + # variable defined in eval + - '~^Undefined variable: \$res$~' + # always checked whether the class exists - - '~^Instantiated class Symfony\\Component\\Console\\Terminal not found\.$~' - - '~^Class Symfony\\Component\\Console\\Input\\StreamableInputInterface not found\.$~' + - '~^Call to an undefined static method Symfony\\Component\\Process\\Process::fromShellCommandline\(\).$~' # parent call in test mocks - '~^Composer\\Test\\Mock\\HttpDownloaderMock::__construct\(\) does not call parent constructor from Composer\\Util\\HttpDownloader\.$~' diff --git a/tests/Composer/Test/DependencyResolver/SolverTest.php b/tests/Composer/Test/DependencyResolver/SolverTest.php index e50927fe2..95696e610 100644 --- a/tests/Composer/Test/DependencyResolver/SolverTest.php +++ b/tests/Composer/Test/DependencyResolver/SolverTest.php @@ -40,7 +40,7 @@ class SolverTest extends TestCase $this->repo = new ArrayRepository; $this->repoInstalled = new InstalledArrayRepository; - $this->request = new Request($this->repoSet); + $this->request = new Request(); $this->policy = new DefaultPolicy; } diff --git a/tests/Composer/Test/Downloader/PerforceDownloaderTest.php b/tests/Composer/Test/Downloader/PerforceDownloaderTest.php index 77a61f9cf..b6347789b 100644 --- a/tests/Composer/Test/Downloader/PerforceDownloaderTest.php +++ b/tests/Composer/Test/Downloader/PerforceDownloaderTest.php @@ -129,7 +129,7 @@ class PerforceDownloaderTest extends TestCase $this->package->expects($this->once())->method('getSourceReference')->will($this->returnValue($ref)); $this->io->expects($this->once())->method('writeError')->with($this->stringContains('Cloning '.$ref)); $perforceMethods = array('setStream', 'p4Login', 'writeP4ClientSpec', 'connectClient', 'syncCodeBase', 'cleanupClientSpec'); - $perforce = $this->getMockBuilder('Composer\Util\Perforce', $perforceMethods)->disableOriginalConstructor()->getMock(); + $perforce = $this->getMockBuilder('Composer\Util\Perforce')->disableOriginalConstructor()->getMock(); $perforce->expects($this->at(0))->method('initializePath')->with($this->equalTo($this->testPath)); $perforce->expects($this->at(1))->method('setStream')->with($this->equalTo($ref)); $perforce->expects($this->at(2))->method('p4Login'); @@ -152,7 +152,7 @@ class PerforceDownloaderTest extends TestCase $this->package->expects($this->once())->method('getSourceReference')->will($this->returnValue($ref)); $this->io->expects($this->once())->method('writeError')->with($this->stringContains('Cloning '.$ref)); $perforceMethods = array('setStream', 'p4Login', 'writeP4ClientSpec', 'connectClient', 'syncCodeBase', 'cleanupClientSpec'); - $perforce = $this->getMockBuilder('Composer\Util\Perforce', $perforceMethods)->disableOriginalConstructor()->getMock(); + $perforce = $this->getMockBuilder('Composer\Util\Perforce')->disableOriginalConstructor()->getMock(); $perforce->expects($this->at(0))->method('initializePath')->with($this->equalTo($this->testPath)); $perforce->expects($this->at(1))->method('setStream')->with($this->equalTo($ref)); $perforce->expects($this->at(2))->method('p4Login'); diff --git a/tests/Composer/Test/Repository/Vcs/PerforceDriverTest.php b/tests/Composer/Test/Repository/Vcs/PerforceDriverTest.php index ff4e19121..1c44e82dd 100644 --- a/tests/Composer/Test/Repository/Vcs/PerforceDriverTest.php +++ b/tests/Composer/Test/Repository/Vcs/PerforceDriverTest.php @@ -108,7 +108,7 @@ class PerforceDriverTest extends TestCase { $methods = array('p4login', 'checkStream', 'writeP4ClientSpec', 'connectClient', 'getComposerInformation', 'cleanupClientSpec'); - return $this->getMockBuilder('Composer\Util\Perforce', $methods)->disableOriginalConstructor()->getMock(); + return $this->getMockBuilder('Composer\Util\Perforce')->disableOriginalConstructor()->getMock(); } public function testInitializeCapturesVariablesFromRepoConfig() diff --git a/tests/Composer/Test/Repository/VcsRepositoryTest.php b/tests/Composer/Test/Repository/VcsRepositoryTest.php index 0cab2f8bb..65bf52409 100644 --- a/tests/Composer/Test/Repository/VcsRepositoryTest.php +++ b/tests/Composer/Test/Repository/VcsRepositoryTest.php @@ -32,17 +32,18 @@ class VcsRepositoryTest extends TestCase protected function initialize() { - $oldCwd = getcwd(); - self::$composerHome = $this->getUniqueTmpDirectory(); - self::$gitRepo = $this->getUniqueTmpDirectory(); - $locator = new ExecutableFinder(); if (!$locator->find('git')) { $this->skipped = 'This test needs a git binary in the PATH to be able to run'; return; } - if (!@mkdir(self::$gitRepo) || !@chdir(self::$gitRepo)) { + + $oldCwd = getcwd(); + self::$composerHome = $this->getUniqueTmpDirectory(); + self::$gitRepo = $this->getUniqueTmpDirectory(); + + if (!@chdir(self::$gitRepo)) { $this->skipped = 'Could not create and move into the temp git repo '.self::$gitRepo; return; @@ -60,6 +61,7 @@ class VcsRepositoryTest extends TestCase $exec('git init'); $exec('git config user.email composertest@example.org'); $exec('git config user.name ComposerTest'); + $exec('git config commit.gpgsign false'); touch('foo'); $exec('git add foo'); $exec('git commit -m init'); @@ -150,7 +152,8 @@ class VcsRepositoryTest extends TestCase 'home' => self::$composerHome, ), )); - $repo = new VcsRepository(array('url' => self::$gitRepo, 'type' => 'vcs'), new NullIO, $config); + $httpDownloader = $this->getMockBuilder('Composer\Util\HttpDownloader')->disableOriginalConstructor()->getMock(); + $repo = new VcsRepository(array('url' => self::$gitRepo, 'type' => 'vcs'), new NullIO, $config, $httpDownloader); $packages = $repo->getPackages(); $dumper = new ArrayDumper();