Behat / MinkExtension

Mink extension (tight integration and configuration) for Behat
MIT License
636 stars 279 forks source link

Goutte\Client::setClient() does not exist #380

Open rkeet opened 2 years ago

rkeet commented 2 years ago

Having the following requirements in require-dev in composer.json:

        "atoum/atoum": "^4.0", (4.0.3)
        "behat/behat": "^3.8", (v3.10.0)
        "behat/mink-browserkit-driver": "^2.0", (v2.0.0)
        "behat/mink-goutte-driver": "^2.0", (v2.0.0)
        "behat/mink-selenium2-driver": "^1.5", (v1.5.0)

Running php vendor/bin/behat instantly crashes on:

In GoutteFactory.php line 117:

  Method Goutte\Client::setClient() does not exist  

Function causing the Exception https://github.com/Behat/MinkExtension/blob/ba8ba8bde58b168f409c7c1e8e4b906c12856124/src/Behat/MinkExtension/ServiceContainer/Driver/GoutteFactory.php#L117

Function:

    private function isGoutte1()
    {
        $refl = new \ReflectionParameter(array('Goutte\Client', 'setClient'), 0);

        $type = $refl->getType();
        if ($type instanceof \ReflectionNamedType && 'Guzzle\Http\ClientInterface' === $type->getName()) {
            return true;
        }

        return false;
    }

Now, Goutte\Client is an empty class which extends Symfony\Component\BrowserKit\HttpBrowser which in turn extends Symfony\Component\BrowserKit\AbstractBrowser.

Neither of the parent classes indeed have the function setClient.

What can I do to work around this for now or create a fix?

newscientistgeeks commented 2 years ago

Same here, any chance to merge the #381 ?

ghost commented 2 years ago

the #381 has been created months ago, is there any chance merge or not? I need it.

rkeet commented 2 years ago

Looking at this: https://github.com/Behat/MinkExtension/issues?q=is%3Aissue+sort%3Aupdated-desc I'm thinking this repository is quite dead.

Also judging by the non-response on this issue from 2020: https://github.com/Behat/MinkExtension/issues/370

Haven't tried it out yet (maybe some week soon), but I think it's worth switching to: https://github.com/FriendsOfBehat/MinkExtension

ghost commented 2 years ago

I switched to FriendsOfBehat, it worked for me.

tyler36 commented 11 months ago

Replacing behat/mink-extension with friends-of-behat/mink-extension resolved issue for me.

This project seems abandoned.