Fixed calling flush on null #4074

Merged
merged 1 commit into from Mar 25, 2017

Conversation

Projects
None yet
3 participants
@Jurigag
Contributor

Jurigag commented Mar 23, 2017

Sometimes when some exception happens during tests and before _before method is run in memcache module then in _after method flush is done on null causing other error.

src/Codeception/Module/Memcache.php
- case 'Memcached':
- $this->memcache->quit();
- break;
+ if(!empty($this->memcache)) {

This comment has been minimized.

@Nitpick-CI

Nitpick-CI Mar 23, 2017

Expected 1 space after IF keyword; 0 found

@Nitpick-CI

Nitpick-CI Mar 23, 2017

Expected 1 space after IF keyword; 0 found

@Jurigag

This comment has been minimized.

Show comment
Hide comment
@Jurigag

Jurigag Mar 23, 2017

Contributor

Failing test seems unrelated.

Contributor

Jurigag commented Mar 23, 2017

Failing test seems unrelated.

src/Codeception/Module/Memcache.php
- case 'Memcached':
- $this->memcache->quit();
- break;
+ if (!empty($this->memcache)) {

This comment has been minimized.

@DavertMik

DavertMik Mar 23, 2017

Member

better to change the code to

if (empty($this->memcache)) {
    return;
}
@DavertMik

DavertMik Mar 23, 2017

Member

better to change the code to

if (empty($this->memcache)) {
    return;
}

This comment has been minimized.

@Jurigag

Jurigag Mar 23, 2017

Contributor

Okay, will change it later.

@Jurigag

Jurigag Mar 23, 2017

Contributor

Okay, will change it later.

@DavertMik

This comment has been minimized.

Show comment
Hide comment
@DavertMik

DavertMik Mar 23, 2017

Member

Yes, unrelated. Just one minor changein the code and I'm merging

Member

DavertMik commented Mar 23, 2017

Yes, unrelated. Just one minor changein the code and I'm merging

@Jurigag

This comment has been minimized.

Show comment
Hide comment
@Jurigag

Jurigag Mar 23, 2017

Contributor

Well to be honest this is dirty hack anyway - for example there is this code - https://github.com/phalcon/cphalcon/blob/master/tests/unit/Cache/Backend/ApcCest.php#L36 when this exception is thrown exactly the problem which i described happens, i don't know codeception well enough to figure out why it's happening, this is just workaround for now if someone could fix it properly.

@sergeyklay

Contributor

Jurigag commented Mar 23, 2017

Well to be honest this is dirty hack anyway - for example there is this code - https://github.com/phalcon/cphalcon/blob/master/tests/unit/Cache/Backend/ApcCest.php#L36 when this exception is thrown exactly the problem which i described happens, i don't know codeception well enough to figure out why it's happening, this is just workaround for now if someone could fix it properly.

@sergeyklay

@DavertMik

This comment has been minimized.

Show comment
Hide comment
@DavertMik

DavertMik Mar 25, 2017

Member

Thanks

Member

DavertMik commented Mar 25, 2017

Thanks

@DavertMik DavertMik merged commit 3679c28 into Codeception:2.2 Mar 25, 2017

3 of 4 checks passed

semaphoreci The build failed on Semaphore.
Details
continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
wercker/build Wercker pipeline passed
Details

chris1312 added a commit to chris1312/Codeception that referenced this pull request Jun 16, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment