Example #1
0
 public function testGetTitleFromUrl()
 {
     $url = 'http://kanboard.net/something';
     $html = '<!DOCTYPE html><html><head></head><body>Test</body></html>';
     $webLink = new WebLink($this->container);
     $webLink->setUrl($url);
     $this->assertEquals($url, $webLink->getUrl());
     $this->container['httpClient']->expects($this->once())->method('get')->with($url)->will($this->returnValue($html));
     $this->assertEquals('kanboard.net/something', $webLink->getTitle());
 }
Example #2
0
 public function testGetTitleFromUrl()
 {
     $url = 'http://kanboard.net/something';
     $html = '<!DOCTYPE html><html><head></head><body>Test</body></html>';
     $this->container['httpClient'] = $this->getMockBuilder('\\Kanboard\\Core\\Http\\Client')->setConstructorArgs(array($this->container))->setMethods(array('get'))->getMock();
     $webLink = new WebLink($this->container);
     $webLink->setUrl($url);
     $this->assertEquals($url, $webLink->getUrl());
     $this->container['httpClient']->expects($this->once())->method('get')->with($url)->will($this->returnValue($html));
     $this->assertEquals('kanboard.net/something', $webLink->getTitle());
 }
Example #3
0
 /**
  * Get the link found with the properties
  *
  * @access public
  * @return \Kanboard\Core\ExternalLink\ExternalLinkInterface
  */
 public function getLink()
 {
     $link = new WebLink($this->container);
     $link->setUrl($this->userInput);
     return $link;
 }