Skip to content

Commit

Permalink
Update dominant-color-images plugin test data images path
Browse files Browse the repository at this point in the history
  • Loading branch information
thelovekesh committed Feb 25, 2024
1 parent 344e2b1 commit ad549e0
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 23 deletions.
6 changes: 3 additions & 3 deletions plugins/dominant-color-images/tests/dominant-color-test.php
Expand Up @@ -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 );
Expand Down Expand Up @@ -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 );
Expand Down Expand Up @@ -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 );
Expand Down
40 changes: 20 additions & 20 deletions plugins/dominant-color-images/tests/testcase.php
Expand Up @@ -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,
),
Expand All @@ -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',
),
);
}
Expand All @@ -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',
),
);
}
Expand Down

0 comments on commit ad549e0

Please sign in to comment.