t('Node teaser tests'), 'desc' => t('Calls node_teaser() with different strings and lengths.'), 'group' => 'Node Tests', ); } function setUp() { parent::setUp(); } function tearDown() { parent::tearDown(); } /** * Simpletest test. Tests an edge case where if the first sentence is a * question and subsequent sentences are not. * This failed in drupal 5. * Test and patch for drupal 6 (committed) from * http://drupal.org/node/180425 */ function testFirstSentenceQuestion() { $body = 'A question? A sentence. Another sentence.'; $expectedTeaser = 'A question? A sentence.'; $this->callNodeTeaser($body, $expectedTeaser, NULL, 30); } /** * Simpletest test. A real-life example of the above edge case. */ function testFirstSentenceQuestion2() { $body = 'Are you an UberBabe? (Or an appreciator of UberBabes?) I am most definitely an UberBabe, and I\'m proud of it. Now, before anyone screams "sexism" or "bias" or "cheap" or anything more profane, let me clarify. An UberBabe is not someone who\'s playfully pierced navel protrudes from a belly bearing top. Not necessarily anyway. An UberBabe is a woman who likes being totally feminine, but is also smart as hell, brave, a rule breaker, speaks her mind, finds her own way, goes up against "the system" in a way that allows the system to evolve, and so on. UberBabes, frankly, kick booty - and they just may save the world.'; $expectedTeaser = 'Are you an UberBabe? (Or an appreciator of UberBabes?) I am most definitely an UberBabe, and I\'m proud of it. Now, before anyone screams "sexism" or "bias" or "cheap" or anything more profane, let me clarify.'; $this->callNodeTeaser($body, $expectedTeaser, NULL, 300); } /** * Simpletest test. Runs a test adapted from * http://drupal.org/node/180425#comment-634230 */ function testLength() { // This body string tests a number of edge cases. $body = "
\nHi\n
\n\nfolks\n
\n!\n
\nHi\n
\n\nfolks\n
\n!\n
", "
\n", "
\nH", "
\nHi", "
\nHi\n", "
\nHi\n<", "
\nHi\n", "
\nHi\n
\nHi\n", "\nHi\n
", "\nHi\n
", "\nHi\n
", "\nHi\n
", "\nHi\n
", "\nHi\n
", "\nHi\n
", "\nHi\n
", "\nHi\n
", "\nHi\n
", "\nHi\n
", "\nHi\n
", "\nHi\n
", "\nHi\n
", "\nHi\n
", "\nHi\n
", "\nHi\n
", "\nHi\n
", "\nHi\n
", "\nHi\n
", "\nHi\n
", "\nHi\n
", "\nHi\n
", "\nHi\n
\n\nfolks\n
\n!\n
\nHi\n
\n\nfolks\n
\n!\n
\nHi\n
\n\nfolks\n
\n!\n
\nHi\n
\n\nfolks\n
\n!\n
", "
", "
", "
", "
\nHi", "
\nHi", "
\nHi", "
\nHi", "
\nHi\n
", "\nHi\n
", "\nHi\n
", "\nHi\n
", "\nHi\n
", "\nHi\n
", "\nHi\n
", "\nHi\n
", "\nHi\n
", "\nHi\n
", "\nHi\n
", "\nHi\n
", "\nHi\n
", "\nHi\n
", "\nHi\n
", "\nHi\n
", "\nHi\n
", "\nHi\n
", "\nHi\n
", "\nHi\n
", "\nHi\n
", "\nHi\n
", "\nHi\n
", "\nHi\n
", "\nHi\n
\n\nfolks\n
\n!\n
\nHi\n
\n\nfolks\n
\n!\n
\nHi\n
\n\nfolks\n
\n!\n