Aude has uploaded a new change for review. https://gerrit.wikimedia.org/r/202991
Change subject: Replace use of assertType with assertInternalType and assertInstanceOf ...................................................................... Replace use of assertType with assertInternalType and assertInstanceOf These are available in phpunit since 3.5.0, which I think is reasonable to expect people to have at this point, especially when we actually require 3.7.0 or higher in phpunit.php: if ( $puVersion !== '@package_version@' && version_compare( $puVersion, '3.7.0', '<' ) ) { die( "PHPUnit 3.7.0 or later required; you have {$puVersion}.\n" ); } Change-Id: Ic32ab45110e4c4304ef046ae8d0e98c741255559 --- M tests/phpunit/includes/api/query/ApiQueryTestBase.php M tests/phpunit/includes/filebackend/FileBackendTest.php M tests/phpunit/includes/json/FormatJsonTest.php M tests/phpunit/includes/utils/UIDGeneratorTest.php 4 files changed, 12 insertions(+), 12 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core refs/changes/91/202991/1 diff --git a/tests/phpunit/includes/api/query/ApiQueryTestBase.php b/tests/phpunit/includes/api/query/ApiQueryTestBase.php index dabf72e..9e830f2 100644 --- a/tests/phpunit/includes/api/query/ApiQueryTestBase.php +++ b/tests/phpunit/includes/api/query/ApiQueryTestBase.php @@ -56,12 +56,12 @@ * @return array */ private function validateRequestExpectedPair( $v ) { - $this->assertType( 'array', $v, self::PARAM_ASSERT ); + $this->assertInternalType( 'array', $v, self::PARAM_ASSERT ); $this->assertEquals( 2, count( $v ), self::PARAM_ASSERT ); $this->assertArrayHasKey( 0, $v, self::PARAM_ASSERT ); $this->assertArrayHasKey( 1, $v, self::PARAM_ASSERT ); - $this->assertType( 'array', $v[0], self::PARAM_ASSERT ); - $this->assertType( 'array', $v[1], self::PARAM_ASSERT ); + $this->assertInternalType( 'array', $v[0], self::PARAM_ASSERT ); + $this->assertInternalType( 'array', $v[1], self::PARAM_ASSERT ); return $v; } diff --git a/tests/phpunit/includes/filebackend/FileBackendTest.php b/tests/phpunit/includes/filebackend/FileBackendTest.php index bfca75a..aaa93ef 100644 --- a/tests/phpunit/includes/filebackend/FileBackendTest.php +++ b/tests/phpunit/includes/filebackend/FileBackendTest.php @@ -2376,7 +2376,7 @@ $status = Status::newGood(); $sl = $this->backend->getScopedFileLocks( $paths, LockManager::LOCK_EX, $status ); - $this->assertType( 'ScopedLock', $sl, + $this->assertInstanceOf( 'ScopedLock', $sl, "Scoped locking of files succeeded ($backendName)." ); $this->assertEquals( array(), $status->errors, "Scoped locking of files succeeded ($backendName)." ); diff --git a/tests/phpunit/includes/json/FormatJsonTest.php b/tests/phpunit/includes/json/FormatJsonTest.php index f0ac6ac..8bca333 100644 --- a/tests/phpunit/includes/json/FormatJsonTest.php +++ b/tests/phpunit/includes/json/FormatJsonTest.php @@ -159,12 +159,12 @@ $this->assertJson( $json ); $st = FormatJson::parse( $json ); - $this->assertType( 'Status', $st ); + $this->assertInstanceOf( 'Status', $st ); $this->assertTrue( $st->isGood() ); $this->assertEquals( $expected, $st->getValue() ); $st = FormatJson::parse( $json, FormatJson::FORCE_ASSOC ); - $this->assertType( 'Status', $st ); + $this->assertInstanceOf( 'Status', $st ); $this->assertTrue( $st->isGood() ); $this->assertEquals( $value, $st->getValue() ); } @@ -230,7 +230,7 @@ } $st = FormatJson::parse( $value, FormatJson::TRY_FIXING ); - $this->assertType( 'Status', $st ); + $this->assertInstanceOf( 'Status', $st ); if ( $expected === false ) { $this->assertFalse( $st->isOK(), 'Expected isOK() == false' ); } else { @@ -256,7 +256,7 @@ */ public function testParseErrors( $value ) { $st = FormatJson::parse( $value ); - $this->assertType( 'Status', $st ); + $this->assertInstanceOf( 'Status', $st ); $this->assertFalse( $st->isOK() ); } @@ -313,7 +313,7 @@ */ public function testParseStripComments( $json, $expect ) { $st = FormatJson::parse( $json, FormatJson::STRIP_COMMENTS ); - $this->assertType( 'Status', $st ); + $this->assertInstanceOf( 'Status', $st ); $this->assertTrue( $st->isGood() ); $this->assertEquals( $expect, $st->getValue() ); } diff --git a/tests/phpunit/includes/utils/UIDGeneratorTest.php b/tests/phpunit/includes/utils/UIDGeneratorTest.php index 0e11cca..ff00398 100644 --- a/tests/phpunit/includes/utils/UIDGeneratorTest.php +++ b/tests/phpunit/includes/utils/UIDGeneratorTest.php @@ -105,8 +105,8 @@ $id1 = UIDGenerator::newSequentialPerNodeID( 'test', 32 ); $id2 = UIDGenerator::newSequentialPerNodeID( 'test', 32 ); - $this->assertType( 'float', $id1, "ID returned as float" ); - $this->assertType( 'float', $id2, "ID returned as float" ); + $this->assertInternalType( 'float', $id1, "ID returned as float" ); + $this->assertInternalType( 'float', $id2, "ID returned as float" ); $this->assertGreaterThan( 0, $id1, "ID greater than 1" ); $this->assertGreaterThan( $id1, $id2, "IDs increasing in value" ); } @@ -118,7 +118,7 @@ $ids = UIDGenerator::newSequentialPerNodeIDs( 'test', 32, 5 ); $lastId = null; foreach ( $ids as $id ) { - $this->assertType( 'float', $id, "ID returned as float" ); + $this->assertInternalType( 'float', $id, "ID returned as float" ); $this->assertGreaterThan( 0, $id, "ID greater than 1" ); if ( $lastId ) { $this->assertGreaterThan( $lastId, $id, "IDs increasing in value" ); -- To view, visit https://gerrit.wikimedia.org/r/202991 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ic32ab45110e4c4304ef046ae8d0e98c741255559 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/core Gerrit-Branch: master Gerrit-Owner: Aude <aude.w...@gmail.com> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits