Codeception / Codeception/AspectMock

Non-existent functions can't be mocked since 2.1.0

Aperta
#158 0 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

The problem was introduced here:
https://github.com/Codeception/AspectMock/pull/133/files#diff-50b2697c4aa86740dcae323b3d7ebe44R44

The `placeOptionalAndReferenceFunction` method uses `ReflectionFunction` which throws an exception if a non-existent function name is passed:

> [ReflectionException] Function somefunc() does not exist

Before that change it worked fine when trying to mock a non-existent function. This is a valid use case for a plugin architecture where you may not have desired functions in a test environment.

Can it be like this, for example:
```php
if (function_exists($function)) {
$this->placeOptionalAndReferenceFunction($namespace, $function);
}
```

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.