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;
$outputMock->expects($this->at($index++))
->method("writeError");
->method("write");
if (extension_loaded('xdebug')) {
$outputMock->expects($this->at($index++))

View File

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

View File

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

View File

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