Codeception / Codeception/AspectMock

Function parameters initialized with a class constant throw an exception

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

Descrizione

Hello,

In the following code :
```php
init([
'debug' => true,
'includePaths' => [
__DIR__ . '/../src',
'excludePaths' => [
__DIR__ . '/../tests'
]
]
]);
?>

"save is mocking"]);
}

protected function tearDown()
{
test::clean(); // remove all registered test doubles
}
}
```

when we launch the test we get the following exception :

```
PHPUnit 5.7.3 by Sebastian Bergmann and contributors.

Starting test 'AspectMockTest::testDouble'.
E 1 / 1 (100%)

Time: 1.6 seconds, Memory: 24.75MB

There was 1 error:

1) AspectMockTest::testDouble
InvalidArgumentException: Class PDO was not found by locator

/testgo/vendor/goaop/parser-reflection/src/ReflectionEngine.php:112
/testgo/vendor/goaop/parser-reflection/src/ReflectionEngine.php:127
/testgo/vendor/goaop/parser-reflection/src/ReflectionClass.php:45
/testgo/vendor/goaop/parser-reflection/src/ValueResolver/NodeExpressionResolver.php:301
/testgo/vendor/goaop/parser-reflection/src/ValueResolver/NodeExpressionResolver.php:259
/testgo/vendor/goaop/parser-reflection/src/ValueResolver/NodeExpressionResolver.php:118
/testgo/vendor/goaop/parser-reflection/src/ValueResolver/NodeExpressionResolver.php:99
/testgo/vendor/goaop/parser-reflection/src/ReflectionParameter.php:99
/testgo/vendor/goaop/parser-reflection/src/Traits/ReflectionFunctionLikeTrait.php:164
/testgo/vendor/codeception/aspect-mock/src/AspectMock/Intercept/BeforeMockTransformer.php:56
/testgo/vendor/goaop/framework/src/Instrument/Transformer/CachingTransformer.php:124
/testgo/vendor/goaop/framework/src/Instrument/Transformer/CachingTransformer.php:83
/testgo/vendor/goaop/framework/src/Instrument/ClassLoading/SourceTransformingLoader.php:134
/testgo/vendor/goaop/framework/src/Instrument/ClassLoading/SourceTransformingLoader.php:101
/testgo/vendor/goaop/framework/src/Instrument/ClassLoading/AopComposerLoader.php:136
/testgo/vendor/goaop/framework/src/Instrument/ClassLoading/AopComposerLoader.php:136
/testgo/vendor/codeception/aspect-mock/src/AspectMock/Test.php:97
/testgo/tests/AspectMockOrmTest.php:53

ERRORS!
Tests: 1, Assertions: 0, Errors: 1.
```

Do you have any solution or fix to help us please ?

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Direzione di ricerca

Inizia eseguendo tests/AspectMockTest.php con il bootstrap e l’esempio UserModel.php dell’issue. Traccia il fallimento attraverso BeforeMockTransformer.php e lo stack parser-reflection di goaop, in particolare NodeExpressionResolver e ReflectionEngine. Il lavoro è completato quando l’esempio testDouble viene eseguito senza l’eccezione del locator PDO, preservando il parametro predefinito con costante di classe.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
php
Ambito
testing-qa
Tipo di issue
Bug
Difficoltà
4/5
Tempo stimato
3-5 giorni
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
30/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.