Merge pull request #788 from rectorphp/phpunit/iterator-count

[PHPUnit] Convert iterator_count into assertCount
This commit is contained in:
Tomáš Votruba 2018-11-18 17:17:09 +01:00 committed by GitHub
commit ae37c40e37
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 3 additions and 0 deletions

View File

@ -18,6 +18,7 @@ final class AssertCompareToSpecificMethodRector extends AbstractPHPUnitRector
private $defaultOldToNewMethods = [
'count' => ['assertCount', 'assertNotCount'],
'sizeof' => ['assertCount', 'assertNotCount'],
'iterator_count' => ['assertCount', 'assertNotCount'],
'gettype' => ['assertInternalType', 'assertNotInternalType'],
'get_class' => ['assertInstanceOf', 'assertNotInstanceOf'],
];

View File

@ -5,6 +5,7 @@ final class MyTest extends \PHPUnit\Framework\TestCase
public function test()
{
$this->assertCount(5, $something);
$this->assertCount(10, $something);
$this->assertNotCount($count, $something, 'third argument');
$this->assertInternalType('string', $something);
$this->assertEquals('string', $something['property']());

View File

@ -5,6 +5,7 @@ final class MyTest extends \PHPUnit\Framework\TestCase
public function test()
{
$this->assertSame(5, count($something));
$this->assertEquals(10, iterator_count($something));
$this->assertNotEquals($count, sizeof($something), 'third argument');
$this->assertEquals('string', gettype($something));
$this->assertEquals('string', $something['property']());