Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhancement: Consider baseURI of referringElement (<base href="...">) #109

Merged
merged 5 commits into from
Aug 16, 2020

Conversation

eHtmlu
Copy link
Contributor

@eHtmlu eHtmlu commented Aug 11, 2020

Copy link
Owner

@dantleech dantleech left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great thanks! Would be great if we could also add a test for this scenario in this test case:

class CrawlCommandTest extends EndToEndTestCase

Maybe by setting up a new "test website" in tests/Example e.g. tests/Example/base-url

@@ -8,6 +8,7 @@ class ReferringElement
{
private $xpath = '';
private $title = '';
private $baseURI = '';
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Camel case would be more consistent $baseUri


return $new;
}

public function baseURI(): ?string
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same

$base = self::fromUrl($baseURI);
} else {
$base = $this;
}
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe extract to a private method resolveBaseUri and remove the else?

@eHtmlu
Copy link
Contributor Author

eHtmlu commented Aug 15, 2020

Thank you for all your hints! I tried to make all of these things. But I couldn't get the unit tests to run successfully on my machine. I think, however, my added test should work well. (don't know whether it's already automatically checked here).

@dantleech dantleech merged commit acac7cc into dantleech:master Aug 16, 2020
@dantleech
Copy link
Owner

Nice work, thanks! The test works fine on Travis and on my local machine, strange that it doesn't on yours 🤔

@eHtmlu
Copy link
Contributor Author

eHtmlu commented Aug 16, 2020

Nice work, thanks! The test works fine on Travis and on my local machine, strange that it doesn't on yours 🤔

Maybe I haven't installed it correctly.

If I do this:

git clone https://github.com/dantleech/fink.git .
composer install
./vendor/bin/phpunit

then I get many errors. It says the command "bin/fink" doesn't exist.

If I call "bin/fink" directly:

bin/fink http://example.com/

it works well 🤷‍♂️

Anyway, thanks for the merge! I'm happy I could help! 😊 ... was my first time making a pull request 😊

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants