Skip to content

Commit

Permalink
Added failing tests for issue #30
Browse files Browse the repository at this point in the history
  • Loading branch information
brendanheywood committed May 30, 2016
1 parent a838968 commit e18a76e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
4 changes: 2 additions & 2 deletions classes/robot/crawler.php
Original file line number Diff line number Diff line change
Expand Up @@ -129,12 +129,12 @@ public function auto_create_bot() {
* @return string absolute url
*/
public function absolute_url($base, $rel) {
/* return if already absolute URL */
// Return if already absolute URL.
if (parse_url($rel, PHP_URL_SCHEME) != '') {
return $rel;
}

/* queries and anchors */
// Handle links which are only queries or anchors.
if ($rel[0] == '#' || $rel[0] == '?') {
return $base.$rel;
}
Expand Down
9 changes: 9 additions & 0 deletions tests/robot_crawler_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,15 @@ protected function setUp() {
*/
public function provider() {
return array(
// Issue 30
// array(
// 'base' => 'http://test.com',
// 'links' => array(
// '/file.php' => 'http://test.com/file.php',
// '#hash' => 'http://test.com/#hash',
// 'http://foo.com' => 'http://foo.com/',
// )
// ),
array(
'base' => 'http://test.com/sub/',
'links' => array(
Expand Down

0 comments on commit e18a76e

Please sign in to comment.