dépôts
/
lhc
/
web
/
wiklou.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Implement mw.requestIdleCallback for deferred background tasks
[lhc/web/wiklou.git]
/
tests
/
phpunit
/
MediaWikiTestCase.php
diff --git
a/tests/phpunit/MediaWikiTestCase.php
b/tests/phpunit/MediaWikiTestCase.php
index
7dc7027
..
9e4a984
100644
(file)
--- a/
tests/phpunit/MediaWikiTestCase.php
+++ b/
tests/phpunit/MediaWikiTestCase.php
@@
-103,6
+103,12
@@
abstract class MediaWikiTestCase extends PHPUnit_Framework_TestCase {
*/
ObjectCache::$instances[CACHE_DB] = new HashBagOStuff;
*/
ObjectCache::$instances[CACHE_DB] = new HashBagOStuff;
+ // Sandbox APC by replacing with in-process hash instead.
+ // Ensures values are removed between tests.
+ ObjectCache::$instances['apc'] =
+ ObjectCache::$instances['xcache'] =
+ ObjectCache::$instances['wincache'] = new HashBagOStuff;
+
$needsResetDB = false;
if ( $this->needsDB() ) {
$needsResetDB = false;
if ( $this->needsDB() ) {
@@
-175,7
+181,6
@@
abstract class MediaWikiTestCase extends PHPUnit_Framework_TestCase {
$fileName = $this->getNewTempFile();
// Converting the temporary /file/ to a /directory/
$fileName = $this->getNewTempFile();
// Converting the temporary /file/ to a /directory/
- //
// The following is not atomic, but at least we now have a single place,
// where temporary directory creation is bundled and can be improved
unlink( $fileName );
// The following is not atomic, but at least we now have a single place,
// where temporary directory creation is bundled and can be improved
unlink( $fileName );
@@
-202,7
+207,7
@@
abstract class MediaWikiTestCase extends PHPUnit_Framework_TestCase {
if ( $this->needsDB() && $this->db ) {
// Clean up open transactions
while ( $this->db->trxLevel() > 0 ) {
if ( $this->needsDB() && $this->db ) {
// Clean up open transactions
while ( $this->db->trxLevel() > 0 ) {
- $this->db->rollback();
+ $this->db->rollback(
__METHOD__, 'flush'
);
}
}
}
}
@@
-217,7
+222,9
@@
abstract class MediaWikiTestCase extends PHPUnit_Framework_TestCase {
protected function tearDown() {
$status = ob_get_status();
protected function tearDown() {
$status = ob_get_status();
- if ( isset( $status['name'] ) && $status['name'] === 'MediaWikiTestCase::wfResetOutputBuffersBarrier' ) {
+ if ( isset( $status['name'] ) &&
+ $status['name'] === 'MediaWikiTestCase::wfResetOutputBuffersBarrier'
+ ) {
ob_end_flush();
}
ob_end_flush();
}
@@
-234,7
+241,7
@@
abstract class MediaWikiTestCase extends PHPUnit_Framework_TestCase {
if ( $this->needsDB() && $this->db ) {
// Clean up open transactions
while ( $this->db->trxLevel() > 0 ) {
if ( $this->needsDB() && $this->db ) {
// Clean up open transactions
while ( $this->db->trxLevel() > 0 ) {
- $this->db->rollback();
+ $this->db->rollback(
__METHOD__, 'flush'
);
}
}
}
}
@@
-485,13
+492,13
@@
abstract class MediaWikiTestCase extends PHPUnit_Framework_TestCase {
if ( $user->idForName() == 0 ) {
$user->addToDatabase();
if ( $user->idForName() == 0 ) {
$user->addToDatabase();
- $user->setPassword( 'UTSysopPassword' );
-
- $user->addGroup( 'sysop' );
- $user->addGroup( 'bureaucrat' );
- $user->saveSettings();
+ TestUser::setPasswordForUser( $user, 'UTSysopPassword' );
}
}
+ // Always set groups, because $this->resetDB() wipes them out
+ $user->addGroup( 'sysop' );
+ $user->addGroup( 'bureaucrat' );
+
// Make 1 page with 1 revision
$page = WikiPage::factory( Title::newFromText( 'UTPage' ) );
if ( $page->getId() == 0 ) {
// Make 1 page with 1 revision
$page = WikiPage::factory( Title::newFromText( 'UTPage' ) );
if ( $page->getId() == 0 ) {
@@
-1151,7
+1158,7
@@
abstract class MediaWikiTestCase extends PHPUnit_Framework_TestCase {
/**
* Note: we are overriding this method to remove the deprecated error
/**
* Note: we are overriding this method to remove the deprecated error
- * @see https://
bugzilla.wikimedia.org/show_bug.cgi?id=69
505
+ * @see https://
phabricator.wikimedia.org/T71
505
* @see https://github.com/sebastianbergmann/phpunit/issues/1292
* @deprecated
*
* @see https://github.com/sebastianbergmann/phpunit/issues/1292
* @deprecated
*
@@
-1161,7
+1168,7
@@
abstract class MediaWikiTestCase extends PHPUnit_Framework_TestCase {
* @param bool $isHtml
*/
public static function assertTag( $matcher, $actual, $message = '', $isHtml = true ) {
* @param bool $isHtml
*/
public static function assertTag( $matcher, $actual, $message = '', $isHtml = true ) {
- //trigger_error(__METHOD__ . ' is deprecated', E_USER_DEPRECATED);
+ //
trigger_error(__METHOD__ . ' is deprecated', E_USER_DEPRECATED);
self::assertTrue( self::tagMatch( $matcher, $actual, $isHtml ), $message );
}
self::assertTrue( self::tagMatch( $matcher, $actual, $isHtml ), $message );
}
@@
-1176,7
+1183,7
@@
abstract class MediaWikiTestCase extends PHPUnit_Framework_TestCase {
* @param bool $isHtml
*/
public static function assertNotTag( $matcher, $actual, $message = '', $isHtml = true ) {
* @param bool $isHtml
*/
public static function assertNotTag( $matcher, $actual, $message = '', $isHtml = true ) {
- //trigger_error(__METHOD__ . ' is deprecated', E_USER_DEPRECATED);
+ //
trigger_error(__METHOD__ . ' is deprecated', E_USER_DEPRECATED);
self::assertFalse( self::tagMatch( $matcher, $actual, $isHtml ), $message );
}
self::assertFalse( self::tagMatch( $matcher, $actual, $isHtml ), $message );
}