X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=tests%2Fphpunit%2Fincludes%2Fresourceloader%2FMessageBlobStoreTest.php;h=1f2c617e261730c37a45d33a8186972dc379f69c;hb=d4717253b2110a0bfdb6935f6d90908a43eb6f2d;hp=bf80845976414b983a88e65ca6d2da7e76bc22f2;hpb=8eac2feedb7ee093d2c48504e1eb2b8a9dbc8452;p=lhc%2Fweb%2Fwiklou.git diff --git a/tests/phpunit/includes/resourceloader/MessageBlobStoreTest.php b/tests/phpunit/includes/resourceloader/MessageBlobStoreTest.php index bf80845976..1f2c617e26 100644 --- a/tests/phpunit/includes/resourceloader/MessageBlobStoreTest.php +++ b/tests/phpunit/includes/resourceloader/MessageBlobStoreTest.php @@ -1,5 +1,7 @@ makeBlobStore(); + $this->assertSame( null, $blobStore->setLogger( new Psr\Log\NullLogger() ) ); + } + + /** @covers MessageBlobStore::getResourceLoader */ + public function testGetResourceLoader() { + // Call protected method + $blobStore = TestingAccessWrapper::newFromObject( $this->makeBlobStore() ); + $this->assertInstanceOf( + ResourceLoader::class, + $blobStore->getResourceLoader() + ); + } + + /** @covers MessageBlobStore::fetchMessage */ + public function testFetchMessage() { + $module = $this->makeModule( [ 'mainpage' ] ); + $rl = new ResourceLoader(); + $rl->register( $module->getName(), $module ); + + $blobStore = $this->makeBlobStore( null, $rl ); + $blob = $blobStore->getBlob( $module, 'en' ); + + $this->assertEquals( '{"mainpage":"Main Page"}', $blob, 'Generated blob' ); + } + + /** @covers MessageBlobStore::fetchMessage */ + public function testFetchMessageFail() { + $module = $this->makeModule( [ 'i-dont-exist' ] ); + $rl = new ResourceLoader(); + $rl->register( $module->getName(), $module ); + + $blobStore = $this->makeBlobStore( null, $rl ); + $blob = $blobStore->getBlob( $module, 'en' ); + + $this->assertEquals( '{"i-dont-exist":"\u29fci-dont-exist\u29fd"}', $blob, 'Generated blob' ); + } + public function testGetBlob() { $module = $this->makeModule( [ 'foo' ] ); $rl = new ResourceLoader();