diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index d272e67b58..3e56242bf9 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -50,9 +50,9 @@ /tests/testdata/modules/js-and-css/audit-enqueued-assets @manuelRod # Module: Dominant Color Images -/modules/images/dominant-color @pbearne @spacedmonkey -/tests/modules/images/dominant-color @pbearne @spacedmonkey -/tests/testdata/modules/images/dominant-color @pbearne @spacedmonkey +/modules/images/dominant-color-images @pbearne @spacedmonkey +/tests/modules/images/dominant-color-images @pbearne @spacedmonkey +/tests/testdata/modules/images/dominant-color-images @pbearne @spacedmonkey # Module: Fetchpriority /modules/images/fetchpriority @pbearne @adamsilverstein diff --git a/default-enabled-modules.php b/default-enabled-modules.php index 7b13ebcad5..74c9838232 100644 --- a/default-enabled-modules.php +++ b/default-enabled-modules.php @@ -1,7 +1,7 @@ 'database/audit-autoloaded-options', 'site-health/audit-enqueued-assets' => 'js-and-css/audit-enqueued-assets', 'site-health/webp-support' => 'images/webp-support', + 'images/dominant-color' => 'images/dominant-color-images', ); foreach ( $legacy_module_slugs as $legacy_slug => $current_slug ) { diff --git a/modules/images/dominant-color/class-dominant-color-image-editor-gd.php b/modules/images/dominant-color-images/class-dominant-color-image-editor-gd.php similarity index 98% rename from modules/images/dominant-color/class-dominant-color-image-editor-gd.php rename to modules/images/dominant-color-images/class-dominant-color-image-editor-gd.php index e21ef26c13..89017bc36a 100644 --- a/modules/images/dominant-color/class-dominant-color-image-editor-gd.php +++ b/modules/images/dominant-color-images/class-dominant-color-image-editor-gd.php @@ -4,7 +4,7 @@ * with dominant color detection * * @package performance-lab - * @group dominant-color + * @group dominant-color-images * * @since 1.2.0 */ diff --git a/modules/images/dominant-color/class-dominant-color-image-editor-imagick.php b/modules/images/dominant-color-images/class-dominant-color-image-editor-imagick.php similarity index 98% rename from modules/images/dominant-color/class-dominant-color-image-editor-imagick.php rename to modules/images/dominant-color-images/class-dominant-color-image-editor-imagick.php index 8d18218950..1a1dab33ec 100644 --- a/modules/images/dominant-color/class-dominant-color-image-editor-imagick.php +++ b/modules/images/dominant-color-images/class-dominant-color-image-editor-imagick.php @@ -4,7 +4,7 @@ * with dominant color detection * * @package performance-lab - * @group dominant-color + * @group dominant-color-images * * @since 1.2.0 */ diff --git a/modules/images/dominant-color/helper.php b/modules/images/dominant-color-images/helper.php similarity index 100% rename from modules/images/dominant-color/helper.php rename to modules/images/dominant-color-images/helper.php diff --git a/modules/images/dominant-color/hooks.php b/modules/images/dominant-color-images/hooks.php similarity index 100% rename from modules/images/dominant-color/hooks.php rename to modules/images/dominant-color-images/hooks.php diff --git a/modules/images/dominant-color/load.php b/modules/images/dominant-color-images/load.php similarity index 71% rename from modules/images/dominant-color/load.php rename to modules/images/dominant-color-images/load.php index 58f09545b1..019094e2c8 100644 --- a/modules/images/dominant-color/load.php +++ b/modules/images/dominant-color-images/load.php @@ -1,7 +1,7 @@ assertSame( perflab_get_modules_setting_default(), $settings ); + $this->assertEqualSetsWithIndex( perflab_get_modules_setting_default(), $settings ); // More specifically though, assert that the default is also passed through to the // get_option() call, to support scenarios where the function is called before 'init'. @@ -88,13 +88,13 @@ function( $default, $option, $passed_default ) use ( &$has_passed_default ) { ); $settings = perflab_get_module_settings(); $this->assertTrue( $has_passed_default ); - $this->assertSame( perflab_get_modules_setting_default(), $settings ); + $this->assertEqualSetsWithIndex( perflab_get_modules_setting_default(), $settings ); // Assert that option updates are reflected in the settings correctly. $new_value = array( 'my-module' => array( 'enabled' => true ) ); update_option( PERFLAB_MODULES_SETTING, $new_value ); $settings = perflab_get_module_settings(); - $this->assertSame( $new_value, $settings ); + $this->assertEqualSetsWithIndex( $new_value, $settings ); } /** @@ -124,6 +124,7 @@ public function data_legacy_modules() { array( 'site-health/audit-autoloaded-options', 'database/audit-autoloaded-options' ), array( 'site-health/audit-enqueued-assets', 'js-and-css/audit-enqueued-assets' ), array( 'site-health/webp-support', 'images/webp-support' ), + array( 'images/dominant-color', 'images/dominant-color-images' ), ); } @@ -138,7 +139,7 @@ function( $module_settings ) { } ) ); - $this->assertSame( $expected_active_modules, $active_modules ); + $this->assertEqualSetsWithIndex( $expected_active_modules, $active_modules ); // Assert that option updates affect the active modules correctly. $new_value = array( @@ -147,7 +148,7 @@ function( $module_settings ) { ); update_option( PERFLAB_MODULES_SETTING, $new_value ); $active_modules = perflab_get_active_modules(); - $this->assertSame( array( 'active-module' ), $active_modules ); + $this->assertEqualSetsWithIndex( array( 'active-module' ), $active_modules ); } public function test_perflab_get_generator_content() { diff --git a/tests/modules/images/dominant-color/dominant-color-image-editor-gd-test.php b/tests/modules/images/dominant-color-images/dominant-color-image-editor-gd-test.php similarity index 96% rename from tests/modules/images/dominant-color/dominant-color-image-editor-gd-test.php rename to tests/modules/images/dominant-color-images/dominant-color-image-editor-gd-test.php index 27f7b07a94..ec4b85ce58 100644 --- a/tests/modules/images/dominant-color/dominant-color-image-editor-gd-test.php +++ b/tests/modules/images/dominant-color-images/dominant-color-image-editor-gd-test.php @@ -1,9 +1,9 @@ attachment->create_upload_object( TESTS_PLUGIN_DIR . '/tests/testdata/modules/images/dominant-color/red.jpg' ); + $attachment_id = self::factory()->attachment->create_upload_object( TESTS_PLUGIN_DIR . '/tests/testdata/modules/images/dominant-color-images/red.jpg' ); wp_maybe_generate_attachment_metadata( get_post( $attachment_id ) ); $image_url = wp_get_attachment_image_url( $attachment_id ); @@ -168,7 +168,7 @@ public function data_dominant_color_img_tag_add_dominant_color_requires_proper_q * @param string $expected The expected style attribute and value. */ public function test_dominant_color_img_tag_add_dominant_color_should_add_dominant_color_inline_style( $filtered_image, $expected ) { - $attachment_id = self::factory()->attachment->create_upload_object( TESTS_PLUGIN_DIR . '/tests/testdata/modules/images/dominant-color/red.jpg' ); + $attachment_id = self::factory()->attachment->create_upload_object( TESTS_PLUGIN_DIR . '/tests/testdata/modules/images/dominant-color-images/red.jpg' ); wp_maybe_generate_attachment_metadata( get_post( $attachment_id ) ); list( $src, $width, $height ) = wp_get_attachment_image_src( $attachment_id ); diff --git a/tests/testdata/modules/images/dominant-color/animated.gif b/tests/testdata/modules/images/dominant-color-images/animated.gif similarity index 100% rename from tests/testdata/modules/images/dominant-color/animated.gif rename to tests/testdata/modules/images/dominant-color-images/animated.gif diff --git a/tests/testdata/modules/images/dominant-color/green.gif b/tests/testdata/modules/images/dominant-color-images/green.gif similarity index 100% rename from tests/testdata/modules/images/dominant-color/green.gif rename to tests/testdata/modules/images/dominant-color-images/green.gif diff --git a/tests/testdata/modules/images/dominant-color/green.jpg b/tests/testdata/modules/images/dominant-color-images/green.jpg similarity index 100% rename from tests/testdata/modules/images/dominant-color/green.jpg rename to tests/testdata/modules/images/dominant-color-images/green.jpg diff --git a/tests/testdata/modules/images/dominant-color/green.png b/tests/testdata/modules/images/dominant-color-images/green.png similarity index 100% rename from tests/testdata/modules/images/dominant-color/green.png rename to tests/testdata/modules/images/dominant-color-images/green.png diff --git a/tests/testdata/modules/images/dominant-color/green.webp b/tests/testdata/modules/images/dominant-color-images/green.webp similarity index 100% rename from tests/testdata/modules/images/dominant-color/green.webp rename to tests/testdata/modules/images/dominant-color-images/green.webp diff --git a/tests/testdata/modules/images/dominant-color/red.gif b/tests/testdata/modules/images/dominant-color-images/red.gif similarity index 100% rename from tests/testdata/modules/images/dominant-color/red.gif rename to tests/testdata/modules/images/dominant-color-images/red.gif diff --git a/tests/testdata/modules/images/dominant-color/red.jpg b/tests/testdata/modules/images/dominant-color-images/red.jpg similarity index 100% rename from tests/testdata/modules/images/dominant-color/red.jpg rename to tests/testdata/modules/images/dominant-color-images/red.jpg diff --git a/tests/testdata/modules/images/dominant-color/red.png b/tests/testdata/modules/images/dominant-color-images/red.png similarity index 100% rename from tests/testdata/modules/images/dominant-color/red.png rename to tests/testdata/modules/images/dominant-color-images/red.png diff --git a/tests/testdata/modules/images/dominant-color/red.webp b/tests/testdata/modules/images/dominant-color-images/red.webp similarity index 100% rename from tests/testdata/modules/images/dominant-color/red.webp rename to tests/testdata/modules/images/dominant-color-images/red.webp diff --git a/tests/testdata/modules/images/dominant-color/small-video.mp4 b/tests/testdata/modules/images/dominant-color-images/small-video.mp4 similarity index 100% rename from tests/testdata/modules/images/dominant-color/small-video.mp4 rename to tests/testdata/modules/images/dominant-color-images/small-video.mp4 diff --git a/tests/testdata/modules/images/dominant-color/test-image.bmp b/tests/testdata/modules/images/dominant-color-images/test-image.bmp similarity index 100% rename from tests/testdata/modules/images/dominant-color/test-image.bmp rename to tests/testdata/modules/images/dominant-color-images/test-image.bmp diff --git a/tests/testdata/modules/images/dominant-color/test-image.tiff b/tests/testdata/modules/images/dominant-color-images/test-image.tiff similarity index 100% rename from tests/testdata/modules/images/dominant-color/test-image.tiff rename to tests/testdata/modules/images/dominant-color-images/test-image.tiff diff --git a/tests/testdata/modules/images/dominant-color/trans.gif b/tests/testdata/modules/images/dominant-color-images/trans.gif similarity index 100% rename from tests/testdata/modules/images/dominant-color/trans.gif rename to tests/testdata/modules/images/dominant-color-images/trans.gif diff --git a/tests/testdata/modules/images/dominant-color/trans.png b/tests/testdata/modules/images/dominant-color-images/trans.png similarity index 100% rename from tests/testdata/modules/images/dominant-color/trans.png rename to tests/testdata/modules/images/dominant-color-images/trans.png diff --git a/tests/testdata/modules/images/dominant-color/trans.webp b/tests/testdata/modules/images/dominant-color-images/trans.webp similarity index 100% rename from tests/testdata/modules/images/dominant-color/trans.webp rename to tests/testdata/modules/images/dominant-color-images/trans.webp diff --git a/tests/testdata/modules/images/dominant-color/video-play.svg b/tests/testdata/modules/images/dominant-color-images/video-play.svg similarity index 100% rename from tests/testdata/modules/images/dominant-color/video-play.svg rename to tests/testdata/modules/images/dominant-color-images/video-play.svg diff --git a/tests/testdata/modules/images/dominant-color/white.gif b/tests/testdata/modules/images/dominant-color-images/white.gif similarity index 100% rename from tests/testdata/modules/images/dominant-color/white.gif rename to tests/testdata/modules/images/dominant-color-images/white.gif diff --git a/tests/testdata/modules/images/dominant-color/white.jpg b/tests/testdata/modules/images/dominant-color-images/white.jpg similarity index 100% rename from tests/testdata/modules/images/dominant-color/white.jpg rename to tests/testdata/modules/images/dominant-color-images/white.jpg diff --git a/tests/testdata/modules/images/dominant-color/white.png b/tests/testdata/modules/images/dominant-color-images/white.png similarity index 100% rename from tests/testdata/modules/images/dominant-color/white.png rename to tests/testdata/modules/images/dominant-color-images/white.png diff --git a/tests/testdata/modules/images/dominant-color/white.webp b/tests/testdata/modules/images/dominant-color-images/white.webp similarity index 100% rename from tests/testdata/modules/images/dominant-color/white.webp rename to tests/testdata/modules/images/dominant-color-images/white.webp diff --git a/tests/testdata/modules/images/dominant-color/wordpress-gsoc-flyer.pdf b/tests/testdata/modules/images/dominant-color-images/wordpress-gsoc-flyer.pdf similarity index 100% rename from tests/testdata/modules/images/dominant-color/wordpress-gsoc-flyer.pdf rename to tests/testdata/modules/images/dominant-color-images/wordpress-gsoc-flyer.pdf diff --git a/tests/utils/TestCase/DominantColorTestCase.php b/tests/utils/TestCase/DominantColorTestCase.php index 9134fae2b8..cb3dbb916a 100644 --- a/tests/utils/TestCase/DominantColorTestCase.php +++ b/tests/utils/TestCase/DominantColorTestCase.php @@ -13,85 +13,85 @@ abstract class DominantColorTestCase extends WP_UnitTestCase { public function provider_get_dominant_color() { return array( 'animated_gif' => array( - 'image_path' => TESTS_PLUGIN_DIR . '/tests/testdata/modules/images/dominant-color/animated.gif', + 'image_path' => TESTS_PLUGIN_DIR . '/tests/testdata/modules/images/dominant-color-images/animated.gif', 'expected_color' => array( '874e4e', 'df7f7f' ), 'expected_transparency' => true, ), 'red_jpg' => array( - 'image_path' => TESTS_PLUGIN_DIR . '/tests/testdata/modules/images/dominant-color/red.jpg', + 'image_path' => TESTS_PLUGIN_DIR . '/tests/testdata/modules/images/dominant-color-images/red.jpg', 'expected_color' => array( 'ff0000', 'fe0000' ), 'expected_transparency' => false, ), 'green_jpg' => array( - 'image_path' => TESTS_PLUGIN_DIR . '/tests/testdata/modules/images/dominant-color/green.jpg', + 'image_path' => TESTS_PLUGIN_DIR . '/tests/testdata/modules/images/dominant-color-images/green.jpg', 'expected_color' => array( '00ff00', '00ff01', '02ff01' ), 'expected_transparency' => false, ), 'white_jpg' => array( - 'image_path' => TESTS_PLUGIN_DIR . '/tests/testdata/modules/images/dominant-color/white.jpg', + 'image_path' => TESTS_PLUGIN_DIR . '/tests/testdata/modules/images/dominant-color-images/white.jpg', 'expected_color' => array( 'ffffff' ), 'expected_transparency' => false, ), 'red_gif' => array( - 'image_path' => TESTS_PLUGIN_DIR . '/tests/testdata/modules/images/dominant-color/red.gif', + 'image_path' => TESTS_PLUGIN_DIR . '/tests/testdata/modules/images/dominant-color-images/red.gif', 'expected_color' => array( 'ff0000' ), 'expected_transparency' => false, ), 'green_gif' => array( - 'image_path' => TESTS_PLUGIN_DIR . '/tests/testdata/modules/images/dominant-color/green.gif', + 'image_path' => TESTS_PLUGIN_DIR . '/tests/testdata/modules/images/dominant-color-images/green.gif', 'expected_color' => array( '00ff00' ), 'expected_transparency' => false, ), 'white_gif' => array( - 'image_path' => TESTS_PLUGIN_DIR . '/tests/testdata/modules/images/dominant-color/white.gif', + 'image_path' => TESTS_PLUGIN_DIR . '/tests/testdata/modules/images/dominant-color-images/white.gif', 'expected_color' => array( 'ffffff' ), 'expected_transparency' => false, ), 'trans_gif' => array( - 'image_path' => TESTS_PLUGIN_DIR . '/tests/testdata/modules/images/dominant-color/trans.gif', + 'image_path' => TESTS_PLUGIN_DIR . '/tests/testdata/modules/images/dominant-color-images/trans.gif', 'expected_color' => array( '5a5a5a', '020202' ), 'expected_transparency' => true, ), 'red_png' => array( - 'image_path' => TESTS_PLUGIN_DIR . '/tests/testdata/modules/images/dominant-color/red.png', + 'image_path' => TESTS_PLUGIN_DIR . '/tests/testdata/modules/images/dominant-color-images/red.png', 'expected_color' => array( 'ff0000' ), 'expected_transparency' => false, ), 'green_png' => array( - 'image_path' => TESTS_PLUGIN_DIR . '/tests/testdata/modules/images/dominant-color/green.png', + 'image_path' => TESTS_PLUGIN_DIR . '/tests/testdata/modules/images/dominant-color-images/green.png', 'expected_color' => array( '00ff00' ), 'expected_transparency' => false, ), 'white_png' => array( - 'image_path' => TESTS_PLUGIN_DIR . '/tests/testdata/modules/images/dominant-color/white.png', + 'image_path' => TESTS_PLUGIN_DIR . '/tests/testdata/modules/images/dominant-color-images/white.png', 'expected_color' => array( 'ffffff' ), 'expected_transparency' => false, ), 'trans_png' => array( - 'image_path' => TESTS_PLUGIN_DIR . '/tests/testdata/modules/images/dominant-color/trans.png', + 'image_path' => TESTS_PLUGIN_DIR . '/tests/testdata/modules/images/dominant-color-images/trans.png', 'expected_color' => array( '000000' ), 'expected_transparency' => true, ), 'red_webp' => array( - 'image_path' => TESTS_PLUGIN_DIR . '/tests/testdata/modules/images/dominant-color/red.webp', + 'image_path' => TESTS_PLUGIN_DIR . '/tests/testdata/modules/images/dominant-color-images/red.webp', 'expected_color' => array( 'ff0000' ), 'expected_transparency' => false, ), 'green_webp' => array( - 'image_path' => TESTS_PLUGIN_DIR . '/tests/testdata/modules/images/dominant-color/green.webp', + 'image_path' => TESTS_PLUGIN_DIR . '/tests/testdata/modules/images/dominant-color-images/green.webp', 'expected_color' => array( '00ff00' ), 'expected_transparency' => false, ), 'white_webp' => array( - 'image_path' => TESTS_PLUGIN_DIR . '/tests/testdata/modules/images/dominant-color/white.webp', + 'image_path' => TESTS_PLUGIN_DIR . '/tests/testdata/modules/images/dominant-color-images/white.webp', 'expected_color' => array( 'ffffff' ), 'expected_transparency' => false, ), 'trans_webp' => array( - 'image_path' => TESTS_PLUGIN_DIR . '/tests/testdata/modules/images/dominant-color/trans.webp', + 'image_path' => TESTS_PLUGIN_DIR . '/tests/testdata/modules/images/dominant-color-images/trans.webp', 'expected_color' => array( '000000' ), 'expected_transparency' => true, ), @@ -111,12 +111,12 @@ public function provider_get_dominant_color() { public function provider_get_dominant_color_invalid_images() { return array( 'tiff' => array( - 'image_path' => TESTS_PLUGIN_DIR . '/tests/testdata/modules/images/dominant-color/test-image.tiff', + 'image_path' => TESTS_PLUGIN_DIR . '/tests/testdata/modules/images/dominant-color-images/test-image.tiff', 'expected_color' => array( 'dfdfdf' ), 'expected_transparency' => true, ), 'bmp' => array( - 'image_path' => TESTS_PLUGIN_DIR . '/tests/testdata/modules/images/dominant-color/test-image.bmp', + 'image_path' => TESTS_PLUGIN_DIR . '/tests/testdata/modules/images/dominant-color-images/test-image.bmp', 'expected_color' => array( 'dfdfdf' ), 'expected_transparency' => true, ), @@ -131,13 +131,13 @@ public function provider_get_dominant_color_invalid_images() { public function provider_get_dominant_color_none_images() { return array( 'svg' => array( - 'files_path' => TESTS_PLUGIN_DIR . '/tests/testdata/modules/images/dominant-color/video-play.svg', + 'files_path' => TESTS_PLUGIN_DIR . '/tests/testdata/modules/images/dominant-color-images/video-play.svg', ), 'pdf' => array( - 'files_path' => TESTS_PLUGIN_DIR . '/tests/testdata/modules/images/dominant-color/wordpress-gsoc-flyer.pdf', + 'files_path' => TESTS_PLUGIN_DIR . '/tests/testdata/modules/images/dominant-color-images/wordpress-gsoc-flyer.pdf', ), 'mp4' => array( - 'files_path' => TESTS_PLUGIN_DIR . '/tests/testdata/modules/images/dominant-color/small-video.mp4', + 'files_path' => TESTS_PLUGIN_DIR . '/tests/testdata/modules/images/dominant-color-images/small-video.mp4', ), ); }