Codeception / Codeception/AspectMock

Non-existent functions can't be mocked since 2.1.0

Offen
#158 0 Kommentare 1 Reaktion 0 zugewiesene Personen Auf GitHub ansehen
Vorherrschende Sprache
PHP
Sterne
784
Forks
132
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

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

Beitragsleitfaden

Für dieses Repository ist kein Beitragsleitfaden indexiert

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.