From efd707de3750b4016943243734021701d75074ae Mon Sep 17 00:00:00 2001 From: =?utf8?q?Bartosz=20Dziewo=C5=84ski?= Date: Tue, 6 Jun 2017 15:04:09 +0200 Subject: [PATCH] Rename all files used in ResourceLoaderImageModule tests to fake names Using names that match real OOjs UI icons is confusing when trying to find usages of the real icons and when debugging the tests. Bug: T166730 Change-Id: Ibb97c0347476efc95f1a50c97822d7dab19737f2 --- .../data/resourceloader/{add.gif => abc.gif} | Bin .../resourceloader/{remove.svg => def.svg} | 0 ...move_variantize.svg => def_variantize.svg} | 0 .../data/resourceloader/{next.svg => ghi.svg} | 0 .../{next_massage.svg => ghi_massage.svg} | 0 .../data/resourceloader/{prev.svg => jkl.svg} | 0 .../{help-ltr.svg => mno-ltr.svg} | 0 .../{help-rtl.svg => mno-rtl.svg} | 0 .../oouiimagemodule/apex/icons.json | 2 +- .../apex/images/icons/search.svg | 6 -- .../oouiimagemodule/apex/images/icons/stu.svg | 6 ++ .../oouiimagemodule/wikimediaui/icons.json | 2 +- .../wikimediaui/images/icons/search.svg | 6 -- .../wikimediaui/images/icons/stu.svg | 6 ++ .../resourceloader/{bold-a.svg => pqr-a.svg} | 0 .../resourceloader/{bold-b.svg => pqr-b.svg} | 0 .../resourceloader/{bold-f.svg => pqr-f.svg} | 0 .../ResourceLoaderImageModuleTest.php | 72 +++++++++--------- .../ResourceLoaderImageTest.php | 48 ++++++------ .../ResourceLoaderOOUIImageModuleTest.php | 4 +- 20 files changed, 76 insertions(+), 76 deletions(-) rename tests/phpunit/data/resourceloader/{add.gif => abc.gif} (100%) rename tests/phpunit/data/resourceloader/{remove.svg => def.svg} (100%) rename tests/phpunit/data/resourceloader/{remove_variantize.svg => def_variantize.svg} (100%) rename tests/phpunit/data/resourceloader/{next.svg => ghi.svg} (100%) rename tests/phpunit/data/resourceloader/{next_massage.svg => ghi_massage.svg} (100%) rename tests/phpunit/data/resourceloader/{prev.svg => jkl.svg} (100%) rename tests/phpunit/data/resourceloader/{help-ltr.svg => mno-ltr.svg} (100%) rename tests/phpunit/data/resourceloader/{help-rtl.svg => mno-rtl.svg} (100%) delete mode 100644 tests/phpunit/data/resourceloader/oouiimagemodule/apex/images/icons/search.svg create mode 100644 tests/phpunit/data/resourceloader/oouiimagemodule/apex/images/icons/stu.svg delete mode 100644 tests/phpunit/data/resourceloader/oouiimagemodule/wikimediaui/images/icons/search.svg create mode 100644 tests/phpunit/data/resourceloader/oouiimagemodule/wikimediaui/images/icons/stu.svg rename tests/phpunit/data/resourceloader/{bold-a.svg => pqr-a.svg} (100%) rename tests/phpunit/data/resourceloader/{bold-b.svg => pqr-b.svg} (100%) rename tests/phpunit/data/resourceloader/{bold-f.svg => pqr-f.svg} (100%) diff --git a/tests/phpunit/data/resourceloader/add.gif b/tests/phpunit/data/resourceloader/abc.gif similarity index 100% rename from tests/phpunit/data/resourceloader/add.gif rename to tests/phpunit/data/resourceloader/abc.gif diff --git a/tests/phpunit/data/resourceloader/remove.svg b/tests/phpunit/data/resourceloader/def.svg similarity index 100% rename from tests/phpunit/data/resourceloader/remove.svg rename to tests/phpunit/data/resourceloader/def.svg diff --git a/tests/phpunit/data/resourceloader/remove_variantize.svg b/tests/phpunit/data/resourceloader/def_variantize.svg similarity index 100% rename from tests/phpunit/data/resourceloader/remove_variantize.svg rename to tests/phpunit/data/resourceloader/def_variantize.svg diff --git a/tests/phpunit/data/resourceloader/next.svg b/tests/phpunit/data/resourceloader/ghi.svg similarity index 100% rename from tests/phpunit/data/resourceloader/next.svg rename to tests/phpunit/data/resourceloader/ghi.svg diff --git a/tests/phpunit/data/resourceloader/next_massage.svg b/tests/phpunit/data/resourceloader/ghi_massage.svg similarity index 100% rename from tests/phpunit/data/resourceloader/next_massage.svg rename to tests/phpunit/data/resourceloader/ghi_massage.svg diff --git a/tests/phpunit/data/resourceloader/prev.svg b/tests/phpunit/data/resourceloader/jkl.svg similarity index 100% rename from tests/phpunit/data/resourceloader/prev.svg rename to tests/phpunit/data/resourceloader/jkl.svg diff --git a/tests/phpunit/data/resourceloader/help-ltr.svg b/tests/phpunit/data/resourceloader/mno-ltr.svg similarity index 100% rename from tests/phpunit/data/resourceloader/help-ltr.svg rename to tests/phpunit/data/resourceloader/mno-ltr.svg diff --git a/tests/phpunit/data/resourceloader/help-rtl.svg b/tests/phpunit/data/resourceloader/mno-rtl.svg similarity index 100% rename from tests/phpunit/data/resourceloader/help-rtl.svg rename to tests/phpunit/data/resourceloader/mno-rtl.svg diff --git a/tests/phpunit/data/resourceloader/oouiimagemodule/apex/icons.json b/tests/phpunit/data/resourceloader/oouiimagemodule/apex/icons.json index 4fe3d81982..fdb4d127e9 100644 --- a/tests/phpunit/data/resourceloader/oouiimagemodule/apex/icons.json +++ b/tests/phpunit/data/resourceloader/oouiimagemodule/apex/icons.json @@ -1,6 +1,6 @@ { "prefix": "oo-ui-icon", "images": { - "search": { "file": "images/icons/search.svg" } + "stu": { "file": "images/icons/stu.svg" } } } diff --git a/tests/phpunit/data/resourceloader/oouiimagemodule/apex/images/icons/search.svg b/tests/phpunit/data/resourceloader/oouiimagemodule/apex/images/icons/search.svg deleted file mode 100644 index 6952997131..0000000000 --- a/tests/phpunit/data/resourceloader/oouiimagemodule/apex/images/icons/search.svg +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - diff --git a/tests/phpunit/data/resourceloader/oouiimagemodule/apex/images/icons/stu.svg b/tests/phpunit/data/resourceloader/oouiimagemodule/apex/images/icons/stu.svg new file mode 100644 index 0000000000..27f14df16c --- /dev/null +++ b/tests/phpunit/data/resourceloader/oouiimagemodule/apex/images/icons/stu.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/tests/phpunit/data/resourceloader/oouiimagemodule/wikimediaui/icons.json b/tests/phpunit/data/resourceloader/oouiimagemodule/wikimediaui/icons.json index 4fe3d81982..fdb4d127e9 100644 --- a/tests/phpunit/data/resourceloader/oouiimagemodule/wikimediaui/icons.json +++ b/tests/phpunit/data/resourceloader/oouiimagemodule/wikimediaui/icons.json @@ -1,6 +1,6 @@ { "prefix": "oo-ui-icon", "images": { - "search": { "file": "images/icons/search.svg" } + "stu": { "file": "images/icons/stu.svg" } } } diff --git a/tests/phpunit/data/resourceloader/oouiimagemodule/wikimediaui/images/icons/search.svg b/tests/phpunit/data/resourceloader/oouiimagemodule/wikimediaui/images/icons/search.svg deleted file mode 100644 index 40438ea2cf..0000000000 --- a/tests/phpunit/data/resourceloader/oouiimagemodule/wikimediaui/images/icons/search.svg +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - diff --git a/tests/phpunit/data/resourceloader/oouiimagemodule/wikimediaui/images/icons/stu.svg b/tests/phpunit/data/resourceloader/oouiimagemodule/wikimediaui/images/icons/stu.svg new file mode 100644 index 0000000000..fcaaa8d245 --- /dev/null +++ b/tests/phpunit/data/resourceloader/oouiimagemodule/wikimediaui/images/icons/stu.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/tests/phpunit/data/resourceloader/bold-a.svg b/tests/phpunit/data/resourceloader/pqr-a.svg similarity index 100% rename from tests/phpunit/data/resourceloader/bold-a.svg rename to tests/phpunit/data/resourceloader/pqr-a.svg diff --git a/tests/phpunit/data/resourceloader/bold-b.svg b/tests/phpunit/data/resourceloader/pqr-b.svg similarity index 100% rename from tests/phpunit/data/resourceloader/bold-b.svg rename to tests/phpunit/data/resourceloader/pqr-b.svg diff --git a/tests/phpunit/data/resourceloader/bold-f.svg b/tests/phpunit/data/resourceloader/pqr-f.svg similarity index 100% rename from tests/phpunit/data/resourceloader/bold-f.svg rename to tests/phpunit/data/resourceloader/pqr-f.svg diff --git a/tests/phpunit/includes/resourceloader/ResourceLoaderImageModuleTest.php b/tests/phpunit/includes/resourceloader/ResourceLoaderImageModuleTest.php index 0015486bb6..f53cd069c2 100644 --- a/tests/phpunit/includes/resourceloader/ResourceLoaderImageModuleTest.php +++ b/tests/phpunit/includes/resourceloader/ResourceLoaderImageModuleTest.php @@ -8,32 +8,32 @@ use Wikimedia\TestingAccessWrapper; class ResourceLoaderImageModuleTest extends ResourceLoaderTestCase { public static $commonImageData = [ - 'add' => 'add.gif', - 'remove' => [ - 'file' => 'remove.svg', + 'abc' => 'abc.gif', + 'def' => [ + 'file' => 'def.svg', 'variants' => [ 'destructive' ], ], - 'next' => [ + 'ghi' => [ 'file' => [ - 'ltr' => 'next.svg', - 'rtl' => 'prev.svg' + 'ltr' => 'ghi.svg', + 'rtl' => 'jkl.svg' ], ], - 'help' => [ + 'mno' => [ 'file' => [ - 'ltr' => 'help-ltr.svg', - 'rtl' => 'help-rtl.svg', + 'ltr' => 'mno-ltr.svg', + 'rtl' => 'mno-rtl.svg', 'lang' => [ - 'he' => 'help-ltr.svg', + 'he' => 'mno-ltr.svg', ] ], ], - 'bold' => [ + 'pqr' => [ 'file' => [ - 'default' => 'bold-a.svg', + 'default' => 'pqr-a.svg', 'lang' => [ - 'en' => 'bold-b.svg', - 'ar,de' => 'bold-f.svg', + 'en' => 'pqr-b.svg', + 'ar,de' => 'pqr-f.svg', ] ], ] @@ -64,37 +64,37 @@ class ResourceLoaderImageModuleTest extends ResourceLoaderTestCase { 'variants' => self::$commonImageVariants, 'images' => self::$commonImageData, ], - '.oo-ui-icon-add { + '.oo-ui-icon-abc { ... } -.oo-ui-icon-add-invert { +.oo-ui-icon-abc-invert { ... } -.oo-ui-icon-remove { +.oo-ui-icon-def { ... } -.oo-ui-icon-remove-invert { +.oo-ui-icon-def-invert { ... } -.oo-ui-icon-remove-destructive { +.oo-ui-icon-def-destructive { ... } -.oo-ui-icon-next { +.oo-ui-icon-ghi { ... } -.oo-ui-icon-next-invert { +.oo-ui-icon-ghi-invert { ... } -.oo-ui-icon-help { +.oo-ui-icon-mno { ... } -.oo-ui-icon-help-invert { +.oo-ui-icon-mno-invert { ... } -.oo-ui-icon-bold { +.oo-ui-icon-pqr { ... } -.oo-ui-icon-bold-invert { +.oo-ui-icon-pqr-invert { ... }', ], @@ -107,37 +107,37 @@ class ResourceLoaderImageModuleTest extends ResourceLoaderTestCase { 'variants' => self::$commonImageVariants, 'images' => self::$commonImageData, ], - '.mw-ui-icon-add:after, .mw-ui-icon-add:before { + '.mw-ui-icon-abc:after, .mw-ui-icon-abc:before { ... } -.mw-ui-icon-add-invert:after, .mw-ui-icon-add-invert:before { +.mw-ui-icon-abc-invert:after, .mw-ui-icon-abc-invert:before { ... } -.mw-ui-icon-remove:after, .mw-ui-icon-remove:before { +.mw-ui-icon-def:after, .mw-ui-icon-def:before { ... } -.mw-ui-icon-remove-invert:after, .mw-ui-icon-remove-invert:before { +.mw-ui-icon-def-invert:after, .mw-ui-icon-def-invert:before { ... } -.mw-ui-icon-remove-destructive:after, .mw-ui-icon-remove-destructive:before { +.mw-ui-icon-def-destructive:after, .mw-ui-icon-def-destructive:before { ... } -.mw-ui-icon-next:after, .mw-ui-icon-next:before { +.mw-ui-icon-ghi:after, .mw-ui-icon-ghi:before { ... } -.mw-ui-icon-next-invert:after, .mw-ui-icon-next-invert:before { +.mw-ui-icon-ghi-invert:after, .mw-ui-icon-ghi-invert:before { ... } -.mw-ui-icon-help:after, .mw-ui-icon-help:before { +.mw-ui-icon-mno:after, .mw-ui-icon-mno:before { ... } -.mw-ui-icon-help-invert:after, .mw-ui-icon-help-invert:before { +.mw-ui-icon-mno-invert:after, .mw-ui-icon-mno-invert:before { ... } -.mw-ui-icon-bold:after, .mw-ui-icon-bold:before { +.mw-ui-icon-pqr:after, .mw-ui-icon-pqr:before { ... } -.mw-ui-icon-bold-invert:after, .mw-ui-icon-bold-invert:before { +.mw-ui-icon-pqr-invert:after, .mw-ui-icon-pqr-invert:before { ... }', ], diff --git a/tests/phpunit/includes/resourceloader/ResourceLoaderImageTest.php b/tests/phpunit/includes/resourceloader/ResourceLoaderImageTest.php index 84b56d4f11..aea2776463 100644 --- a/tests/phpunit/includes/resourceloader/ResourceLoaderImageTest.php +++ b/tests/phpunit/includes/resourceloader/ResourceLoaderImageTest.php @@ -29,20 +29,20 @@ class ResourceLoaderImageTest extends ResourceLoaderTestCase { public static function provideGetPath() { return [ - [ 'add', 'en', 'add.gif' ], - [ 'add', 'he', 'add.gif' ], - [ 'remove', 'en', 'remove.svg' ], - [ 'remove', 'he', 'remove.svg' ], - [ 'next', 'en', 'next.svg' ], - [ 'next', 'he', 'prev.svg' ], - [ 'help', 'en', 'help-ltr.svg' ], - [ 'help', 'ar', 'help-rtl.svg' ], - [ 'help', 'he', 'help-ltr.svg' ], - [ 'bold', 'en', 'bold-b.svg' ], - [ 'bold', 'de', 'bold-f.svg' ], - [ 'bold', 'ar', 'bold-f.svg' ], - [ 'bold', 'fr', 'bold-a.svg' ], - [ 'bold', 'he', 'bold-a.svg' ], + [ 'abc', 'en', 'abc.gif' ], + [ 'abc', 'he', 'abc.gif' ], + [ 'def', 'en', 'def.svg' ], + [ 'def', 'he', 'def.svg' ], + [ 'ghi', 'en', 'ghi.svg' ], + [ 'ghi', 'he', 'jkl.svg' ], + [ 'mno', 'en', 'mno-ltr.svg' ], + [ 'mno', 'ar', 'mno-rtl.svg' ], + [ 'mno', 'he', 'mno-ltr.svg' ], + [ 'pqr', 'en', 'pqr-b.svg' ], + [ 'pqr', 'de', 'pqr-f.svg' ], + [ 'pqr', 'ar', 'pqr-f.svg' ], + [ 'pqr', 'fr', 'pqr-a.svg' ], + [ 'pqr', 'he', 'pqr-a.svg' ], ]; } @@ -74,11 +74,11 @@ class ResourceLoaderImageTest extends ResourceLoaderTestCase { * @covers ResourceLoaderImage::getMimeType */ public function testGetExtension() { - $image = $this->getTestImage( 'remove' ); + $image = $this->getTestImage( 'def' ); $this->assertEquals( $image->getExtension(), 'svg' ); $this->assertEquals( $image->getExtension( 'original' ), 'svg' ); $this->assertEquals( $image->getExtension( 'rasterized' ), 'png' ); - $image = $this->getTestImage( 'add' ); + $image = $this->getTestImage( 'abc' ); $this->assertEquals( $image->getExtension(), 'gif' ); $this->assertEquals( $image->getExtension( 'original' ), 'gif' ); $this->assertEquals( $image->getExtension( 'rasterized' ), 'gif' ); @@ -92,9 +92,9 @@ class ResourceLoaderImageTest extends ResourceLoaderTestCase { public function testGetImageData() { $context = $this->getResourceLoaderContext(); - $image = $this->getTestImage( 'remove' ); - $data = file_get_contents( $this->imagesPath . '/remove.svg' ); - $dataConstructive = file_get_contents( $this->imagesPath . '/remove_variantize.svg' ); + $image = $this->getTestImage( 'def' ); + $data = file_get_contents( $this->imagesPath . '/def.svg' ); + $dataConstructive = file_get_contents( $this->imagesPath . '/def_variantize.svg' ); $this->assertEquals( $image->getImageData( $context, null, 'original' ), $data ); $this->assertEquals( $image->getImageData( $context, 'destructive', 'original' ), @@ -103,8 +103,8 @@ class ResourceLoaderImageTest extends ResourceLoaderTestCase { // Stub, since we don't know if we even have a SVG handler, much less what exactly it'll output $this->assertEquals( $image->getImageData( $context, null, 'rasterized' ), 'RASTERIZESTUB' ); - $image = $this->getTestImage( 'add' ); - $data = file_get_contents( $this->imagesPath . '/add.gif' ); + $image = $this->getTestImage( 'abc' ); + $data = file_get_contents( $this->imagesPath . '/abc.gif' ); $this->assertEquals( $image->getImageData( $context, null, 'original' ), $data ); $this->assertEquals( $image->getImageData( $context, null, 'rasterized' ), $data ); } @@ -113,9 +113,9 @@ class ResourceLoaderImageTest extends ResourceLoaderTestCase { * @covers ResourceLoaderImage::massageSvgPathdata */ public function testMassageSvgPathdata() { - $image = $this->getTestImage( 'next' ); - $data = file_get_contents( $this->imagesPath . '/next.svg' ); - $dataMassaged = file_get_contents( $this->imagesPath . '/next_massage.svg' ); + $image = $this->getTestImage( 'ghi' ); + $data = file_get_contents( $this->imagesPath . '/ghi.svg' ); + $dataMassaged = file_get_contents( $this->imagesPath . '/ghi_massage.svg' ); $this->assertEquals( $image->massageSvgPathdata( $data ), $dataMassaged ); } } diff --git a/tests/phpunit/includes/resourceloader/ResourceLoaderOOUIImageModuleTest.php b/tests/phpunit/includes/resourceloader/ResourceLoaderOOUIImageModuleTest.php index 4e482c8933..491fff6b1c 100644 --- a/tests/phpunit/includes/resourceloader/ResourceLoaderOOUIImageModuleTest.php +++ b/tests/phpunit/includes/resourceloader/ResourceLoaderOOUIImageModuleTest.php @@ -39,7 +39,7 @@ class ResourceLoaderOOUIImageModuleTest extends ResourceLoaderTestCase { $styles = $module->getStyles( $this->getResourceLoaderContext( [ 'skin' => 'fakemonobook' ] ) ); $this->assertRegExp( - '/magnifying-glass-apex/', + '/stu-apex/', $styles['all'], 'Generated styles use the non-default image (embed)' ); @@ -51,7 +51,7 @@ class ResourceLoaderOOUIImageModuleTest extends ResourceLoaderTestCase { $styles = $module->getStyles( $this->getResourceLoaderContext() ); $this->assertRegExp( - '/magnifying-glass-mediawiki/', + '/stu-wikimediaui/', $styles['all'], 'Generated styles use the default image (embed)' ); -- 2.20.1