X-Git-Url: https://git.heureux-cyclage.org/?p=lhc%2Fweb%2Fwiklou.git;a=blobdiff_plain;f=tests%2Fphpunit%2Fincludes%2FStorage%2FSqlBlobStoreTest.php;h=dbbef11efc3e90ecd891a6a7bb2e1b87a406dad8;hp=6d2b09b7e0bbdf31fb2cc28ef6416681f63a0eb2;hb=1c65dd29a3c77173625b9a0f8b59ea1c1c12fc2c;hpb=d4d9ff0d1152cba349024cc2ee2bf203760fd832 diff --git a/tests/phpunit/includes/Storage/SqlBlobStoreTest.php b/tests/phpunit/includes/Storage/SqlBlobStoreTest.php index 6d2b09b7e0..dbbef11efc 100644 --- a/tests/phpunit/includes/Storage/SqlBlobStoreTest.php +++ b/tests/phpunit/includes/Storage/SqlBlobStoreTest.php @@ -134,6 +134,18 @@ class SqlBlobStoreTest extends MediaWikiTestCase { [ 'gzip', 'object' ], '2®Àþ2', ]; + yield 'T184749 (windows-1252 encoding), string in string out' => [ + 'windows-1252', + iconv( 'utf-8', 'windows-1252', "sammansättningar" ), + [], + 'sammansättningar', + ]; + yield 'T184749 (windows-1252 encoding), string in string out with gzip' => [ + 'windows-1252', + gzdeflate( iconv( 'utf-8', 'windows-1252', "sammansättningar" ) ), + [ 'gzip' ], + 'sammansättningar', + ]; } /** @@ -190,6 +202,7 @@ class SqlBlobStoreTest extends MediaWikiTestCase { public function provideBlobs() { yield [ '' ]; yield [ 'someText' ]; + yield [ "sammansättningar" ]; } /** @@ -203,4 +216,26 @@ class SqlBlobStoreTest extends MediaWikiTestCase { $this->assertSame( $blob, $store->getBlob( $address ) ); } + /** + * @dataProvider provideBlobs + * @covers \MediaWiki\Storage\SqlBlobStore::storeBlob + * @covers \MediaWiki\Storage\SqlBlobStore::getBlob + */ + public function testSimpleStoreGetBlobSimpleRoundtripWindowsLegacyEncoding( $blob ) { + $store = $this->getBlobStore( 'windows-1252' ); + $address = $store->storeBlob( $blob ); + $this->assertSame( $blob, $store->getBlob( $address ) ); + } + + /** + * @dataProvider provideBlobs + * @covers \MediaWiki\Storage\SqlBlobStore::storeBlob + * @covers \MediaWiki\Storage\SqlBlobStore::getBlob + */ + public function testSimpleStoreGetBlobSimpleRoundtripWindowsLegacyEncodingGzip( $blob ) { + $store = $this->getBlobStore( 'windows-1252', true ); + $address = $store->storeBlob( $blob ); + $this->assertSame( $blob, $store->getBlob( $address ) ); + } + }