@@ 875-908 (lines=34) @@ | ||
872 | /** |
|
873 | * Test that a long sentence will start a new tweet when it's too long to append to the previous tweet. |
|
874 | */ |
|
875 | public function test_short_paragraph_followed_by_long_sentence() { |
|
876 | $test_paragraph = 'This is 23 characters. '; |
|
877 | $test_sentence_chunk = 'This is 22 characters '; |
|
878 | ||
879 | $blocks = array( |
|
880 | $this->generateParagraphData( $test_paragraph ), |
|
881 | $this->generateParagraphData( str_repeat( $test_sentence_chunk, 13 ) ), |
|
882 | ); |
|
883 | ||
884 | $expected_text = array( |
|
885 | trim( $test_paragraph ), |
|
886 | str_repeat( $test_sentence_chunk, 12 ) . 'This is 22…', |
|
887 | '…characters', |
|
888 | ); |
|
889 | ||
890 | $expected_boundaries = array( |
|
891 | false, |
|
892 | $this->generateNormalBoundary( 274, 275, 'content' ), |
|
893 | false, |
|
894 | ); |
|
895 | ||
896 | $expected_blocks = array( |
|
897 | array( $blocks[0] ), |
|
898 | array( $blocks[1] ), |
|
899 | array( $blocks[1] ), |
|
900 | ); |
|
901 | ||
902 | $this->assertTweetGenerated( |
|
903 | $blocks, |
|
904 | $expected_text, |
|
905 | $expected_boundaries, |
|
906 | $expected_blocks |
|
907 | ); |
|
908 | } |
|
909 | ||
910 | /** |
|
911 | * Test that a basic verse maintains spacing. |
|
@@ 993-1025 (lines=33) @@ | ||
990 | * Test that a long list will start a new tweet when it's too long to be appended to the previous |
|
991 | * tweet, even if some of the lines in the list would fit. |
|
992 | */ |
|
993 | public function test_short_paragraph_followed_by_long_list() { |
|
994 | $test_content = 'This is 22 characters.'; |
|
995 | ||
996 | $blocks = array( |
|
997 | $this->generateParagraphData( $test_content ), |
|
998 | $this->generateListData( str_repeat( "<li>$test_content</li>", 12 ) ), |
|
999 | ); |
|
1000 | ||
1001 | $expected_text = array( |
|
1002 | $test_content, |
|
1003 | trim( str_repeat( "- $test_content\n", 11 ) ), |
|
1004 | "- $test_content", |
|
1005 | ); |
|
1006 | ||
1007 | $expected_boundaries = array( |
|
1008 | false, |
|
1009 | $this->generateLineBoundary( 10, 'values' ), |
|
1010 | false, |
|
1011 | ); |
|
1012 | ||
1013 | $expected_blocks = array( |
|
1014 | array( $blocks[0] ), |
|
1015 | array( $blocks[1] ), |
|
1016 | array( $blocks[1] ), |
|
1017 | ); |
|
1018 | ||
1019 | $this->assertTweetGenerated( |
|
1020 | $blocks, |
|
1021 | $expected_text, |
|
1022 | $expected_boundaries, |
|
1023 | $expected_blocks |
|
1024 | ); |
|
1025 | } |
|
1026 | ||
1027 | /** |
|
1028 | * Test that a range of emoji (including a variety of compound emoji) count as two characters. |