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

Incorrect cache files #184

Open
wppunk opened this issue Aug 8, 2020 · 2 comments
Open

Incorrect cache files #184

wppunk opened this issue Aug 8, 2020 · 2 comments

Comments

@wppunk
Copy link

wppunk commented Aug 8, 2020

Invalid cache files creating when I run tests. In directory file looks like:

class Settings { if (($__am_res = __amock_before($this, __CLASS__, __FUNCTION__, array(), false)) !== __AM_CONTINUE__) return $__am_res;
...

After the test run I get the error message:

[ParseError] syntax error, unexpected 'if' (T_IF), expecting function (T_FUNCTION) or const (T_CONST)

Environment

  • Codeception 4.1
  • PHP7.2
  • Aspect Mock 3.1

bootstrap.php

use AspectMock\Kernel;

define( 'PLUGIN_NAME_PATH', realpath( __DIR__ . '/../../../' ) . '/' );

$kernel = Kernel::getInstance();
$kernel->init(
	[
		'cacheDir'     => PLUGIN_NAME_PATH . '.codeception/_cache/',
		'debug'        => true,
		'includePaths' => [ PLUGIN_NAME_PATH . 'src/' ],
	]
);

TestCase.php

use AspectMock\Test;
use Codeception\Test\Unit;
use AspectMock\Core\Registry;

abstract class TestCase extends Unit {
	protected function _after(): void {
		if ( Registry::$mocker ) {
			Test::clean();
		}
		parent::_after();
	}
}
@dudapiotr
Copy link

Downgrade to older version of goaop/framework helped me : "goaop/framework": "2.3.2".
There must be some bug.

@wppunk
Copy link
Author

wppunk commented Aug 11, 2020

Downgrade to "goaop/framework": "2.1" helped me

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

No branches or pull requests

2 participants