Codeception / Codeception/AspectMock

Incorrect cache files

Aperta
#184 2 commenti 0 reazioni 0 assegnatari Vedi su GitHub
Lingua principale
PHP
Stelle
784
Fork
132
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

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();
}
}
```

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.