1
0
Fork 0

Fix test warnings

pull/7995/head
Jordi Boggiano 2019-02-18 14:03:23 +01:00
parent 9da40b3c2c
commit 0caa616e6c
No known key found for this signature in database
GPG Key ID: 7BBD42C429EC80BC
4 changed files with 17 additions and 15 deletions

View File

@ -47,7 +47,7 @@ class ApplicationTest extends TestCase
$index = 0; $index = 0;
$outputMock->expects($this->at($index++)) $outputMock->expects($this->at($index++))
->method("writeError"); ->method("write");
if (extension_loaded('xdebug')) { if (extension_loaded('xdebug')) {
$outputMock->expects($this->at($index++)) $outputMock->expects($this->at($index++))

View File

@ -20,6 +20,7 @@ class CacheTest extends TestCase
private $files; private $files;
private $root; private $root;
private $finder; private $finder;
private $filesystem;
private $cache; private $cache;
public function setUp() public function setUp()
@ -34,11 +35,12 @@ class CacheTest extends TestCase
} }
$this->finder = $this->getMockBuilder('Symfony\Component\Finder\Finder')->disableOriginalConstructor()->getMock(); $this->finder = $this->getMockBuilder('Symfony\Component\Finder\Finder')->disableOriginalConstructor()->getMock();
$this->filesystem = $this->getMockBuilder('Composer\Util\Filesystem')->getMock();
$io = $this->getMockBuilder('Composer\IO\IOInterface')->getMock(); $io = $this->getMockBuilder('Composer\IO\IOInterface')->getMock();
$this->cache = $this->getMockBuilder('Composer\Cache') $this->cache = $this->getMockBuilder('Composer\Cache')
->setMethods(array('getFinder')) ->setMethods(array('getFinder'))
->setConstructorArgs(array($io, $this->root)) ->setConstructorArgs(array($io, $this->root, 'a-z0-9.', $this->filesystem))
->getMock(); ->getMock();
$this->cache $this->cache
->expects($this->any()) ->expects($this->any())
@ -105,7 +107,7 @@ class CacheTest extends TestCase
public function testClearCache() public function testClearCache()
{ {
$this->finder $this->filesystem
->method('removeDirectory') ->method('removeDirectory')
->with($this->root) ->with($this->root)
->willReturn(true); ->willReturn(true);

View File

@ -223,7 +223,7 @@ class FileDownloaderTest extends TestCase
public function testDowngradeShowsAppropriateMessage() public function testDowngradeShowsAppropriateMessage()
{ {
$oldPackage = $this->getMock('Composer\Package\PackageInterface'); $oldPackage = $this->getMockBuilder('Composer\Package\PackageInterface')->getMock();
$oldPackage->expects($this->any()) $oldPackage->expects($this->any())
->method('getFullPrettyVersion') ->method('getFullPrettyVersion')
->will($this->returnValue('1.2.0')); ->will($this->returnValue('1.2.0'));
@ -231,7 +231,7 @@ class FileDownloaderTest extends TestCase
->method('getVersion') ->method('getVersion')
->will($this->returnValue('1.2.0.0')); ->will($this->returnValue('1.2.0.0'));
$newPackage = $this->getMock('Composer\Package\PackageInterface'); $newPackage = $this->getMockBuilder('Composer\Package\PackageInterface')->getMock();
$newPackage->expects($this->any()) $newPackage->expects($this->any())
->method('getFullPrettyVersion') ->method('getFullPrettyVersion')
->will($this->returnValue('1.0.0')); ->will($this->returnValue('1.0.0'));
@ -245,7 +245,7 @@ class FileDownloaderTest extends TestCase
->method('getDistUrls') ->method('getDistUrls')
->will($this->returnValue(array($distUrl))); ->will($this->returnValue(array($distUrl)));
$ioMock = $this->getMock('Composer\IO\IOInterface'); $ioMock = $this->getMockBuilder('Composer\IO\IOInterface')->getMock();
$ioMock->expects($this->at(0)) $ioMock->expects($this->at(0))
->method('writeError') ->method('writeError')
->with($this->stringContains('Downloading')); ->with($this->stringContains('Downloading'));
@ -256,7 +256,7 @@ class FileDownloaderTest extends TestCase
$path = $this->getUniqueTmpDirectory(); $path = $this->getUniqueTmpDirectory();
touch($path.'_script.js'); touch($path.'_script.js');
$filesystem = $this->getMock('Composer\Util\Filesystem'); $filesystem = $this->getMockBuilder('Composer\Util\Filesystem')->getMock();
$filesystem->expects($this->once()) $filesystem->expects($this->once())
->method('removeDirectory') ->method('removeDirectory')
->will($this->returnValue(true)); ->will($this->returnValue(true));

View File

@ -604,7 +604,7 @@ composer https://github.com/old/url (push)
public function testDowngradeShowsAppropriateMessage() public function testDowngradeShowsAppropriateMessage()
{ {
$oldPackage = $this->getMock('Composer\Package\PackageInterface'); $oldPackage = $this->getMockBuilder('Composer\Package\PackageInterface')->getMock();
$oldPackage->expects($this->any()) $oldPackage->expects($this->any())
->method('getVersion') ->method('getVersion')
->will($this->returnValue('1.2.0.0')); ->will($this->returnValue('1.2.0.0'));
@ -618,7 +618,7 @@ composer https://github.com/old/url (push)
->method('getSourceUrls') ->method('getSourceUrls')
->will($this->returnValue(array('/foo/bar', 'https://github.com/composer/composer'))); ->will($this->returnValue(array('/foo/bar', 'https://github.com/composer/composer')));
$newPackage = $this->getMock('Composer\Package\PackageInterface'); $newPackage = $this->getMockBuilder('Composer\Package\PackageInterface')->getMock();
$newPackage->expects($this->any()) $newPackage->expects($this->any())
->method('getSourceReference') ->method('getSourceReference')
->will($this->returnValue('ref')); ->will($this->returnValue('ref'));
@ -632,12 +632,12 @@ composer https://github.com/old/url (push)
->method('getFullPrettyVersion') ->method('getFullPrettyVersion')
->will($this->returnValue('1.0.0')); ->will($this->returnValue('1.0.0'));
$processExecutor = $this->getMock('Composer\Util\ProcessExecutor'); $processExecutor = $this->getMockBuilder('Composer\Util\ProcessExecutor')->getMock();
$processExecutor->expects($this->any()) $processExecutor->expects($this->any())
->method('execute') ->method('execute')
->will($this->returnValue(0)); ->will($this->returnValue(0));
$ioMock = $this->getMock('Composer\IO\IOInterface'); $ioMock = $this->getMockBuilder('Composer\IO\IOInterface')->getMock();
$ioMock->expects($this->at(0)) $ioMock->expects($this->at(0))
->method('writeError') ->method('writeError')
->with($this->stringContains('Downgrading')); ->with($this->stringContains('Downgrading'));
@ -649,7 +649,7 @@ composer https://github.com/old/url (push)
public function testNotUsingDowngradingWithReferences() public function testNotUsingDowngradingWithReferences()
{ {
$oldPackage = $this->getMock('Composer\Package\PackageInterface'); $oldPackage = $this->getMockBuilder('Composer\Package\PackageInterface')->getMock();
$oldPackage->expects($this->any()) $oldPackage->expects($this->any())
->method('getVersion') ->method('getVersion')
->will($this->returnValue('dev-ref')); ->will($this->returnValue('dev-ref'));
@ -660,7 +660,7 @@ composer https://github.com/old/url (push)
->method('getSourceUrls') ->method('getSourceUrls')
->will($this->returnValue(array('/foo/bar', 'https://github.com/composer/composer'))); ->will($this->returnValue(array('/foo/bar', 'https://github.com/composer/composer')));
$newPackage = $this->getMock('Composer\Package\PackageInterface'); $newPackage = $this->getMockBuilder('Composer\Package\PackageInterface')->getMock();
$newPackage->expects($this->any()) $newPackage->expects($this->any())
->method('getSourceReference') ->method('getSourceReference')
->will($this->returnValue('ref')); ->will($this->returnValue('ref'));
@ -671,12 +671,12 @@ composer https://github.com/old/url (push)
->method('getVersion') ->method('getVersion')
->will($this->returnValue('dev-ref2')); ->will($this->returnValue('dev-ref2'));
$processExecutor = $this->getMock('Composer\Util\ProcessExecutor'); $processExecutor = $this->getMockBuilder('Composer\Util\ProcessExecutor')->getMock();
$processExecutor->expects($this->any()) $processExecutor->expects($this->any())
->method('execute') ->method('execute')
->will($this->returnValue(0)); ->will($this->returnValue(0));
$ioMock = $this->getMock('Composer\IO\IOInterface'); $ioMock = $this->getMockBuilder('Composer\IO\IOInterface')->getMock();
$ioMock->expects($this->at(0)) $ioMock->expects($this->at(0))
->method('writeError') ->method('writeError')
->with($this->stringContains('updating')); ->with($this->stringContains('updating'));