| @@ 892-925 (lines=34) @@ | ||
| 889 | /** |
|
| 890 | * Test that a long sentence will start a new tweet when it's too long to append to the previous tweet. |
|
| 891 | */ |
|
| 892 | public function test_short_paragraph_followed_by_long_sentence() { |
|
| 893 | $test_paragraph = 'This is 23 characters. '; |
|
| 894 | $test_sentence_chunk = 'This is 22 characters '; |
|
| 895 | ||
| 896 | $blocks = array( |
|
| 897 | $this->generateParagraphData( $test_paragraph ), |
|
| 898 | $this->generateParagraphData( str_repeat( $test_sentence_chunk, 13 ) ), |
|
| 899 | ); |
|
| 900 | ||
| 901 | $expected_text = array( |
|
| 902 | trim( $test_paragraph ), |
|
| 903 | str_repeat( $test_sentence_chunk, 12 ) . 'This is 22…', |
|
| 904 | '…characters', |
|
| 905 | ); |
|
| 906 | ||
| 907 | $expected_boundaries = array( |
|
| 908 | false, |
|
| 909 | $this->generateNormalBoundary( 274, 275, 'content' ), |
|
| 910 | false, |
|
| 911 | ); |
|
| 912 | ||
| 913 | $expected_blocks = array( |
|
| 914 | array( $blocks[0] ), |
|
| 915 | array( $blocks[1] ), |
|
| 916 | array( $blocks[1] ), |
|
| 917 | ); |
|
| 918 | ||
| 919 | $this->assertTweetGenerated( |
|
| 920 | $blocks, |
|
| 921 | $expected_text, |
|
| 922 | $expected_boundaries, |
|
| 923 | $expected_blocks |
|
| 924 | ); |
|
| 925 | } |
|
| 926 | ||
| 927 | /** |
|
| 928 | * Test that a basic verse maintains spacing. |
|
| @@ 1010-1042 (lines=33) @@ | ||
| 1007 | * Test that a long list will start a new tweet when it's too long to be appended to the previous |
|
| 1008 | * tweet, even if some of the lines in the list would fit. |
|
| 1009 | */ |
|
| 1010 | public function test_short_paragraph_followed_by_long_list() { |
|
| 1011 | $test_content = 'This is 22 characters.'; |
|
| 1012 | ||
| 1013 | $blocks = array( |
|
| 1014 | $this->generateParagraphData( $test_content ), |
|
| 1015 | $this->generateListData( str_repeat( "<li>$test_content</li>", 12 ) ), |
|
| 1016 | ); |
|
| 1017 | ||
| 1018 | $expected_text = array( |
|
| 1019 | $test_content, |
|
| 1020 | trim( str_repeat( "- $test_content\n", 11 ) ), |
|
| 1021 | "- $test_content", |
|
| 1022 | ); |
|
| 1023 | ||
| 1024 | $expected_boundaries = array( |
|
| 1025 | false, |
|
| 1026 | $this->generateLineBoundary( 10, 'values' ), |
|
| 1027 | false, |
|
| 1028 | ); |
|
| 1029 | ||
| 1030 | $expected_blocks = array( |
|
| 1031 | array( $blocks[0] ), |
|
| 1032 | array( $blocks[1] ), |
|
| 1033 | array( $blocks[1] ), |
|
| 1034 | ); |
|
| 1035 | ||
| 1036 | $this->assertTweetGenerated( |
|
| 1037 | $blocks, |
|
| 1038 | $expected_text, |
|
| 1039 | $expected_boundaries, |
|
| 1040 | $expected_blocks |
|
| 1041 | ); |
|
| 1042 | } |
|
| 1043 | ||
| 1044 | /** |
|
| 1045 | * Test that a range of emoji (including a variety of compound emoji) count as two characters. |
|