Remove Guzzle as dependency by Kekos · Pull Request #16 · Codeception/lib-web · GitHub
Skip to content

Remove Guzzle as dependency - #16

Open
Kekos wants to merge 1 commit into
Codeception:mainfrom
Kekos:replace-guzzle
Open

Kekos wants to merge 1 commit into
Codeception:mainfrom
Kekos:replace-guzzle

Conversation

@Kekos

@Kekos Kekos commented May 25, 2025

Copy link
Copy Markdown

The usage of the Guzzle lib inside this library was minimal, only used for URI parsing. Since I don't use Guzzle in my own projects, I thought it could be replaced in this package.

@SamMousa

Copy link
Copy Markdown
Contributor

@Kekos

Kekos commented May 25, 2025

Copy link
Copy Markdown
Author

Yes, I can see that being a problem. I'll check on it some time.

Can I run the static analysis locally? Could only find PHPUnit as a dependency.

@SamMousa

Copy link
Copy Markdown
Contributor

Yes, just get phpstan. For example using phive.

@Kekos
Kekos force-pushed the replace-guzzle branch from bc77813 to b61d827 Compare May 26, 2025 20:51
@Kekos

Kekos commented May 26, 2025

Copy link
Copy Markdown
Author

I'm not quite sure how a relative URL would apply to the use cases of the \Codeception\Util\Uri metods?

@SamMousa

Copy link
Copy Markdown
Contributor

Don't force push please. It makes reviewing harder!

@SamMousa

Copy link
Copy Markdown
Contributor

I'm not quite sure how a relative URL would apply to the use cases of the \Codeception\Util\Uri metods?

From the webdriver module:

private function filterNodesByHref(string $url, array $nodes): array
    {
        //current uri can be relative, merging it with configured base url gives absolute url
        $absoluteCurrentUrl = Uri::mergeUrls($this->_getUrl(), $this->_getCurrentUri());
        $expectedUrl = Uri::mergeUrls($absoluteCurrentUrl, $url);
        return array_filter(
            $nodes,
            function (WebDriverElement $e) use ($expectedUrl, $absoluteCurrentUrl): bool {
                $elementHref = Uri::mergeUrls($absoluteCurrentUrl, $e->getAttribute('href') ?? '');
                return $elementHref === $expectedUrl;
            }
        );
    }

@Kekos

Kekos commented Jun 1, 2025

Copy link
Copy Markdown
Author

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.

2 participants