Code Duplication    Length = 8-14 lines in 4 locations

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

@@ 549-556 (lines=8) @@
546
	/**
547
	 * Test that a single short paragraph turns into one tweet.
548
	 */
549
	public function test_single_paragraph() {
550
		$test_content = 'This is some content.';
551
		$blocks       = array(
552
			$this->generateParagraphData( $test_content ),
553
		);
554
555
		$this->assertTweetGenerated( $blocks, array( $test_content ), array( false ), array( $blocks ) );
556
	}
557
558
	/**
559
	 * Test that multiple short paragraphs are joined together into one tweet.
@@ 614-626 (lines=13) @@
611
	/**
612
	 * Test that a single long paragraph is split into two tweets, breaking at the end of a sentence.
613
	 */
614
	public function test_line_break_is_preserved() {
615
		$test_content = "First line.\nsecond line.";
616
		$blocks       = array(
617
			$this->generateParagraphData( $test_content ),
618
		);
619
620
		$this->assertTweetGenerated(
621
			$blocks,
622
			array( $test_content ),
623
			array( false ),
624
			array( $blocks )
625
		);
626
	}
627
628
	/**
629
	 * Test that a single long paragraph containing multibyte characters is split into two tweets,
@@ 913-925 (lines=13) @@
910
	/**
911
	 * Test that a basic verse maintains spacing.
912
	 */
913
	public function test_basic_verse() {
914
		$test_content = " They say that code \n        is poetry.\n\n    Is indentation poetry,\n  too?";
915
916
		$blocks = array(
917
			$this->generateVerseData( $test_content ),
918
		);
919
920
		$expected_text = array(
921
			" They say that code\n        is poetry.\n\n    Is indentation poetry,\n  too?",
922
		);
923
924
		$this->assertTweetGenerated( $blocks, $expected_text, array( false ), array( $blocks ) );
925
	}
926
927
	/**
928
	 * Test that a long verse splits correctly.
@@ 1180-1193 (lines=14) @@
1177
	/**
1178
	 * Test that an assortment of blank lines in a list are ignored.
1179
	 */
1180
	public function test_blank_list_items() {
1181
		$test_content = 'This is 22 characters.';
1182
1183
		$blocks = array(
1184
			$this->generateListData( "<li></li><li></li><li><li></li><li>$test_content</li></li><li></li><li>$test_content</li>" ),
1185
		);
1186
1187
		$this->assertTweetGenerated(
1188
			$blocks,
1189
			array( "- $test_content\n- $test_content" ),
1190
			array( false ),
1191
			array( $blocks )
1192
		);
1193
	}
1194
1195
	/**
1196
	 * Test that a simple quote block renders correctly.