-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
canSee - PHP Fatal error: Call to a member function addFailure() on a non-object #1981
Comments
Hi @wasmithee - this was fixed in #1834 and released in 2.0.12. |
This error is occurring in |
@wasmithee aah, I guess it wasn't merged into the 2.1 branch. @DavertMik not sure what your process is normally, do you rebase to 2.0 eventually? |
Everything from 2.0.13 was merged into master. Probably that was bad merge ( |
Hmm... all is looking okay to me in 2.1, and the can/cant tests we have are passing. @wasmithee if you have time to debug it and see what's causing the issue that would be great... otherwise I'll need to find a way to cause the issue to happen first since it's not failing in the tests we have. |
I created a project that reproduces the issue. It appears that this bug doen't reproduce in the first test that is run, but the subsequent test. I wonder if it doen't have something to do with the session obeject or something else related to the objects that persist between tests. The odd thing is that the passing validations work in the second test, just when one fails due to an object not being found. I do not see a way to attach a zip file with code. So I will paste what I think are the pertinent portions here:
acceptance.suite.yml
UserSteps.php
LoginPage.php
ManageUsers.php
ViewUser.php
|
I appreciate both of your help @zbateson and @DavertMik. Please let me know if there is more information you need to reproduce this issue. |
I've narrowed this down so far to being related to using step objects. I'm able to reproduce it with two test methods in a single cest, each with a Step class as a parameter, and each calling a failing can (or cant), e.g. canSee directly. Looks like it's related to cleanup performed when Step objects are used (but not yet certain of that.) |
You guys rock! (@zbateson, @DavertMik) Thanks for fixing this and being so responsive. So far I have no regrets choosing Codeception. Keep up the great work. |
When a canSee assertion doesn't find the specified element it throws a
PHP Fatal error: Call to a member function addFailure() on a non-object
error.Perhaps I don't understand the intent of the function... I understood it to check for the existence of an element and then validate its text. If the object doesn't exist it should fail the assertion, but not stop the test, much less throw a fatal exception.
Am I misunderstanding this behavior, or is this a bug?
Here's a code snippet from my test:
The text was updated successfully, but these errors were encountered: