Code Duplication    Length = 45-46 lines in 2 locations

projects/plugins/jetpack/tests/php/_inc/lib/test-class.jetpack-tweetstorm-helper.php 2 locations

@@ 1605-1649 (lines=45) @@
1602
	/**
1603
	 * Test that a gallery block with too many images will be trimmed down to 4.
1604
	 */
1605
	public function test_long_gallery_is_trimmed() {
1606
		$test_images = array(
1607
			array(
1608
				'url'  => 'https://pentophoto.files.wordpress.com/2019/03/mvimg_20190317_1915122.jpg',
1609
				'alt'  => 'This is how we roll.',
1610
				'type' => 'image/jpeg',
1611
			),
1612
			array(
1613
				'url'  => 'https://pentophoto.files.wordpress.com/2019/01/IMG_20190101_175338.jpg',
1614
				'alt'  => 'Like a boss.',
1615
				'type' => 'image/jpeg',
1616
			),
1617
			array(
1618
				'url'  => 'https://pentophoto.files.wordpress.com/2020/02/wp-1582952469369.jpg',
1619
				'alt'  => 'Is this really a selfie?',
1620
				'type' => 'image/jpeg',
1621
			),
1622
			array(
1623
				'url'  => 'https://pentophoto.files.wordpress.com/2019/03/mvimg_20190318_152120.jpg',
1624
				'alt'  => 'Keeping up with pop culture.',
1625
				'type' => 'image/jpeg',
1626
			),
1627
			array(
1628
				'url'  => 'https://pentophoto.files.wordpress.com/2019/03/mvimg_20190317_1915122.jpg',
1629
				'alt'  => 'Why does the raccoon miss out?! 😢',
1630
				'type' => 'image/jpeg',
1631
			),
1632
		);
1633
1634
		$blocks = array(
1635
			$this->generateGalleryData( $test_images ),
1636
		);
1637
1638
		$expected_content = array(
1639
			array(
1640
				'media' => array_slice( $test_images, 0, 4 ),
1641
			),
1642
		);
1643
1644
		$expected_boundaries = array( false );
1645
1646
		$expected_blocks = array( $blocks );
1647
1648
		$this->assertTweetGenerated( $blocks, $expected_content, $expected_boundaries, $expected_blocks );
1649
	}
1650
1651
	/**
1652
	 * Test that a gallery block with a GIF as the first image is trimmed down to just that GIF.
@@ 1654-1699 (lines=46) @@
1651
	/**
1652
	 * Test that a gallery block with a GIF as the first image is trimmed down to just that GIF.
1653
	 */
1654
	public function test_gallery_starting_with_gif_is_trimmed() {
1655
		$test_images = array(
1656
			array(
1657
				'url'  => 'https://jetpackme.files.wordpress.com/2018/10/jetpack-site-accelerator-toggle-gif.gif',
1658
				'alt'  => 'This is probably a GIF.',
1659
				'type' => 'image/gif',
1660
			),
1661
			array(
1662
				'url'  => 'https://pentophoto.files.wordpress.com/2019/01/IMG_20190101_175338.jpg',
1663
				'alt'  => 'Like a boss.',
1664
				'type' => 'image/jpeg',
1665
			),
1666
			array(
1667
				'url'  => 'https://pentophoto.files.wordpress.com/2020/02/wp-1582952469369.jpg',
1668
				'alt'  => 'Is this really a selfie?',
1669
				'type' => 'image/jpeg',
1670
			),
1671
			array(
1672
				'url'  => 'https://pentophoto.files.wordpress.com/2019/03/mvimg_20190318_152120.jpg',
1673
				'alt'  => 'Keeping up with pop culture.',
1674
				'type' => 'image/jpeg',
1675
			),
1676
			array(
1677
				'url'  => 'https://pentophoto.files.wordpress.com/2019/03/mvimg_20190317_1915122.jpg',
1678
				'alt'  => 'Why does the raccoon miss out?! 😢',
1679
				'type' => 'image/jpeg',
1680
			),
1681
		);
1682
1683
		$blocks = array(
1684
			$this->generateGalleryData( $test_images ),
1685
		);
1686
1687
		$expected_content = array(
1688
			array(
1689
				'media' => array_slice( $test_images, 0, 1 ),
1690
			),
1691
		);
1692
1693
		$expected_boundaries = array( false );
1694
1695
		$expected_blocks = array( $blocks );
1696
1697
		$this->assertTweetGenerated( $blocks, $expected_content, $expected_boundaries, $expected_blocks );
1698
1699
	}
1700
	/**
1701
	 * Test that a gallery block with a GIF not as the first image has that GIF filtered out.
1702
	 */