Skip to content

Conversation

robertfausk
Copy link
Contributor

...cause it will break when PantherTestCaseTrait is used in a class
which implements and uses getClient with object context.

This maybe-issue was introduced with:
b9225b0

In my specific case I have a method in object context wich will break my test application:
https://github.com/robertfausk/mink-panther-driver/blob/master/src/PantherDriver.php#L62

cause it will break when PantherTestCaseTrait is used in a class
which implements and uses getClient with object context
@dunglas
Copy link
Member

dunglas commented Aug 23, 2019

This method is always static isn’t it?

@robertfausk
Copy link
Contributor Author

If a class is using the PantherTestCaseTrait and implementing

public function getClient()

then this method of the implementing class will be called.

E.g. following will result in an error:

public function getClient()
{
    $this->doSomething();
}

@dunglas
Copy link
Member

dunglas commented Aug 23, 2019

Ok got it. If you both import PantherTestCaseTrait and not import WebTestAssertionsTrait because you already defined getClient it breaks.

@dunglas dunglas merged commit 8c27245 into symfony:master Aug 23, 2019
@robertfausk robertfausk deleted the fix_calling_static_method_when_in_object_context branch August 23, 2019 19:13
@dunglas
Copy link
Member

dunglas commented Aug 23, 2019

Thanks @robertfausk

dunglas added a commit that referenced this pull request Dec 28, 2020
…en_in_object_context

Prevent call of self::getClient when not in static context
nicolas-grekas pushed a commit that referenced this pull request Jan 18, 2021
…en_in_object_context

Prevent call of self::getClient when not in static context
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