From ad549e06bdc55ba162dbfc54b6f108760a4afa0b Mon Sep 17 00:00:00 2001 From: thelovekesh Date: Sun, 25 Feb 2024 20:28:21 +0530 Subject: [PATCH] Update dominant-color-images plugin test data images path --- .../tests/dominant-color-test.php | 6 +-- .../dominant-color-images/tests/testcase.php | 40 +++++++++---------- 2 files changed, 23 insertions(+), 23 deletions(-) diff --git a/plugins/dominant-color-images/tests/dominant-color-test.php b/plugins/dominant-color-images/tests/dominant-color-test.php index 5c8b8e355..5f74f3f92 100644 --- a/plugins/dominant-color-images/tests/dominant-color-test.php +++ b/plugins/dominant-color-images/tests/dominant-color-test.php @@ -144,7 +144,7 @@ public function test_tag_add_adjust_to_image_attributes( $image_path, $expected_ * @param bool $expected Whether the dominant color should be added. */ public function test_dominant_color_img_tag_add_dominant_color_requires_proper_quotes( $image, $expected ) { - $attachment_id = self::factory()->attachment->create_upload_object( TESTS_PLUGIN_ROOT . '/tests/testdata/modules/images/dominant-color-images/red.jpg' ); + $attachment_id = self::factory()->attachment->create_upload_object( TESTS_PLUGIN_DIR . '/tests/data/images/red.jpg' ); wp_maybe_generate_attachment_metadata( get_post( $attachment_id ) ); $image_url = wp_get_attachment_image_url( $attachment_id ); @@ -192,7 +192,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_ROOT . '/tests/testdata/modules/images/dominant-color-images/red.jpg' ); + $attachment_id = self::factory()->attachment->create_upload_object( TESTS_PLUGIN_DIR . '/tests/data/images/red.jpg' ); wp_maybe_generate_attachment_metadata( get_post( $attachment_id ) ); list( $src, $width, $height ) = wp_get_attachment_image_src( $attachment_id ); @@ -232,7 +232,7 @@ public function data_provider_dominant_color_check_inline_style() { * @param string $expected The expected style attribute and value. */ public function test_dominant_color_update_attachment_image_attributes( $style_attr, $expected ) { - $attachment_id = self::factory()->attachment->create_upload_object( TESTS_PLUGIN_ROOT . '/tests/testdata/modules/images/dominant-color-images/red.jpg' ); + $attachment_id = self::factory()->attachment->create_upload_object( TESTS_PLUGIN_DIR . '/tests/data/images/red.jpg' ); $attachment_image = wp_get_attachment_image( $attachment_id, 'full', '', array( 'style' => $style_attr ) ); $this->assertStringContainsString( $expected, $attachment_image ); diff --git a/plugins/dominant-color-images/tests/testcase.php b/plugins/dominant-color-images/tests/testcase.php index 74b361f76..b8261feb6 100644 --- a/plugins/dominant-color-images/tests/testcase.php +++ b/plugins/dominant-color-images/tests/testcase.php @@ -13,85 +13,85 @@ abstract class TestCase extends WP_UnitTestCase { public function provider_get_dominant_color() { return array( 'animated_gif' => array( - 'image_path' => TESTS_PLUGIN_ROOT . '/tests/testdata/modules/images/dominant-color-images/animated.gif', + 'image_path' => TESTS_PLUGIN_DIR . '/tests/data/images/animated.gif', 'expected_color' => array( '874e4e', '864e4e', 'df7f7f' ), 'expected_transparency' => true, ), 'red_jpg' => array( - 'image_path' => TESTS_PLUGIN_ROOT . '/tests/testdata/modules/images/dominant-color-images/red.jpg', + 'image_path' => TESTS_PLUGIN_DIR . '/tests/data/images/red.jpg', 'expected_color' => array( 'ff0000', 'fe0000' ), 'expected_transparency' => false, ), 'green_jpg' => array( - 'image_path' => TESTS_PLUGIN_ROOT . '/tests/testdata/modules/images/dominant-color-images/green.jpg', + 'image_path' => TESTS_PLUGIN_DIR . '/tests/data/images/green.jpg', 'expected_color' => array( '00ff00', '00ff01', '02ff01' ), 'expected_transparency' => false, ), 'white_jpg' => array( - 'image_path' => TESTS_PLUGIN_ROOT . '/tests/testdata/modules/images/dominant-color-images/white.jpg', + 'image_path' => TESTS_PLUGIN_DIR . '/tests/data/images/white.jpg', 'expected_color' => array( 'ffffff' ), 'expected_transparency' => false, ), 'red_gif' => array( - 'image_path' => TESTS_PLUGIN_ROOT . '/tests/testdata/modules/images/dominant-color-images/red.gif', + 'image_path' => TESTS_PLUGIN_DIR . '/tests/data/images/red.gif', 'expected_color' => array( 'ff0000' ), 'expected_transparency' => false, ), 'green_gif' => array( - 'image_path' => TESTS_PLUGIN_ROOT . '/tests/testdata/modules/images/dominant-color-images/green.gif', + 'image_path' => TESTS_PLUGIN_DIR . '/tests/data/images/green.gif', 'expected_color' => array( '00ff00' ), 'expected_transparency' => false, ), 'white_gif' => array( - 'image_path' => TESTS_PLUGIN_ROOT . '/tests/testdata/modules/images/dominant-color-images/white.gif', + 'image_path' => TESTS_PLUGIN_DIR . '/tests/data/images/white.gif', 'expected_color' => array( 'ffffff' ), 'expected_transparency' => false, ), 'trans_gif' => array( - 'image_path' => TESTS_PLUGIN_ROOT . '/tests/testdata/modules/images/dominant-color-images/trans.gif', + 'image_path' => TESTS_PLUGIN_DIR . '/tests/data/images/trans.gif', 'expected_color' => array( '5a5a5a', '020202' ), 'expected_transparency' => true, ), 'red_png' => array( - 'image_path' => TESTS_PLUGIN_ROOT . '/tests/testdata/modules/images/dominant-color-images/red.png', + 'image_path' => TESTS_PLUGIN_DIR . '/tests/data/images/red.png', 'expected_color' => array( 'ff0000' ), 'expected_transparency' => false, ), 'green_png' => array( - 'image_path' => TESTS_PLUGIN_ROOT . '/tests/testdata/modules/images/dominant-color-images/green.png', + 'image_path' => TESTS_PLUGIN_DIR . '/tests/data/images/green.png', 'expected_color' => array( '00ff00' ), 'expected_transparency' => false, ), 'white_png' => array( - 'image_path' => TESTS_PLUGIN_ROOT . '/tests/testdata/modules/images/dominant-color-images/white.png', + 'image_path' => TESTS_PLUGIN_DIR . '/tests/data/images/white.png', 'expected_color' => array( 'ffffff' ), 'expected_transparency' => false, ), 'trans_png' => array( - 'image_path' => TESTS_PLUGIN_ROOT . '/tests/testdata/modules/images/dominant-color-images/trans.png', + 'image_path' => TESTS_PLUGIN_DIR . '/tests/data/images/trans.png', 'expected_color' => array( '000000' ), 'expected_transparency' => true, ), 'red_webp' => array( - 'image_path' => TESTS_PLUGIN_ROOT . '/tests/testdata/modules/images/dominant-color-images/red.webp', + 'image_path' => TESTS_PLUGIN_DIR . '/tests/data/images/red.webp', 'expected_color' => array( 'ff0000' ), 'expected_transparency' => false, ), 'green_webp' => array( - 'image_path' => TESTS_PLUGIN_ROOT . '/tests/testdata/modules/images/dominant-color-images/green.webp', + 'image_path' => TESTS_PLUGIN_DIR . '/tests/data/images/green.webp', 'expected_color' => array( '00ff00' ), 'expected_transparency' => false, ), 'white_webp' => array( - 'image_path' => TESTS_PLUGIN_ROOT . '/tests/testdata/modules/images/dominant-color-images/white.webp', + 'image_path' => TESTS_PLUGIN_DIR . '/tests/data/images/white.webp', 'expected_color' => array( 'ffffff' ), 'expected_transparency' => false, ), 'trans_webp' => array( - 'image_path' => TESTS_PLUGIN_ROOT . '/tests/testdata/modules/images/dominant-color-images/trans.webp', + 'image_path' => TESTS_PLUGIN_DIR . '/tests/data/images/trans.webp', 'expected_color' => array( '000000' ), 'expected_transparency' => true, ), @@ -111,10 +111,10 @@ public function provider_get_dominant_color() { public function provider_get_dominant_color_invalid_images() { return array( 'tiff' => array( - 'image_path' => TESTS_PLUGIN_ROOT . '/tests/testdata/modules/images/dominant-color-images/test-image.tiff', + 'image_path' => TESTS_PLUGIN_DIR . '/tests/data/images/test-image.tiff', ), 'bmp' => array( - 'image_path' => TESTS_PLUGIN_ROOT . '/tests/testdata/modules/images/dominant-color-images/test-image.bmp', + 'image_path' => TESTS_PLUGIN_DIR . '/tests/data/images/test-image.bmp', ), ); } @@ -127,10 +127,10 @@ public function provider_get_dominant_color_invalid_images() { public function provider_get_dominant_color_none_images() { return array( 'pdf' => array( - 'files_path' => TESTS_PLUGIN_ROOT . '/tests/testdata/modules/images/dominant-color-images/wordpress-gsoc-flyer.pdf', + 'files_path' => TESTS_PLUGIN_DIR . '/tests/data/images/wordpress-gsoc-flyer.pdf', ), 'mp4' => array( - 'files_path' => TESTS_PLUGIN_ROOT . '/tests/testdata/modules/images/dominant-color-images/small-video.mp4', + 'files_path' => TESTS_PLUGIN_DIR . '/tests/data/images/small-video.mp4', ), ); }