assertContains('http://example.com/', $links);
}
public function testFindLinksInHTML() {
$links = FindLinks::inHTML('Hello');
$this->assertContains('http://example.com/', $links);
}
public function testFindLinksInJSONArray() {
$links = FindLinks::all([
'link' => 'http://example.com/',
'nested' => [
'foo' => 'http://example.net/',
'html' => 'This is some html with a link',
'photo' => [
'http://example.com/img.jpg'
],
'bar' => [
'baz' => [
'http://example.org/'
]
],
[[['http://example.io/']]]
]
]);
$this->assertContains('http://example.com/', $links);
$this->assertContains('http://example.com/img.jpg', $links);
$this->assertContains('http://example.net/', $links);
$this->assertContains('http://example.org/', $links);
$this->assertContains('http://example.io/', $links);
$this->assertContains('http://example.html/', $links);
}
}