diff --git a/maintenance/generateSampleNotifications.php b/maintenance/generateSampleNotifications.php index 5955d8d76..c0e0d1de6 100644 --- a/maintenance/generateSampleNotifications.php +++ b/maintenance/generateSampleNotifications.php @@ -1,5 +1,7 @@ output( 'class Wikibase\Client\Hooks\EchoNotificationsHandlers not found' ); + if ( !class_exists( EchoNotificationsHandlers::class ) ) { + $this->output( 'Class EchoNotificationsHandlers not found' ); return; } @@ -480,7 +482,7 @@ class GenerateSampleNotifications extends Maintenance { $this->output( "{$agent->getName()} is connecting {$user->getName()}'s page {$title->getPrefixedText()} to an item\n" ); EchoEvent::create( [ - 'type' => Wikibase\Client\Hooks\EchoNotificationsHandlers::NOTIFICATION_TYPE, + 'type' => EchoNotificationsHandlers::NOTIFICATION_TYPE, 'title' => $title, 'extra' => [ 'url' => Title::newFromText( 'Item:Q1' )->getFullURL(), diff --git a/tests/phpunit/cache/TitleLocalCacheTest.php b/tests/phpunit/cache/TitleLocalCacheTest.php index 5b119f423..820715af5 100644 --- a/tests/phpunit/cache/TitleLocalCacheTest.php +++ b/tests/phpunit/cache/TitleLocalCacheTest.php @@ -10,7 +10,7 @@ class EchoTitleLocalCacheTest extends MediaWikiTestCase { */ public function testCreate() { $cache = EchoTitleLocalCache::create(); - $this->assertInstanceOf( 'EchoTitleLocalCache', $cache ); + $this->assertInstanceOf( EchoTitleLocalCache::class, $cache ); return $cache; } @@ -57,13 +57,13 @@ class EchoTitleLocalCacheTest extends MediaWikiTestCase { // Requesting the first object, which is within the known targets, should // not resolve the pending lookups. - $this->assertInstanceOf( 'Title', $cache->get( reset( $titleIds ) ) ); - $this->assertGreaterThan( 0, count( $cache->getLookups() ) ); + $this->assertInstanceOf( Title::class, $cache->get( reset( $titleIds ) ) ); + $this->assertNotEmpty( $cache->getLookups() ); // Requesting the second object, which is not within the known targets, should // resolve the pending lookups and reset the list to lookup. - $this->assertInstanceOf( 'Title', $cache->get( end( $titleIds ) ) ); - $this->assertEquals( 0, count( $cache->getLookups() ) ); + $this->assertInstanceOf( Title::class, $cache->get( end( $titleIds ) ) ); + $this->assertEmpty( $cache->getLookups() ); } /** @@ -90,7 +90,7 @@ class EchoTitleLocalCacheTest extends MediaWikiTestCase { * @return Title */ protected function mockTitle() { - $title = $this->getMockBuilder( 'Title' ) + $title = $this->getMockBuilder( Title::class ) ->disableOriginalConstructor() ->getMock();