public function testEncodeUrls() { $message = "This test contains a url here http://www.sugarcrm.com and not here amazon.com"; $text = SugarFeed::parseMessage($message); $this->assertContains("<a href='http://www.sugarcrm.com' target='_blank'>http://www.sugarcrm.com</a>", $text, "Url encoded incorrectly"); $this->assertNotContains("http://amazon.com", $text, "Second link should not be encoded"); }
public function testparseMessage() { //test with a string with no links $html = 'some text with no urls'; $result = SugarFeed::parseMessage($html); $this->assertEquals($html, $result); //test with a string with links $html = 'some text http://www.url.com with no urls'; $expected = "some text <a href='http://www.url.com' target='_blank'>http://www.url.com</a> with no urls"; $result = SugarFeed::parseMessage($html); $this->assertEquals($expected, $result); }