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=b6af2b49fe9be3db3090aea6abc5a037106dbb52;hb=1c65dd29a3c77173625b9a0f8b59ea1c1c12fc2c;hpb=1ab510cfcabc2d431b3c0a28fdc896aff85487d4 diff --git a/tests/phpunit/includes/Storage/SqlBlobStoreTest.php b/tests/phpunit/includes/Storage/SqlBlobStoreTest.php index b6af2b49fe..dbbef11efc 100644 --- a/tests/phpunit/includes/Storage/SqlBlobStoreTest.php +++ b/tests/phpunit/includes/Storage/SqlBlobStoreTest.php @@ -112,28 +112,40 @@ class SqlBlobStoreTest extends MediaWikiTestCase { ]; yield '(ISO-8859-1 encoding), string in string out' => [ 'ISO-8859-1', - iconv( 'utf8', 'ISO-8859-1', "1®Àþ1" ), + iconv( 'utf-8', 'ISO-8859-1', "1®Àþ1" ), [], '1®Àþ1', ]; yield '(ISO-8859-1 encoding), serialized object in with gzip flags returns string' => [ 'ISO-8859-1', - gzdeflate( iconv( 'utf8', 'ISO-8859-1', "4®Àþ4" ) ), + gzdeflate( iconv( 'utf-8', 'ISO-8859-1', "4®Àþ4" ) ), [ 'gzip' ], '4®Àþ4', ]; yield '(ISO-8859-1 encoding), serialized object in with object flags returns string' => [ 'ISO-8859-1', - serialize( new TitleValue( 0, iconv( 'utf8', 'ISO-8859-1', "3®Àþ3" ) ) ), + serialize( new TitleValue( 0, iconv( 'utf-8', 'ISO-8859-1', "3®Àþ3" ) ) ), [ 'object' ], '3®Àþ3', ]; yield '(ISO-8859-1 encoding), serialized object in with object & gzip flags returns string' => [ 'ISO-8859-1', - gzdeflate( serialize( new TitleValue( 0, iconv( 'utf8', 'ISO-8859-1', "2®Àþ2" ) ) ) ), + gzdeflate( serialize( new TitleValue( 0, iconv( 'utf-8', 'ISO-8859-1', "2®Àþ2" ) ) ) ), [ '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 ) ); + } + }