Code Duplication    Length = 14-14 lines in 2 locations

projects/packages/post-images/tests/php/test-post-images.php 2 locations

@@ 490-503 (lines=14) @@
487
	 * @covers \Automattic\Jetpack\Post_Images::from_blocks
488
	 * @since 9.1.0
489
	 */
490
	public function test_from_story_block_from_post_id_is_correct_array_videopress() {
491
		$media_types = array( 'image', 'videopress' );
492
		$post_info   = $this->get_post_with_story_block( $media_types );
493
494
		$images = Post_Images::from_blocks( $post_info['post_id'] );
495
496
		$this->assertCount( 2, $images );
497
498
		$this->assertEquals( $post_info['img_urls'][0], $images[0]['src'] );
499
500
		// The second media is a VideoPress video, so expect a poster URL.
501
		$expected_poster_url = str_replace( 'mp4', 'jpg', $post_info['img_urls'][1] );
502
		$this->assertEquals( $expected_poster_url, $images[1]['src'] );
503
	}
504
505
	/**
506
	 * Test if the array extracted from a Story block includes the correct image URLs.
@@ 513-526 (lines=14) @@
510
	 * @covers \Automattic\Jetpack\Post_Images::from_blocks
511
	 * @since 9.1.0
512
	 */
513
	public function test_from_story_block_from_post_id_is_correct_array_videopress_wpcom() {
514
		$media_types = array( 'image', 'videopress' );
515
		$post_info   = $this->get_post_with_story_block( $media_types, true );
516
517
		$images = Post_Images::from_blocks( $post_info['post_id'] );
518
519
		$this->assertCount( 2, $images );
520
521
		$this->assertEquals( $post_info['img_urls'][0], $images[0]['src'] );
522
523
		// The second media is a VideoPress video, so expect a poster URL.
524
		$expected_poster_url = str_replace( 'mp4', 'jpg', $post_info['img_urls'][1] );
525
		$this->assertEquals( $expected_poster_url, $images[1]['src'] );
526
	}
527
528
	/**
529
	 * Create a media attachment.