public function testSetCacheModeUnrecognized() {
$api = new ApiMain();
$api->setCacheMode( 'unrecognized' );
+ $this->resetServices();
$this->assertSame(
'private',
TestingAccessWrapper::newFromObject( $api )->mCacheMode,
public function testSetCacheModePrivateWiki() {
$this->setGroupPermissions( '*', 'read', false );
-
$wrappedApi = TestingAccessWrapper::newFromObject( new ApiMain() );
$wrappedApi->setCacheMode( 'public' );
$this->assertSame( 'private', $wrappedApi->mCacheMode );
} else {
$user = new User();
}
- $user->mRights = $rights;
+ $this->overrideUserPermissions( $user, $rights );
try {
$this->doApiRequest( [
'action' => 'query',
* @param int $status Expected response status
* @param array $options Array of options:
* post => true Request is a POST
- * cdn => true CDN is enabled ($wgUseSquid)
+ * cdn => true CDN is enabled ($wgUseCdn)
*/
public function testCheckConditionalRequestHeaders(
$headers, $conditions, $status, $options = []
$priv->mInternalMode = false;
if ( !empty( $options['cdn'] ) ) {
- $this->setMwGlobals( 'wgUseSquid', true );
+ $this->setMwGlobals( 'wgUseCdn', true );
}
// Can't do this in TestSetup.php because Setup.php will override it
}
public static function provideCheckConditionalRequestHeaders() {
- global $wgSquidMaxage;
+ global $wgCdnMaxAge;
$now = time();
return [
[ [ 'If-Modified-Since' => 'a potato' ],
[ 'last-modified' => wfTimestamp( TS_MW, $now - 1 ) ], 200 ],
- // Anything before $wgSquidMaxage seconds ago should be considered
+ // Anything before $wgCdnMaxAge seconds ago should be considered
// expired.
'If-Modified-Since with CDN post-expiry' =>
- [ [ 'If-Modified-Since' => wfTimestamp( TS_RFC2822, $now - $wgSquidMaxage * 2 ) ],
- [ 'last-modified' => wfTimestamp( TS_MW, $now - $wgSquidMaxage * 3 ) ],
+ [ [ 'If-Modified-Since' => wfTimestamp( TS_RFC2822, $now - $wgCdnMaxAge * 2 ) ],
+ [ 'last-modified' => wfTimestamp( TS_MW, $now - $wgCdnMaxAge * 3 ) ],
200, [ 'cdn' => true ] ],
'If-Modified-Since with CDN pre-expiry' =>
- [ [ 'If-Modified-Since' => wfTimestamp( TS_RFC2822, $now - $wgSquidMaxage / 2 ) ],
- [ 'last-modified' => wfTimestamp( TS_MW, $now - $wgSquidMaxage * 3 ) ],
+ [ [ 'If-Modified-Since' => wfTimestamp( TS_RFC2822, $now - $wgCdnMaxAge / 2 ) ],
+ [ 'last-modified' => wfTimestamp( TS_MW, $now - $wgCdnMaxAge * 3 ) ],
304, [ 'cdn' => true ] ],
];
}