tests: Namespace the PHP classes

This might make dependencies easier to find.

Change-Id: I158fd9f63f18a2b8da0368ac95d5fb5aa9bca3ff
This commit is contained in:
James D. Forrester 2024-02-22 10:31:00 -05:00 committed by Reedy
parent 7f9637e543
commit 291ea47dd3
39 changed files with 130 additions and 4 deletions

View file

@ -1153,8 +1153,8 @@
"MediaWiki\\Extension\\Notifications\\": "includes/"
},
"TestAutoloadClasses": {
"EchoAbstractMapperStub": "tests/phpunit/Mapper/EchoAbstractMapperStub.php",
"EchoExecuteFirstArgumentStub": "tests/phpunit/Mapper/EchoExecuteFirstArgumentStub.php"
"MediaWiki\\Extension\\Notifications\\Test\\EchoAbstractMapperStub": "tests/phpunit/Mapper/EchoAbstractMapperStub.php",
"MediaWiki\\Extension\\Notifications\\Test\\Integration\\Mapper\\EchoExecuteFirstArgumentStub": "tests/phpunit/Mapper/EchoExecuteFirstArgumentStub.php"
},
"TestAutoloadNamespaces": {
"MediaWiki\\Extension\\Notifications\\Test\\": "tests/phpunit/",

View file

@ -1,5 +1,7 @@
<?php
namespace MediaWiki\Extension\Notifications\Test\API;
use MediaWiki\Tests\Api\ApiTestCase;
/**

View file

@ -1,5 +1,7 @@
<?php
namespace MediaWiki\Extension\Notifications\Test\API;
use MediaWiki\Tests\Api\ApiTestCase;
/**

View file

@ -1,5 +1,8 @@
<?php
namespace MediaWiki\Extension\Notifications\Test\API;
use MediaWiki\Api\ApiUsageException;
use MediaWiki\Extension\Notifications\Push\Utils;
use MediaWiki\Extension\Notifications\Services;
use MediaWiki\Tests\Api\ApiTestCase;

View file

@ -1,5 +1,8 @@
<?php
namespace MediaWiki\Extension\Notifications\Test\API;
use MediaWiki\Api\ApiUsageException;
use MediaWiki\Extension\Notifications\Push\Utils;
use MediaWiki\Extension\Notifications\Services;
use MediaWiki\Tests\Api\ApiTestCase;

View file

@ -1,5 +1,8 @@
<?php
namespace MediaWiki\Extension\Notifications\Test\API;
use MediaWiki\Api\ApiUsageException;
use MediaWiki\Tests\Api\ApiTestCase;
/**

View file

@ -1,7 +1,10 @@
<?php
namespace MediaWiki\Extension\Notifications\Test\Cache;
use MediaWiki\Extension\Notifications\Cache\TitleLocalCache;
use MediaWiki\Title\Title;
use MediaWikiIntegrationTestCase;
use Wikimedia\TestingAccessWrapper;
/**

View file

@ -1,5 +1,8 @@
<?php
namespace MediaWiki\Extension\Notifications\Test\Controller;
use MapCacheLRU;
use MediaWiki\Extension\Notifications\AttributeManager;
use MediaWiki\Extension\Notifications\Controller\NotificationController;
use MediaWiki\Extension\Notifications\Model\Event;
@ -8,6 +11,7 @@ use MediaWiki\Title\Title;
use MediaWiki\User\Options\UserOptionsLookup;
use MediaWiki\User\User;
use MediaWiki\Utils\MWTimestamp;
use MediaWikiIntegrationTestCase;
use Wikimedia\TestingAccessWrapper;
/**

View file

@ -1,6 +1,10 @@
<?php
namespace MediaWiki\Extension\Notifications\Test;
use MediaWiki\Extension\Notifications\DbFactory;
use MediaWikiIntegrationTestCase;
use ReflectionClass;
use Wikimedia\Rdbms\IDatabase;
use Wikimedia\Rdbms\ILoadBalancer;

View file

@ -1,15 +1,21 @@
<?php
namespace MediaWiki\Extension\Notifications\Test;
// phpcs:disable Generic.Files.LineLength -- Long html test examples
use MediaWiki\CommentStore\CommentStoreComment;
use MediaWiki\Content\WikitextContent;
use MediaWiki\Extension\Notifications\DiscussionParser;
use MediaWiki\Extension\Notifications\Model\Event;
use MediaWiki\MainConfigNames;
use MediaWiki\Registration\ExtensionRegistry;
use MediaWiki\Revision\MutableRevisionRecord;
use MediaWiki\Revision\SlotRecord;
use MediaWiki\Title\Title;
use MediaWiki\User\User;
use MediaWikiIntegrationTestCase;
use ReflectionObject;
use Wikimedia\TestingAccessWrapper;
/**

View file

@ -1,8 +1,11 @@
<?php
namespace MediaWiki\Extension\Notifications\Test;
use MediaWiki\Extension\Notifications\Hooks as EchoHooks;
use MediaWiki\Extension\Notifications\Services;
use MediaWiki\MainConfigNames;
use MediaWikiIntegrationTestCase;
class EchoHooksTest extends MediaWikiIntegrationTestCase {
/**

View file

@ -1,7 +1,10 @@
<?php
namespace MediaWiki\Extension\Notifications\Test\Formatters;
use MediaWiki\Extension\Notifications\Formatters\EchoPresentationModelSection;
use MediaWiki\Extension\Notifications\Model\Event;
use MediaWikiIntegrationTestCase;
/**
* @covers \MediaWiki\Extension\Notifications\Formatters\EchoPresentationModelSection

View file

@ -1,5 +1,7 @@
<?php
namespace MediaWiki\Extension\Notifications\Test;
use MediaWiki\Extension\Notifications\Mapper\AbstractMapper;
/**

View file

@ -1,5 +1,7 @@
<?php
namespace MediaWiki\Extension\Notifications\Test\Integration\Mapper;
use PHPUnit\Framework\MockObject\Invocation;
use PHPUnit\Framework\MockObject\Invocation\StaticInvocation;
use PHPUnit\Framework\MockObject\Stub\Stub;
@ -7,10 +9,10 @@ use PHPUnit\Framework\MockObject\Stub\Stub;
class EchoExecuteFirstArgumentStub implements Stub {
public function invoke( Invocation $invocation ) {
if ( !$invocation instanceof StaticInvocation ) {
throw new PHPUnit\Framework\Exception( 'wrong invocation type' );
throw new \PHPUnit\Framework\Exception( 'wrong invocation type' );
}
if ( !$invocation->arguments ) {
throw new PHPUnit\Framework\Exception( 'Method call must have an argument' );
throw new \PHPUnit\Framework\Exception( 'Method call must have an argument' );
}
return call_user_func( reset( $invocation->arguments ) );

View file

@ -1,8 +1,12 @@
<?php
namespace MediaWiki\Extension\Notifications\Test\Integration\Mapper;
use InvalidArgumentException;
use MediaWiki\Extension\Notifications\DbFactory;
use MediaWiki\Extension\Notifications\Mapper\EventMapper;
use MediaWiki\Extension\Notifications\Model\Event;
use MediaWikiIntegrationTestCase;
use Wikimedia\Rdbms\FakeResultWrapper;
use Wikimedia\Rdbms\IDatabase;
use Wikimedia\Rdbms\InsertQueryBuilder;

View file

@ -1,10 +1,13 @@
<?php
namespace MediaWiki\Extension\Notifications\Test\Integration\Mapper;
use MediaWiki\Extension\Notifications\DbFactory;
use MediaWiki\Extension\Notifications\Mapper\NotificationMapper;
use MediaWiki\Extension\Notifications\Model\Notification;
use MediaWiki\MainConfigNames;
use MediaWiki\User\User;
use MediaWikiIntegrationTestCase;
use Wikimedia\Rdbms\DeleteQueryBuilder;
use Wikimedia\Rdbms\FakeResultWrapper;
use Wikimedia\Rdbms\IDatabase;

View file

@ -1,8 +1,12 @@
<?php
namespace MediaWiki\Extension\Notifications\Test\Integration\Model;
use InvalidArgumentException;
use MediaWiki\Extension\Notifications\Model\Event;
use MediaWiki\Extension\Notifications\Model\Notification;
use MediaWiki\Extension\Notifications\Model\TargetPage;
use MediaWikiIntegrationTestCase;
use Wikimedia\Rdbms\IDatabase;
use Wikimedia\Rdbms\ILoadBalancer;
use Wikimedia\Rdbms\LBFactory;

View file

@ -1,5 +1,8 @@
<?php
namespace MediaWiki\Extension\Notifications\Test;
use Exception;
use MediaWiki\Extension\Notifications\EmailFormat;
use MediaWiki\Extension\Notifications\Gateway\UserNotificationGateway;
use MediaWiki\Extension\Notifications\Mapper\NotificationMapper;
@ -13,6 +16,8 @@ use MediaWiki\User\TalkPageNotificationManager;
use MediaWiki\User\User;
use MediaWiki\User\UserFactory;
use MediaWiki\User\UserGroupManager;
use MediaWikiIntegrationTestCase;
use Wikimedia\ObjectCache\WANObjectCache;
use Wikimedia\Rdbms\IDatabase;
/**

View file

@ -1,5 +1,9 @@
<?php
namespace MediaWiki\Extension\Notifications\Test;
use MediaWikiIntegrationTestCase;
class NotificationStructureTest extends MediaWikiIntegrationTestCase {
/**
* @coversNothing

View file

@ -1,11 +1,14 @@
<?php
namespace MediaWiki\Extension\Notifications\Test;
use MediaWiki\Context\DerivativeContext;
use MediaWiki\Context\RequestContext;
use MediaWiki\Extension\Notifications\Mapper\NotificationMapper;
use MediaWiki\Extension\Notifications\Model\Event;
use MediaWiki\User\User;
use MediaWiki\User\UserIdentity;
use MediaWikiIntegrationTestCase;
/**
* Tests for the built in notification types

View file

@ -1,8 +1,11 @@
<?php
namespace MediaWiki\Extension\Notifications\Test;
use MediaWiki\Extension\Notifications\SummaryParser;
use MediaWiki\User\User;
use MediaWiki\User\UserIdentity;
use MediaWikiIntegrationTestCase;
/**
* @group Echo

View file

@ -1,5 +1,7 @@
<?php
namespace MediaWiki\Extension\Notifications\Test;
use MediaWiki\Extension\Notifications\Model\Event;
use MediaWiki\Tests\Api\ApiTestCase;

View file

@ -1,8 +1,11 @@
<?php
namespace MediaWiki\Extension\Notifications\Test;
use MediaWiki\Extension\Notifications\DbFactory;
use MediaWiki\Extension\Notifications\Mapper\NotificationMapper;
use MediaWiki\Title\Title;
use MediaWikiIntegrationTestCase;
use Wikimedia\Rdbms\Platform\ISQLPlatform;
/**

View file

@ -1,8 +1,11 @@
<?php
namespace MediaWiki\Extension\Notifications\Test;
use MediaWiki\Extension\Notifications\DbFactory;
use MediaWiki\Extension\Notifications\UnreadWikis;
use MediaWiki\Utils\MWTimestamp;
use MediaWikiIntegrationTestCase;
use Wikimedia\TestingAccessWrapper;
/**

View file

@ -1,6 +1,11 @@
<?php
namespace MediaWiki\Extension\Notifications\Test\Integration\Push;
use MediaWiki\Extension\Notifications\Services;
use MediaWikiIntegrationTestCase;
use MockHttpTrait;
use MWHttpRequest;
use Wikimedia\TestingAccessWrapper;
/** @covers \MediaWiki\Extension\Notifications\Push\NotificationServiceClient */

View file

@ -1,9 +1,12 @@
<?php
namespace MediaWiki\Extension\Notifications\Test\Integration\Push;
use MediaWiki\Extension\Notifications\Push\NotificationRequestJob;
use MediaWiki\Extension\Notifications\Push\PushNotifier;
use MediaWiki\User\CentralId\CentralIdLookup;
use MediaWiki\User\User;
use MediaWikiIntegrationTestCase;
use Wikimedia\TestingAccessWrapper;
/** @covers \MediaWiki\Extension\Notifications\Push\PushNotifier */

View file

@ -1,7 +1,10 @@
<?php
namespace MediaWiki\Extension\Notifications\Test\Integration\Push;
use MediaWiki\Extension\Notifications\Push\Utils;
use MediaWiki\Extension\Notifications\Services;
use MediaWikiIntegrationTestCase;
use Wikimedia\TestingAccessWrapper;
/**

View file

@ -1,6 +1,9 @@
<?php
namespace MediaWiki\Extension\Notifications\Test\Integration\Push;
use MediaWiki\Extension\Notifications\Push\Utils;
use MediaWikiIntegrationTestCase;
/**
* @covers \MediaWiki\Extension\Notifications\Push\Utils

View file

@ -1,7 +1,10 @@
<?php
namespace MediaWiki\Extension\Notifications\Test\Maintenance;
use MediaWiki\Extension\Notifications\SuppressionRowUpdateGenerator;
use MediaWiki\Title\Title;
use MediaWikiIntegrationTestCase;
use PHPUnit\Framework\TestCase;
/**

View file

@ -1,10 +1,13 @@
<?php
namespace MediaWiki\Extension\Notifications\Test\Unit;
use MediaWiki\Extension\Notifications\AttributeManager;
use MediaWiki\User\Options\UserOptionsLookup;
use MediaWiki\User\UserGroupManager;
use MediaWiki\User\UserIdentity;
use MediaWiki\User\UserIdentityValue;
use MediaWikiUnitTestCase;
/**
* @covers \MediaWiki\Extension\Notifications\AttributeManager

View file

@ -1,7 +1,10 @@
<?php
namespace MediaWiki\Extension\Notifications\Test\Unit;
use MediaWiki\Extension\Notifications\Bundler;
use MediaWiki\Extension\Notifications\Model\Notification;
use MediaWikiUnitTestCase;
/**
* @covers \MediaWiki\Extension\Notifications\Bundler

View file

@ -1,6 +1,9 @@
<?php
namespace MediaWiki\Extension\Notifications\Test\Unit;
use MediaWiki\Extension\Notifications\DiscussionParser;
use MediaWikiUnitTestCase;
/**
* @covers \MediaWiki\Extension\Notifications\DiffParser

View file

@ -1,9 +1,12 @@
<?php
namespace MediaWiki\Extension\Notifications\Test\Unit;
use MediaWiki\Config\HashConfig;
use MediaWiki\Extension\Notifications\DbFactory;
use MediaWiki\Extension\Notifications\Gateway\UserNotificationGateway;
use MediaWiki\User\User;
use MediaWikiUnitTestCase;
use Wikimedia\Rdbms\FakeResultWrapper;
use Wikimedia\Rdbms\IDatabase;
use Wikimedia\Rdbms\SelectQueryBuilder;

View file

@ -1,7 +1,11 @@
<?php
namespace MediaWiki\Extension\Notifications\Test\Unit;
use ArrayIterator;
use MediaWiki\Extension\Notifications\Iterator\CallbackIterator;
use MediaWiki\Extension\Notifications\Iterator\FilteredSequentialIterator;
use MediaWikiUnitTestCase;
/**
* @covers \MediaWiki\Extension\Notifications\Iterator\CallbackIterator

View file

@ -1,6 +1,12 @@
<?php
namespace MediaWiki\Extension\Notifications\Test\Unit;
use InvalidArgumentException;
use MediaWiki\Extension\Notifications\Mapper\AbstractMapper;
use MediaWiki\Extension\Notifications\Test\EchoAbstractMapperStub;
use MediaWikiUnitTestCase;
use ReflectionClass;
/**
* @covers \MediaWiki\Extension\Notifications\Mapper\AbstractMapper

View file

@ -1,8 +1,11 @@
<?php
namespace MediaWiki\Extension\Notifications\Test\Unit;
use MediaWiki\Extension\Notifications\DbFactory;
use MediaWiki\Extension\Notifications\Mapper\TargetPageMapper;
use MediaWiki\Extension\Notifications\Model\TargetPage;
use MediaWikiUnitTestCase;
use Wikimedia\Rdbms\FakeResultWrapper;
use Wikimedia\Rdbms\IDatabase;
use Wikimedia\Rdbms\InsertQueryBuilder;

View file

@ -1,8 +1,12 @@
<?php
namespace MediaWiki\Extension\Notifications\Test\Unit;
use InvalidArgumentException;
use MediaWiki\Extension\Notifications\Model\Event;
use MediaWiki\Extension\Notifications\Model\TargetPage;
use MediaWiki\Title\Title;
use MediaWikiUnitTestCase;
/**
* @covers \MediaWiki\Extension\Notifications\Model\TargetPage

View file

@ -1,7 +1,10 @@
<?php
namespace MediaWiki\Extension\Notifications\Test\Unit;
use MediaWiki\Extension\Notifications\Push\NotificationServiceClient;
use MediaWiki\Extension\Notifications\Push\Subscription;
use MediaWikiUnitTestCase;
/** @covers \MediaWiki\Extension\Notifications\Push\NotificationServiceClient */
class NotificationServiceClientUnitTest extends MediaWikiUnitTestCase {

View file

@ -1,6 +1,9 @@
<?php
namespace MediaWiki\Extension\Notifications\Test\Unit;
use MediaWiki\Extension\Notifications\Push\Subscription;
use MediaWikiUnitTestCase;
use Wikimedia\Timestamp\ConvertibleTimestamp;
/** @covers \MediaWiki\Extension\Notifications\Push\Subscription */