public function testSplit() { $string = 'foo<hr id="system-readmore">bar'; $result = EventgalleryHelpersTextsplitter::split($string); $this->assertEquals("foo", $result->introtext, 'Intro text does not match'); $this->assertEquals("bar", $result->fulltext, 'Full text does not match'); $string = '<hr id="system-readmore">bar'; $result = EventgalleryHelpersTextsplitter::split($string); $this->assertEquals("", $result->introtext, 'Intro text does not match'); $this->assertEquals("bar", $result->fulltext, 'Full text does not match'); $string = 'foo<hr id="system-readmore">'; $result = EventgalleryHelpersTextsplitter::split($string); $this->assertEquals("foo", $result->introtext, 'Intro text does not match'); $this->assertEquals("", $result->fulltext, 'Full text does not match'); $string = 'foo bar'; $result = EventgalleryHelpersTextsplitter::split($string); $this->assertEquals("foo bar", $result->introtext, 'Intro text does not match'); $this->assertEquals("foo bar", $result->fulltext, 'Full text does not match'); }
/** * returns the intro text for the folder if there is a splitter in the text. * Otherwise the introtext is the same as the text. * * @return String */ public function getIntroText() { if ($this->_ls_text == null) { return ""; } $splittedText = EventgalleryHelpersTextsplitter::split($this->_ls_text->get()); return $splittedText->introtext; }