fix risky tests (without any assertion)

main
Ion Bazan 4 years ago
parent db32d6bc18
commit 58b34d13e8

@ -222,6 +222,7 @@ class ConfigTest extends TestCase
/**
* @dataProvider allowedUrlProvider
* @doesNotPerformAssertions
*
* @param string $url
*/

@ -153,7 +153,7 @@ class FossilDownloaderTest extends TestCase
->method('execute')
->with($this->equalTo($expectedResetCommand));
$filesystem = $this->getMockBuilder('Composer\Util\Filesystem')->getMock();
$filesystem->expects($this->any())
$filesystem->expects($this->once())
->method('removeDirectory')
->with($this->equalTo('composerPath'))
->will($this->returnValue(true));

@ -712,7 +712,7 @@ composer https://github.com/old/url (push)
->with($this->equalTo($expectedGitResetCommand))
->will($this->returnValue(0));
$filesystem = $this->getMockBuilder('Composer\Util\Filesystem')->getMock();
$filesystem->expects($this->any())
$filesystem->expects($this->once())
->method('removeDirectory')
->with($this->equalTo('composerPath'))
->will($this->returnValue(true));

@ -142,7 +142,7 @@ class HgDownloaderTest extends TestCase
->method('execute')
->with($this->equalTo($expectedResetCommand));
$filesystem = $this->getMockBuilder('Composer\Util\Filesystem')->getMock();
$filesystem->expects($this->any())
$filesystem->expects($this->once())
->method('removeDirectory')
->with($this->equalTo('composerPath'))
->will($this->returnValue(true));

@ -103,6 +103,9 @@ class PerforceDownloaderTest extends TestCase
return $repository;
}
/**
* @doesNotPerformAssertions
*/
public function testInitPerforceInstantiatesANewPerforceObject()
{
$this->downloader->initPerforce($this->package, $this->testPath, 'SOURCE_REF');

@ -17,6 +17,9 @@ use Composer\Test\TestCase;
class BasePackageTest extends TestCase
{
/**
* @doesNotPerformAssertions
*/
public function testSetSameRepository()
{
$package = $this->getMockForAbstractClass('Composer\Package\BasePackage', array('foo'));

@ -83,7 +83,7 @@ class ArrayLoaderTest extends TestCase
$this->assertEquals('1.2.3.4', $package->getVersion());
}
public function testParseDumpProvider()
public function parseDumpProvider()
{
$validConfig = array(
'name' => 'A/B',
@ -142,7 +142,7 @@ class ArrayLoaderTest extends TestCase
* The default parser should default to loading the config as this
* allows require-dev libraries to have transport options included.
*
* @dataProvider testParseDumpProvider
* @dataProvider parseDumpProvider
*/
public function testParseDumpDefaultLoadConfig($config)
{
@ -153,7 +153,7 @@ class ArrayLoaderTest extends TestCase
}
/**
* @dataProvider testParseDumpProvider
* @dataProvider parseDumpProvider
*/
public function testParseDumpTrueLoadConfig($config)
{
@ -165,7 +165,7 @@ class ArrayLoaderTest extends TestCase
}
/**
* @dataProvider testParseDumpProvider
* @dataProvider parseDumpProvider
*/
public function testParseDumpFalseLoadConfig($config)
{

@ -62,8 +62,10 @@ class ChannelReaderTest extends TestCase
$reader = new \Composer\Repository\Pear\ChannelReader($rfs);
$reader->read('http://pear.1.0.net/');
$reader->read('http://pear.1.1.net/');
$pear10 = $reader->read('http://pear.1.0.net/');
$this->assertCount(2, $pear10->getPackages());
$pear11 = $reader->read('http://pear.1.1.net/');
$this->assertCount(3, $pear11->getPackages());
}
public function testShouldCreatePackages()

@ -84,7 +84,7 @@ class RepositoryManagerTest extends TestCase
$rm->setRepositoryClass('artifact', 'Composer\Repository\ArtifactRepository');
$rm->createRepository('composer', array('url' => 'http://example.org'));
$rm->createRepository($type, $options);
$this->assertInstanceOf('Composer\Repository\RepositoryInterface', $rm->createRepository($type, $options));
}
public function creationCases()

@ -20,6 +20,16 @@ use Composer\Test\TestCase;
*/
class ErrorHandlerTest extends TestCase
{
public function setUp()
{
ErrorHandler::register();
}
public function tearDown()
{
restore_error_handler();
}
/**
* Test ErrorHandler handles notices
*/
@ -27,8 +37,6 @@ class ErrorHandlerTest extends TestCase
{
$this->setExpectedException('\ErrorException', 'Undefined index: baz');
ErrorHandler::register();
$array = array('foo' => 'bar');
$array['baz'];
}
@ -40,18 +48,15 @@ class ErrorHandlerTest extends TestCase
{
$this->setExpectedException('\ErrorException', 'array_merge');
ErrorHandler::register();
array_merge(array(), 'string');
}
/**
* Test ErrorHandler handles warnings
* @doesNotPerformAssertions
*/
public function testErrorHandlerRespectsAtOperator()
{
ErrorHandler::register();
@trigger_error('test', E_USER_NOTICE);
}
}

@ -102,6 +102,7 @@ class GitTest extends TestCase
$this->mockConfig($protocol);
$this->process
->expects($this->atLeast(2))
->method('execute')
->willReturnMap(array(
array('git command failing', null, null, 1),
@ -113,11 +114,13 @@ class GitTest extends TestCase
->willReturn(false);
$this->io
->expects($this->atLeastOnce())
->method('hasAuthentication')
->with($this->equalTo('github.com'))
->willReturn(true);
$this->io
->expects($this->atLeastOnce())
->method('getAuthentication')
->with($this->equalTo('github.com'))
->willReturn(array('username' => 'token', 'password' => $gitHubToken));

Loading…
Cancel
Save