|
@@ 161-169 (lines=9) @@
|
| 158 |
|
* @covers \Automattic\Jetpack\Post_Images::from_blocks |
| 159 |
|
* @since 6.9.0 |
| 160 |
|
*/ |
| 161 |
|
public function test_from_image_block_from_post_id_is_correct_array() { |
| 162 |
|
$post_info = $this->get_post_with_image_block(); |
| 163 |
|
|
| 164 |
|
$images = Post_Images::from_blocks( $post_info['post_id'] ); |
| 165 |
|
|
| 166 |
|
$this->assertCount( 1, $images ); |
| 167 |
|
$this->assertEquals( $post_info['img_url'], $images[0]['src'] ); |
| 168 |
|
$this->assertEquals( $post_info['alt_text'], $images[0]['alt_text'] ); |
| 169 |
|
} |
| 170 |
|
|
| 171 |
|
/** |
| 172 |
|
* Test if an image block with an externally hosted image is not extracted by Post Images. |
|
@@ 252-259 (lines=8) @@
|
| 249 |
|
* @covers \Automattic\Jetpack\Post_Images::from_blocks |
| 250 |
|
* @since 6.9.0 |
| 251 |
|
*/ |
| 252 |
|
public function test_from_gallery_block_from_post_id_is_correct_array() { |
| 253 |
|
$post_info = $this->get_post_with_gallery_block(); |
| 254 |
|
|
| 255 |
|
$images = Post_Images::from_blocks( $post_info['post_id'] ); |
| 256 |
|
|
| 257 |
|
$this->assertEquals( $post_info['img_urls'][0], $images[0]['src'] ); |
| 258 |
|
$this->assertEquals( $post_info['img_urls'][1], $images[1]['src'] ); |
| 259 |
|
} |
| 260 |
|
|
| 261 |
|
/** |
| 262 |
|
* Test if the array extracted from Gallery blocks include the image URL. |
|
@@ 338-345 (lines=8) @@
|
| 335 |
|
* |
| 336 |
|
* @since 7.8.0 |
| 337 |
|
*/ |
| 338 |
|
public function test_from_columns_block_from_post_id_is_correct_array() { |
| 339 |
|
$post_info = $this->get_post_with_columns_block(); |
| 340 |
|
|
| 341 |
|
$images = Post_Images::from_blocks( $post_info['post_id'] ); |
| 342 |
|
|
| 343 |
|
$this->assertEquals( $post_info['img_url'], $images[0]['src'] ); |
| 344 |
|
$this->assertEquals( $post_info['alt_text'], $images[0]['alt_text'] ); |
| 345 |
|
} |
| 346 |
|
|
| 347 |
|
/** |
| 348 |
|
* Test if a Colunms block with an externally hosted image is not extracted by Post Images. |