public function testBlobCreation() {
$module = $this->makeModule( [ 'mainpage' ] );
- $rl = new ResourceLoader();
+ $rl = new EmptyResourceLoader();
$rl->register( $module->getName(), $module );
$blobStore = $this->makeBlobStore( null, $rl );
$this->assertEquals( '{"mainpage":"Main Page"}', $blob, 'Generated blob' );
}
+ public function testBlobCreation_empty() {
+ $module = $this->makeModule( [] );
+ $rl = new EmptyResourceLoader();
+ $rl->register( $module->getName(), $module );
+
+ $blobStore = $this->makeBlobStore( null, $rl );
+ $blob = $blobStore->getBlob( $module, 'en' );
+
+ $this->assertEquals( '{}', $blob, 'Generated blob' );
+ }
+
public function testBlobCreation_unknownMessage() {
- $module = $this->makeModule( [ 'i-dont-exist' ] );
- $rl = new ResourceLoader();
+ $module = $this->makeModule( [ 'i-dont-exist', 'mainpage', 'i-dont-exist2' ] );
+ $rl = new EmptyResourceLoader();
$rl->register( $module->getName(), $module );
$blobStore = $this->makeBlobStore( null, $rl );
- // Generating a blob should succeed without errors,
- // even if a message is unknown.
+ // Generating a blob should continue without errors,
+ // with keys of unknown messages excluded from the blob.
$blob = $blobStore->getBlob( $module, 'en' );
- $this->assertEquals( '{"i-dont-exist":"\u29fci-dont-exist\u29fd"}', $blob, 'Generated blob' );
+ $this->assertEquals( '{"mainpage":"Main Page"}', $blob, 'Generated blob' );
}
public function testMessageCachingAndPurging() {
$module = $this->makeModule( [ 'example' ] );
- $rl = new ResourceLoader();
+ $rl = new EmptyResourceLoader();
$rl->register( $module->getName(), $module );
$blobStore = $this->makeBlobStore( [ 'fetchMessage' ], $rl );
public function testPurgeEverything() {
$module = $this->makeModule( [ 'example' ] );
- $rl = new ResourceLoader();
+ $rl = new EmptyResourceLoader();
$rl->register( $module->getName(), $module );
$blobStore = $this->makeBlobStore( [ 'fetchMessage' ], $rl );
// Advance this new WANObjectCache instance to a normal state.
public function testValidateAgainstModuleRegistry() {
// Arrange version 1 of a module
$module = $this->makeModule( [ 'foo' ] );
- $rl = new ResourceLoader();
+ $rl = new EmptyResourceLoader();
$rl->register( $module->getName(), $module );
$blobStore = $this->makeBlobStore( [ 'fetchMessage' ], $rl );
$blobStore->expects( $this->once() )
// must always match the set of message keys required by the module.
// We do not receive purges for this because no messages were changed.
$module = $this->makeModule( [ 'foo', 'bar' ] );
- $rl = new ResourceLoader();
+ $rl = new EmptyResourceLoader();
$rl->register( $module->getName(), $module );
$blobStore = $this->makeBlobStore( [ 'fetchMessage' ], $rl );
$blobStore->expects( $this->exactly( 2 ) )