mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Echo
synced 2024-11-24 07:54:13 +00:00
Make use of PHP's …::class feature
Change-Id: Ifbb70f7b9d54e2e2bb713c8a13668344ac880a72
This commit is contained in:
parent
9e43e1988b
commit
d04b3f2710
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
use Wikibase\Client\Hooks\EchoNotificationsHandlers;
|
||||
|
||||
$IP = getenv( 'MW_INSTALL_PATH' );
|
||||
if ( $IP === false ) {
|
||||
$IP = __DIR__ . '/../../..';
|
||||
|
@ -468,8 +470,8 @@ class GenerateSampleNotifications extends Maintenance {
|
|||
}
|
||||
|
||||
private function generateWikibase( User $user, User $agent ) {
|
||||
if ( !class_exists( 'Wikibase\Client\Hooks\EchoNotificationsHandlers' ) ) {
|
||||
$this->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(),
|
||||
|
|
12
tests/phpunit/cache/TitleLocalCacheTest.php
vendored
12
tests/phpunit/cache/TitleLocalCacheTest.php
vendored
|
@ -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();
|
||||
|
||||
|
|
Loading…
Reference in a new issue