Hashar has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/64569


Change subject: test: LinkCache no more rely on a database access
......................................................................

test: LinkCache no more rely on a database access

The MediaWiki LinkCache class cache link existences via a process cache
that falls back to a database lookup.  This makes lot of tests to
require a database access when it is not really needed.

This patch creates a mocking class that extends the LinkCache but does
not fallback on the database at all.

Change-Id: I14153e0e647b2df20fba2e4e5d5dda4d7b5062a9
---
M tests/TestsAutoLoader.php
M tests/phpunit/phpunit.php
2 files changed, 4 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/69/64569/1

diff --git a/tests/TestsAutoLoader.php b/tests/TestsAutoLoader.php
index 4a6e3fb..87a4497 100644
--- a/tests/TestsAutoLoader.php
+++ b/tests/TestsAutoLoader.php
@@ -83,6 +83,7 @@
        'MockFSFile' => "$testDir/phpunit/mocks/filebackend/MockFSFile.php",
        'MockFileBackend' => 
"$testDir/phpunit/mocks/filebackend/MockFileBackend.php",
        'MockBitmapHandler' => 
"$testDir/phpunit/mocks/media/MockBitmapHandler.php",
+       'MockLinkCache' => "$testDir/phpunit/mocks/cache/MockLinkCache.php",
 
        # tests/phpunit/languages
        'LanguageClassesTestCase' => 
"$testDir/phpunit/languages/LanguageClassesTestCase.php",
diff --git a/tests/phpunit/phpunit.php b/tests/phpunit/phpunit.php
index da1b8fd..375ae93 100755
--- a/tests/phpunit/phpunit.php
+++ b/tests/phpunit/phpunit.php
@@ -59,6 +59,9 @@
                                return false;
                        }
                );
+
+               # Mock the LinkCache to no more rely on a database backend
+               LinkCache::setSingleton( new MockLinkCache() );
        }
 
        public function execute() {

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I14153e0e647b2df20fba2e4e5d5dda4d7b5062a9
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Hashar <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to