title = 'Title'; $result->text = str_repeat('this is a long search query ', 20); $result->url = 'http://url'; // Since not all the marked tags fit into the excerpt, the last // occurence should not be wrapped in tags to prevent broken html $expected = str_repeat('this is a long search query ', 8) . 'this is a long search quer...'; $this->assertEquals($expected, $result->excerpt); } }