]> scripts.mit.edu Git - autoinstallsdev/mediawiki.git/blobdiff - tests/phpunit/includes/deferred/CdnCacheUpdateTest.php
MediaWiki 1.30.2
[autoinstallsdev/mediawiki.git] / tests / phpunit / includes / deferred / CdnCacheUpdateTest.php
diff --git a/tests/phpunit/includes/deferred/CdnCacheUpdateTest.php b/tests/phpunit/includes/deferred/CdnCacheUpdateTest.php
new file mode 100644 (file)
index 0000000..11b869a
--- /dev/null
@@ -0,0 +1,27 @@
+<?php
+
+use Wikimedia\TestingAccessWrapper;
+
+class CdnCacheUpdateTest extends MediaWikiTestCase {
+       public function testPurgeMergeWeb() {
+               $this->setMwGlobals( 'wgCommandLineMode', false );
+
+               $urls1 = [];
+               $title = Title::newMainPage();
+               $urls1[] = $title->getCanonicalURL( '?x=1' );
+               $urls1[] = $title->getCanonicalURL( '?x=2' );
+               $urls1[] = $title->getCanonicalURL( '?x=3' );
+               $update1 = new CdnCacheUpdate( $urls1 );
+               DeferredUpdates::addUpdate( $update1 );
+
+               $urls2 = [];
+               $urls2[] = $title->getCanonicalURL( '?x=2' );
+               $urls2[] = $title->getCanonicalURL( '?x=3' );
+               $urls2[] = $title->getCanonicalURL( '?x=4' );
+               $update2 = new CdnCacheUpdate( $urls2 );
+               DeferredUpdates::addUpdate( $update2 );
+
+               $wrapper = TestingAccessWrapper::newFromObject( $update1 );
+               $this->assertEquals( array_merge( $urls1, $urls2 ), $wrapper->urls );
+       }
+}