jenkins-bot has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/361422 )

Change subject: Fix and add missing type hints and imports
......................................................................


Fix and add missing type hints and imports

This patch mostly focuses on classes that got moved in MediaWiki core.

This also adds a few strict type hints where it makes sense.

Change-Id: I528ce0256998ce2cef6ba274f8b973e50324a0e4
---
M EducationProgram.hooks.php
M includes/ArticleStore.php
M includes/Events/EditEventCreator.php
M includes/Events/Event.php
M includes/Events/EventStore.php
M includes/ORMResult.php
M includes/Store/CourseStore.php
M includes/UPCUserCourseFinder.php
M includes/UserMergeArticleReviewersJob.php
M includes/actions/CompareAction.php
M includes/api/ApiListStudents.php
M includes/pages/EducationPage.php
M includes/rows/ORMRow.php
M includes/specials/SpecialMyCourses.php
M includes/tables/IORMTable.php
M includes/tables/ORMTable.php
M maintenance/importWEPFromDB.php
M tests/phpunit/ArticleAdderTest.php
M tests/phpunit/EPArticleTest.php
M tests/phpunit/Events/EditEventCreatorTest.php
M tests/phpunit/db/ORMTableTest.php
21 files changed, 95 insertions(+), 96 deletions(-)

Approvals:
  Krinkle: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/EducationProgram.hooks.php b/EducationProgram.hooks.php
index 2728b6b..ae98a26 100755
--- a/EducationProgram.hooks.php
+++ b/EducationProgram.hooks.php
@@ -4,9 +4,8 @@
 
 use DatabaseUpdater;
 use EchoEvent;
-use RecursiveDirectoryIterator;
-use RecursiveIteratorIterator;
-use SplFileInfo;
+use EducationProgram\Events\EditEventCreator;
+use EducationProgram\Events\EventStore;
 use Title;
 use User;
 use SkinTemplate;
@@ -454,11 +453,11 @@
 
                        // TODO: properly inject dependencies
                        $courseFinder = new UPCUserCourseFinder( $dbw );
-                       $eventCreator = new 
\EducationProgram\Events\EditEventCreator( $dbw, $courseFinder );
+                       $eventCreator = new EditEventCreator( $courseFinder );
 
                        $events = $eventCreator->getEventsForEdit( $article, 
$rev, $user );
                        if ( $events ) {
-                               $eventStore = new 
\EducationProgram\Events\EventStore( 'ep_events' );
+                               $eventStore = new EventStore( 'ep_events' );
 
                                $dbw->startAtomic( __METHOD__ );
                                foreach ( $events as $event ) {
diff --git a/includes/ArticleStore.php b/includes/ArticleStore.php
index b579acd..4d0c526 100644
--- a/includes/ArticleStore.php
+++ b/includes/ArticleStore.php
@@ -2,8 +2,8 @@
 
 namespace EducationProgram;
 
-use DatabaseBase;
 use InvalidArgumentException;
+use Wikimedia\Rdbms\Database;
 
 /**
  * Store for EPArticle objects.
@@ -84,7 +84,7 @@
         *
         * @since 0.3
         *
-        * @return DatabaseBase
+        * @return Database
         */
        protected function getReadConnection() {
                return wfGetDB( $this->readConnectionId );
@@ -96,7 +96,7 @@
         *
         * @since 0.3
         *
-        * @return DatabaseBase
+        * @return Database
         */
        protected function getWriteConnection() {
                return wfGetDB( DB_MASTER );
diff --git a/includes/Events/EditEventCreator.php 
b/includes/Events/EditEventCreator.php
index 53b2247..adb8b89 100644
--- a/includes/Events/EditEventCreator.php
+++ b/includes/Events/EditEventCreator.php
@@ -7,7 +7,6 @@
 use Revision;
 use User;
 use Page;
-use DatabaseBase;
 use MWNamespace;
 use Diff;
 use DiffOp;
@@ -45,27 +44,14 @@
 class EditEventCreator {
 
        /**
-        * @since 0.3
-        *
-        * @var DatabaseBase
-        */
-       private $db;
-
-       /**
-        * @since 0.3
-        *
         * @var UserCourseFinder
         */
        private $userCourseFinder;
 
        /**
-        * @since 0.3
-        *
-        * @param DatabaseBase $db
         * @param UserCourseFinder $userCourseFinder
         */
-       public function __construct( DatabaseBase $db, UserCourseFinder 
$userCourseFinder ) {
-               $this->db = $db;
+       public function __construct( UserCourseFinder $userCourseFinder ) {
                $this->userCourseFinder = $userCourseFinder;
        }
 
diff --git a/includes/Events/Event.php b/includes/Events/Event.php
index 8ac414b..78c3af0 100644
--- a/includes/Events/Event.php
+++ b/includes/Events/Event.php
@@ -2,8 +2,6 @@
 
 namespace EducationProgram\Events;
 
-use User;
-
 /**
  * Class representing a single Education Program event.
  *
diff --git a/includes/Events/EventStore.php b/includes/Events/EventStore.php
index e5eb075..b6600d8 100644
--- a/includes/Events/EventStore.php
+++ b/includes/Events/EventStore.php
@@ -2,15 +2,15 @@
 
 namespace EducationProgram\Events;
 
-use DatabaseBase;
 use InvalidArgumentException;
+use Wikimedia\Rdbms\Database;
 
 /**
  * Service via which EducationProgram events can be saved and queried.
  *
  * Side note:
  * This MySQL implementation of the interface pulls in some global
- * DatabaseBase object. Injecting a connection provider would be better,
+ * Database object. Injecting a connection provider would be better,
  * though sadly enough we do not have such an interface yet.
  *
  * This program is free software; you can redistribute it and/or modify
@@ -66,7 +66,7 @@
        /**
         * @since 0.3
         *
-        * @return DatabaseBase
+        * @return Database
         */
        private function getReadConnection() {
                return wfGetDB( $this->readConnectionId );
@@ -75,7 +75,7 @@
        /**
         * @since 0.3
         *
-        * @return DatabaseBase
+        * @return Database
         */
        private function getWriteConnection() {
                return wfGetDB( DB_MASTER );
diff --git a/includes/ORMResult.php b/includes/ORMResult.php
index 7c17715..a7d0bed 100644
--- a/includes/ORMResult.php
+++ b/includes/ORMResult.php
@@ -2,6 +2,8 @@
 
 namespace EducationProgram;
 
+use Wikimedia\Rdbms\ResultWrapper;
+
 /**
  * ORMIterator that takes a ResultWrapper object returned from
  * a select operation returning IORMRow objects (ie IORMTable::select).
@@ -34,7 +36,7 @@
 class ORMResult implements ORMIterator {
 
        /**
-        * @var \ResultWrapper
+        * @var ResultWrapper
         */
        protected $res;
 
@@ -55,9 +57,9 @@
 
        /**
         * @param IORMTable $table
-        * @param \ResultWrapper $res
+        * @param ResultWrapper $res
         */
-       public function __construct( IORMTable $table, \ResultWrapper $res ) {
+       public function __construct( IORMTable $table, ResultWrapper $res ) {
                $this->table = $table;
                $this->res = $res;
                $this->key = 0;
diff --git a/includes/Store/CourseStore.php b/includes/Store/CourseStore.php
index 27218ce..4e8d236 100644
--- a/includes/Store/CourseStore.php
+++ b/includes/Store/CourseStore.php
@@ -2,11 +2,11 @@
 
 namespace EducationProgram\Store;
 
-use DatabaseBase;
 use EducationProgram\Course;
 use EducationProgram\CourseNotFoundException;
 use EducationProgram\CourseTitleNotFoundException;
 use EducationProgram\Courses;
+use Wikimedia\Rdbms\Database;
 
 /**
  * This program is free software; you can redistribute it and/or modify
@@ -40,11 +40,11 @@
        private $tableName;
 
        /**
-        * @var DatabaseBase
+        * @var Database
         */
        private $readDatabase;
 
-       public function __construct( $tableName, DatabaseBase $readDatabase ) {
+       public function __construct( $tableName, Database $readDatabase ) {
                $this->readDatabase = $readDatabase;
                $this->tableName = $tableName;
        }
diff --git a/includes/UPCUserCourseFinder.php b/includes/UPCUserCourseFinder.php
index fe79a99..f5e0cf8 100644
--- a/includes/UPCUserCourseFinder.php
+++ b/includes/UPCUserCourseFinder.php
@@ -2,7 +2,7 @@
 
 namespace EducationProgram;
 
-use DatabaseBase;
+use Wikimedia\Rdbms\Database;
 
 /**
  * Implementation of the UserCourseFinder interface that works by doing
@@ -39,16 +39,16 @@
        /**
         * @since 0.3
         *
-        * @var DatabaseBase
+        * @var Database
         */
        private $db;
 
        /**
         * @since 0.3
         *
-        * @param DatabaseBase $db
+        * @param Database $db
         */
-       public function __construct( DatabaseBase $db ) {
+       public function __construct( Database $db ) {
                $this->db = $db;
        }
 
diff --git a/includes/UserMergeArticleReviewersJob.php 
b/includes/UserMergeArticleReviewersJob.php
index b69d5dd..2befda6 100644
--- a/includes/UserMergeArticleReviewersJob.php
+++ b/includes/UserMergeArticleReviewersJob.php
@@ -3,6 +3,7 @@
 namespace EducationProgram;
 
 use Job;
+use Title;
 
 /**
  * Job class for merging users in the article_reviewers column of the
@@ -36,7 +37,7 @@
        /**
         * @see Job::__construct() for info on the parameters passed through.
         */
-       public function __construct( $title, $params ) {
+       public function __construct( Title $title, $params ) {
                parent::__construct(
                        'educationProgramUserMergeArticleReviewers',
                        $title,
diff --git a/includes/actions/CompareAction.php 
b/includes/actions/CompareAction.php
index 6d4d2fc..4316b04 100644
--- a/includes/actions/CompareAction.php
+++ b/includes/actions/CompareAction.php
@@ -3,8 +3,6 @@
 namespace EducationProgram;
 
 use Linker;
-use Html;
-use Xml;
 
 /**
  * Action for comparing two revisions of a PageObject.
diff --git a/includes/api/ApiListStudents.php b/includes/api/ApiListStudents.php
index 6c22856..8d835bd 100644
--- a/includes/api/ApiListStudents.php
+++ b/includes/api/ApiListStudents.php
@@ -3,6 +3,7 @@
 namespace EducationProgram;
 
 use ApiBase;
+use ApiResult;
 use User;
 
 /**
@@ -232,15 +233,15 @@
         * @param ApiResult $results
         * @param int[]|int $courseIds A list of one or more course IDs
         * @param int $courseIndex
-        * @param $articleStore articleStore object
+        * @param ArticleStore $articleStore
         */
        protected function outputCSVofStudentProperties(
                $studentsList,
                $propName,
-               $results,
+               ApiResult $results,
                $courseIds,
                $courseIndex = null,
-               $articleStore
+               ArticleStore $articleStore
        ) {
                $studentProps = [];
 
@@ -281,8 +282,8 @@
         * @param string $courseRole
         */
        protected function outputListOfNonStudentParticipantsProperties(
-               $course,
-               $results,
+               Course $course,
+               ApiResult $results,
                $courseIndex,
                $courseRole
        ) {
@@ -338,15 +339,15 @@
         * @param \ApiResult $results
         * @param int $courseId
         * @param int $courseIndex
-        * @param $articleStore articleStore object
+        * @param ArticleStore $articleStore
         */
        protected function outputListOfStudentProperties(
                $studentsList,
                $propName,
-               $results,
+               ApiResult $results,
                $courseId = null,
                $courseIndex = null,
-               $articleStore
+               ArticleStore $articleStore
        ) {
                // Add the properties for each student to the result.
                $studentIndex = 0;
@@ -462,14 +463,14 @@
         * @param array $studentsList A set of student users
         * @param \ApiResult $results
         * @param int $courseIndex
-        * @param $articleStore articleStore object
+        * @param ArticleStore $articleStore
         */
        protected function outputCSVListofArticles(
                $courseIds,
                $studentsList,
-               $results,
+               ApiResult $results,
                $courseIndex = null,
-               $articleStore
+               ArticleStore $articleStore
        ) {
                $articleNames = $this->getArticleNames( $courseIds, 
$studentsList, $articleStore );
 
@@ -507,9 +508,9 @@
         */
        protected function outputCourseProperties(
                $courseId,
-               $course,
+               Course $course,
                $courseIndex,
-               $results
+               ApiResult $results
        ) {
                // Use an unambiguous name for the course that
                // includes the institution, title, term and ID.
@@ -551,10 +552,10 @@
         *
         * @param int[]|int $courseIds
         * @param array $students Student objects
-        * @param $articleStore articleStore object
+        * @param ArticleStore $articleStore
         * @return array
         */
-       protected function getArticleNames( $courseIds, $students, 
$articleStore ) {
+       protected function getArticleNames( $courseIds, $students, ArticleStore 
$articleStore ) {
                // Turn array of student objects into array of corresponding 
user IDs.
                foreach ( $students as $student ) {
                        $studentIds[] = $student->getId();
@@ -577,10 +578,10 @@
         *
         * @param int $courseId
         * @param $student Student object
-        * @param $articleStore articleStore object
+        * @param ArticleStore $articleStore
         * @return array
         */
-       protected function getEPArticles( $courseId, $student, $articleStore ) {
+       protected function getEPArticles( $courseId, $student, ArticleStore 
$articleStore ) {
                $studentId = $student->getId();
 
                // These are EPArticle objects, not conventional articles.
diff --git a/includes/pages/EducationPage.php b/includes/pages/EducationPage.php
index 4e51f92..68aaf3a 100644
--- a/includes/pages/EducationPage.php
+++ b/includes/pages/EducationPage.php
@@ -6,7 +6,6 @@
 use Title;
 use WikiPage;
 use Exception;
-use Language;
 
 /**
  * Abstract Page for interacting with a PageObject.
diff --git a/includes/rows/ORMRow.php b/includes/rows/ORMRow.php
index 421097b..7113c16 100644
--- a/includes/rows/ORMRow.php
+++ b/includes/rows/ORMRow.php
@@ -376,7 +376,7 @@
 
                $this->table->releaseConnection( $dbw );
 
-               // DatabaseBase::update does not always return true for success 
as documented...
+               // Database::update does not always return true for success as 
documented...
                return $success !== false;
        }
 
@@ -413,7 +413,7 @@
                        $options
                );
 
-               // DatabaseBase::insert does not always return true for success 
as documented...
+               // Database::insert does not always return true for success as 
documented...
                $success = $success !== false;
 
                if ( $success ) {
diff --git a/includes/specials/SpecialMyCourses.php 
b/includes/specials/SpecialMyCourses.php
index ee86eb7..b15dbe7 100644
--- a/includes/specials/SpecialMyCourses.php
+++ b/includes/specials/SpecialMyCourses.php
@@ -180,7 +180,7 @@
                $this->addCachedHTML(
                        function ( Course $course, IContextSource $context ) {
                                // TODO: inject dependency
-                               $eventStore = new 
\EducationProgram\Events\EventStore( 'ep_events' );
+                               $eventStore = new EventStore( 'ep_events' );
 
                                $query = new EventQuery();
 
diff --git a/includes/tables/IORMTable.php b/includes/tables/IORMTable.php
index 930594c..e904b1a 100644
--- a/includes/tables/IORMTable.php
+++ b/includes/tables/IORMTable.php
@@ -2,6 +2,11 @@
 
 namespace EducationProgram;
 
+use Wikimedia\Rdbms\Database;
+use Wikimedia\Rdbms\DBQueryError;
+use Wikimedia\Rdbms\LoadBalancer;
+use Wikimedia\Rdbms\ResultWrapper;
+
 /**
  * Interface for objects representing a single database table.
  * Documentation inline and at https://www.mediawiki.org/wiki/Manual:ORMTable
@@ -100,7 +105,7 @@
         * Selects the specified fields of the records matching the provided
         * conditions and returns them as DBDataObject. Field names get 
prefixed.
         *
-        * @see DatabaseBase::select()
+        * @see Database::select
         *
         * @since 1.20
         *
@@ -110,7 +115,7 @@
         * @param string|null $functionName
         *
         * @return ORMResult The result set
-        * @throws \DBQueryError If the query failed (even if the database was 
in ignoreErrors mode)
+        * @throws DBQueryError If the query failed (even if the database was 
in ignoreErrors mode)
         */
        public function select( $fields = null, array $conditions = [],
                array $options = [], $functionName = null );
@@ -141,8 +146,8 @@
         * @param array $options
         * @param null|string $functionName
         *
-        * @return \ResultWrapper
-        * @throws \DBQueryError If the query failed (even if the database was 
in ignoreErrors mode)
+        * @return ResultWrapper
+        * @throws DBQueryError If the query failed (even if the database was 
in ignoreErrors mode)
         */
        public function rawSelect( $fields = null, array $conditions = [],
                array $options = [], $functionName = null );
@@ -199,7 +204,7 @@
         * @param array $options
         * @param string|null $functionName
         *
-        * @return \ResultWrapper
+        * @return ResultWrapper
         */
        public function rawSelectRow( array $fields, array $conditions = [],
                array $options = [], $functionName = null );
@@ -250,7 +255,7 @@
         * Condition field names get prefixed.
         *
         * Note that this can be expensive on large tables.
-        * In such cases you might want to use DatabaseBase::estimateRowCount 
instead.
+        * In such cases you might want to use Database::estimateRowCount 
instead.
         *
         * @since 1.20
         *
@@ -342,7 +347,7 @@
         *
         * @since 1.20
         *
-        * @return \DatabaseBase The database object
+        * @return Database The database object
         */
        public function getReadDbConnection();
 
@@ -354,7 +359,7 @@
         *
         * @since 1.20
         *
-        * @return \DatabaseBase The database object
+        * @return Database The database object
         */
        public function getWriteDbConnection();
 
@@ -365,7 +370,7 @@
         *
         * @since 1.20
         *
-        * @return \LoadBalancer The database load balancer object
+        * @return LoadBalancer The database load balancer object
         */
        public function getLoadBalancer();
 
@@ -375,11 +380,11 @@
         *
         * @see LoadBalancer::reuseConnection
         *
-        * @param \DatabaseBase $db The database
+        * @param Database $db The database
         *
         * @since 1.20
         */
-       public function releaseConnection( \DatabaseBase $db );
+       public function releaseConnection( Database $db );
 
        /**
         * Update the records matching the provided conditions by
diff --git a/includes/tables/ORMTable.php b/includes/tables/ORMTable.php
index 639fa8d..d059c46 100644
--- a/includes/tables/ORMTable.php
+++ b/includes/tables/ORMTable.php
@@ -2,6 +2,10 @@
 
 namespace EducationProgram;
 
+use Wikimedia\Rdbms\Database;
+use Wikimedia\Rdbms\DBQueryError;
+use Wikimedia\Rdbms\ResultWrapper;
+
 /**
  * Abstract base class for representing a single database table.
  * Documentation inline and at https://www.mediawiki.org/wiki/Manual:ORMTable
@@ -223,7 +227,7 @@
         * @param string|null $functionName
         *
         * @return array Array of row objects
-        * @throws \DBQueryError If the query failed (even if the database was 
in ignoreErrors mode).
+        * @throws DBQueryError If the query failed (even if the database was 
in ignoreErrors mode).
         */
        public function selectObjects( $fields = null, array $conditions = [],
                array $options = [], $functionName = null
@@ -248,7 +252,7 @@
         * @param array $conditions
         * @param array $options
         * @param null|string $functionName
-        * @return \ResultWrapper
+        * @return ResultWrapper
         * @throws \Exception
         * @throws \MWException
         */
@@ -276,7 +280,7 @@
                if ( $result === false ) {
                        // Database connection was in "ignoreErrors" mode. We 
don't like that.
                        // So, we emulate the DBQueryError that should have 
been thrown.
-                       $error = new \DBQueryError(
+                       $error = new DBQueryError(
                                $dbr,
                                $dbr->lastError(),
                                $dbr->lastErrno(),
@@ -465,7 +469,7 @@
         * Condition field names get prefixed.
         *
         * Note that this can be expensive on large tables.
-        * In such cases you might want to use DatabaseBase::estimateRowCount 
instead.
+        * In such cases you might want to use Database::estimateRowCount 
instead.
         *
         * @since 1.20
         *
@@ -502,7 +506,7 @@
                        $this->getName(),
                        $conditions === [] ? '*' : $this->getPrefixedValues( 
$conditions ),
                        is_null( $functionName ) ? __METHOD__ : $functionName
-               ) !== false; // DatabaseBase::delete does not always return 
true for success as documented...
+               ) !== false; // Database::delete does not always return true 
for success as documented...
 
                $this->releaseConnection( $dbw );
 
@@ -628,7 +632,7 @@
         *
         * @since 1.20
         *
-        * @return \DatabaseBase The database object
+        * @return Database The database object
         */
        public function getReadDbConnection() {
                return $this->getConnection( $this->getReadDb(), [] );
@@ -642,7 +646,7 @@
         *
         * @since 1.20
         *
-        * @return \DatabaseBase The database object
+        * @return Database The database object
         */
        public function getWriteDbConnection() {
                return $this->getConnection( DB_MASTER, [] );
@@ -654,12 +658,12 @@
         *
         * @see LoadBalancer::reuseConnection
         *
-        * @param \DatabaseBase $db
+        * @param Database $db
         *
         * @since 1.20
         */
        // @codingStandardsIgnoreStart Suppress "useless method overriding" 
sniffer warning
-       public function releaseConnection( \DatabaseBase $db ) {
+       public function releaseConnection( Database $db ) {
                parent::releaseConnection( $db ); // just make it public
        }
        // @codingStandardsIgnoreEnd
@@ -684,7 +688,7 @@
                        $this->getPrefixedValues( $values ),
                        $this->getPrefixedValues( $conditions ),
                        __METHOD__
-               ) !== false; // DatabaseBase::update does not always return 
true for success as documented...
+               ) !== false; // Database::update does not always return true 
for success as documented...
 
                $this->releaseConnection( $dbw );
 
@@ -1016,7 +1020,7 @@
 
                $this->releaseConnection( $dbw );
 
-               // DatabaseBase::update does not always return true for success 
as documented...
+               // Database::update does not always return true for success as 
documented...
                return $success !== false;
        }
 
@@ -1041,7 +1045,7 @@
                        $options
                );
 
-               // DatabaseBase::insert does not always return true for success 
as documented...
+               // Database::insert does not always return true for success as 
documented...
                $success = $success !== false;
 
                if ( $success ) {
@@ -1103,7 +1107,7 @@
                        is_null( $functionName ) ? __METHOD__ : $functionName
                );
 
-               // DatabaseBase::delete does not always return true for success 
as documented...
+               // Database::delete does not always return true for success as 
documented...
                return $success !== false;
        }
 
@@ -1140,7 +1144,7 @@
                        [ "$fullField=$fullField" . ( $isNegative ? '-' : '+' ) 
. $absoluteAmount ],
                        $this->getPrefixedValues( $conditions ),
                        __METHOD__
-               ) !== false; // DatabaseBase::update does not always return 
true for success as documented...
+               ) !== false; // Database::update does not always return true 
for success as documented...
 
                $this->releaseConnection( $dbw );
 
diff --git a/maintenance/importWEPFromDB.php b/maintenance/importWEPFromDB.php
index 25dd40c..634c27e 100644
--- a/maintenance/importWEPFromDB.php
+++ b/maintenance/importWEPFromDB.php
@@ -15,7 +15,7 @@
 
 namespace EducationProgram;
 
-use ResultWrapper;
+use Wikimedia\Rdbms\ResultWrapper;
 
 $basePath = getenv( 'MW_INSTALL_PATH' ) !== false
        ? getenv( 'MW_INSTALL_PATH' )
diff --git a/tests/phpunit/ArticleAdderTest.php 
b/tests/phpunit/ArticleAdderTest.php
index bde3533..cfb5cc7 100644
--- a/tests/phpunit/ArticleAdderTest.php
+++ b/tests/phpunit/ArticleAdderTest.php
@@ -4,6 +4,7 @@
 
 use EducationProgram\ArticleAdder;
 use EducationProgram\ArticleStore;
+use User;
 
 /**
  * Tests for the EducationProgram\ArticleAdder class.
@@ -78,7 +79,12 @@
         * @param int[] $reviewers
         */
        public function testAddArticle(
-               $actionUser, $courseId, $userId, $pageId, $pageTitle, array 
$reviewers
+               User $actionUser,
+               $courseId,
+               $userId,
+               $pageId,
+               $pageTitle,
+               array $reviewers
        ) {
                $adder = $this->newAdder();
 
diff --git a/tests/phpunit/EPArticleTest.php b/tests/phpunit/EPArticleTest.php
index 86131e3..4a846e1 100644
--- a/tests/phpunit/EPArticleTest.php
+++ b/tests/phpunit/EPArticleTest.php
@@ -281,14 +281,14 @@
        }
 
        public function testLogAdditionNonExistingPage() {
-               $course = $this->getMock( 'EducationProgram\Course' );
+               $course = $this->getMock( Course::class );
 
                $course->expects( $this->any() )
                        ->method( 'getTitle' )
                        ->will( $this->returnValue( \Title::newFromText( 
'Foobar' ) ) );
 
                $article = $this->getMock(
-                       'EducationProgram\EPArticle',
+                       EPArticle::class,
                        [ 'getCourse', 'getUser' ],
                        [ 1, 2, 3, 0, 'sdncjsdhbfkdhbgsfxdfg', [] ]
                );
diff --git a/tests/phpunit/Events/EditEventCreatorTest.php 
b/tests/phpunit/Events/EditEventCreatorTest.php
index f6990d6..422c2e0 100644
--- a/tests/phpunit/Events/EditEventCreatorTest.php
+++ b/tests/phpunit/Events/EditEventCreatorTest.php
@@ -67,7 +67,7 @@
         * @dataProvider getEventsForEditProvider
         */
        public function testGetEventsForEdit( Page $article, Revision $rev, 
User $user ) {
-               $eventCreator = new EditEventCreator( wfGetDB( DB_MASTER ), new 
MockUserCourseFinder() );
+               $eventCreator = new EditEventCreator( new 
MockUserCourseFinder() );
 
                $events = $eventCreator->getEventsForEdit( $article, $rev, 
$user );
 
diff --git a/tests/phpunit/db/ORMTableTest.php 
b/tests/phpunit/db/ORMTableTest.php
index effb206..750e2e3 100644
--- a/tests/phpunit/db/ORMTableTest.php
+++ b/tests/phpunit/db/ORMTableTest.php
@@ -2,9 +2,9 @@
 
 namespace EducationProgram\Tests;
 
-use EducationProgram\IORMRow;
 use EducationProgram\IORMTable;
 use EducationProgram\ORMTable;
+use Title;
 
 /**
  * Abstract class to construct tests for ORMTable deriving classes.
@@ -103,7 +103,7 @@
         * @return string
         */
        public function getRowClass() {
-               return 'Title';
+               return Title::class;
        }
 
        /**
@@ -114,7 +114,7 @@
         * @return Title
         */
        public function newRow( array $data, $loadDefaults = false ) {
-               return \Title::makeTitle( $data['namespace'], $data['title'] );
+               return Title::makeTitle( $data['namespace'], $data['title'] );
        }
 
        /**

-- 
To view, visit https://gerrit.wikimedia.org/r/361422
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I528ce0256998ce2cef6ba274f8b973e50324a0e4
Gerrit-PatchSet: 3
Gerrit-Project: mediawiki/extensions/EducationProgram
Gerrit-Branch: master
Gerrit-Owner: Thiemo Mättig (WMDE) <thiemo.maet...@wikimedia.de>
Gerrit-Reviewer: AndyRussG <andrew.green...@gmail.com>
Gerrit-Reviewer: Bartosz Dziewoński <matma....@gmail.com>
Gerrit-Reviewer: Jeroen De Dauw <jeroended...@gmail.com>
Gerrit-Reviewer: Krinkle <krinklem...@gmail.com>
Gerrit-Reviewer: Ladsgroup <ladsgr...@gmail.com>
Gerrit-Reviewer: Reedy <re...@wikimedia.org>
Gerrit-Reviewer: Thiemo Mättig (WMDE) <thiemo.maet...@wikimedia.de>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to