Skip to content

Commit

Permalink
Remove 'not contains' checks from PHP tests
Browse files Browse the repository at this point in the history
  • Loading branch information
sgomes committed Sep 4, 2024
1 parent f518c23 commit f11a6b3
Showing 1 changed file with 8 additions and 12 deletions.
20 changes: 8 additions & 12 deletions phpunit/blocks/render-block-media-text-test.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,14 +81,13 @@ public function test_render_block_core_media_text_featured_image() {
$rendered = gutenberg_render_block_core_media_text( $attributes, $content );
$this->assertStringContainsString( '<img alt="" src="' . wp_get_attachment_image_url( self::$attachment_id, 'full' ) . '"', $rendered );

// Assert that the rendered block contains the featured image as an image element
// and not as a background-image url, when image fill is true.
// Assert that the rendered block contains the featured image as an image element,
// when image fill is true.
$attributes = array(
'useFeaturedImage' => true,
'imageFill' => true,
);
$rendered = gutenberg_render_block_core_media_text( $attributes, $content );
$this->assertStringNotContainsString( 'background-image:', $rendered );
$this->assertStringContainsString( '<img alt="" src="' . wp_get_attachment_image_url( self::$attachment_id, 'full' ) . '"', $rendered );
}

Expand All @@ -107,14 +106,13 @@ public function test_render_block_core_media_text_featured_image_nested() {
$rendered = gutenberg_render_block_core_media_text( $attributes, $content );
$this->assertStringContainsString( '<img alt="" src="' . wp_get_attachment_image_url( self::$attachment_id, 'full' ) . '"', $rendered );

// Assert that the rendered block contains the featured image as an image element
// and not as a background-image url, when image fill is true.
// Assert that the rendered block contains the featured image as an image element,
// when image fill is true.
$attributes = array(
'useFeaturedImage' => true,
'imageFill' => true,
);
$rendered = gutenberg_render_block_core_media_text( $attributes, $content );
$this->assertStringNotContainsString( 'background-image:', $rendered );
$this->assertStringContainsString( '<img alt="" src="' . wp_get_attachment_image_url( self::$attachment_id, 'full' ) . '"', $rendered );
}

Expand All @@ -134,15 +132,14 @@ public function test_render_block_core_media_text_featured_image_media_on_right(
$rendered = gutenberg_render_block_core_media_text( $attributes, $content );
$this->assertStringContainsString( '<img alt="" src="' . wp_get_attachment_image_url( self::$attachment_id, 'full' ) . '"', $rendered );

// Assert that the rendered block contains the featured image as an image element
// and not as a background-image url, when image fill is true and the media is on the right.
// Assert that the rendered block contains the featured image as an image element,
// when image fill is true and the media is on the right.
$attributes = array(
'useFeaturedImage' => true,
'mediaPosition' => 'right',
'imageFill' => true,
);
$rendered = gutenberg_render_block_core_media_text( $attributes, $content );
$this->assertStringNotContainsString( 'background-image:', $rendered );
$this->assertStringContainsString( '<img alt="" src="' . wp_get_attachment_image_url( self::$attachment_id, 'full' ) . '"', $rendered );
}

Expand All @@ -164,16 +161,15 @@ public function test_render_block_core_media_text_featured_image_media_on_right_
$rendered = gutenberg_render_block_core_media_text( $attributes, $content );
$this->assertStringContainsString( '<img alt="" src="' . wp_get_attachment_image_url( self::$attachment_id, 'full' ) . '"', $rendered );

// Assert that the rendered block contains the featured image as an image element
// and not as a background-image url, when image fill is true and the media is on the right.
// Assert that the rendered block contains the featured image as an image element,
// when image fill is true and the media is on the right.
$attributes = array(
'useFeaturedImage' => true,
'mediaPosition' => 'right',
'imageFill' => true,
);

$rendered = gutenberg_render_block_core_media_text( $attributes, $content );
$this->assertStringNotContainsString( 'background-image:', $rendered );
$this->assertStringContainsString( '<img alt="" src="' . wp_get_attachment_image_url( self::$attachment_id, 'full' ) . '"', $rendered );
}
}

0 comments on commit f11a6b3

Please sign in to comment.