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

Move manual app reset into null check #4991

Closed
wants to merge 1 commit into from
Closed

Move manual app reset into null check #4991

wants to merge 1 commit into from

Conversation

wkritzinger
Copy link
Contributor

The call to resetApplication() was added in #4928 but I think this should also happen in the null check.

Without this change, I run into this error:

Codeception PHP Testing Framework v2.4.2
Powered by PHPUnit 7.1.5 by Sebastian Bergmann and contributors.

Fatal error: Uncaught Error: Call to a member function resetApplication() on null in C:\project\vendor\codeception\codeception\src\Codeception\Module\Yii2.php:364
Stack trace:
#0 C:\project\vendor\codeception\codeception\src\Codeception\Subscriber\Module.php(66): Codeception\Module\Yii2->_after(Object(Codeception\Test\Cest))
#1 C:\project\vendor\symfony\event-dispatcher\EventDispatcher.php(212): Codeception\Subscriber\Module->after(Object(Codeception\Event\TestEvent), 'test.after', Object(Symfony\Component\EventDispatcher\EventDispatcher))
#2 C:\project\vendor\symfony\event-dispatcher\EventDispatcher.php(44): Symfony\Component\EventDispatcher\EventDispatcher->doDispatch(Array, 'test.after', Object(Codeception\Event\TestEvent))
#3 C:\project\vendor\codeception\phpunit-wrapper\src\Listener.php(133): Symfony\Component\EventDispatcher\EventDispatcher->dispatch('test.after', Object(Codeception\Event\TestEvent))
#4 C:\project\vendor\ in C:\project\vendor\codeception\codeception\src\Codeception\Module\Yii2.php on line 364

@SamMousa
Copy link
Collaborator

Hmm, I made a mistake with operator precedence 😔

It can be fixed using brackets; no need to use nested if statements!

http://php.net/manual/en/language.operators.precedence.php

@wkritzinger
Copy link
Contributor Author

Not sure if I understand correctly, do you mean moving the call to resetApplication() into the if?
If not, could you give an example of what you meant? Maybe my PHP is a bit rusty 😄

@SamMousa
Copy link
Collaborator

Consider this:

true && false; // Evaluates to false
false === true && false; // Evaluates to false
false === (true && false); // Evaluates to true

@wkritzinger
Copy link
Contributor Author

Sorry, I still don't understand 😕 Don't we want to reset the application regardless of whether the application has a session or not?

@SamMousa
Copy link
Collaborator

AH, now i understand. But application reset is implemented in the client, so we need a client.
I'll look into this a bit more!

@Naktibalda Naktibalda closed this Dec 13, 2019
@Naktibalda
Copy link
Member

Yii2 module changes a lot, if this change is still relevant, please make a new pull request to https://github.com/Codeception/module-yii2/

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

3 participants