MediaWiki REL1_30
CdnCacheUpdateTest.php
Go to the documentation of this file.
1<?php
2
3use Wikimedia\TestingAccessWrapper;
4
6 public function testPurgeMergeWeb() {
7 $this->setMwGlobals( 'wgCommandLineMode', false );
8
9 $urls1 = [];
10 $title = Title::newMainPage();
11 $urls1[] = $title->getCanonicalURL( '?x=1' );
12 $urls1[] = $title->getCanonicalURL( '?x=2' );
13 $urls1[] = $title->getCanonicalURL( '?x=3' );
14 $update1 = new CdnCacheUpdate( $urls1 );
15 DeferredUpdates::addUpdate( $update1 );
16
17 $urls2 = [];
18 $urls2[] = $title->getCanonicalURL( '?x=2' );
19 $urls2[] = $title->getCanonicalURL( '?x=3' );
20 $urls2[] = $title->getCanonicalURL( '?x=4' );
21 $update2 = new CdnCacheUpdate( $urls2 );
22 DeferredUpdates::addUpdate( $update2 );
23
24 $wrapper = TestingAccessWrapper::newFromObject( $update1 );
25 $this->assertEquals( array_merge( $urls1, $urls2 ), $wrapper->urls );
26 }
27}
Handles purging appropriate CDN URLs given a title (or titles)
setMwGlobals( $pairs, $value=null)
Sets a global, maintaining a stashed version of the previous global to be restored in tearDown.