10000 Fix auto-injection of the tester property (#6856) · Codeception/Codeception@77892d8 · GitHub
[go: up one dir, main page]

Skip to content

Commit 77892d8

Browse files
authored
Fix auto-injection of the tester property (#6856)
1 parent d702f93 commit 77892d8

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

src/Codeception/Test/Unit.php

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -78,12 +78,11 @@ protected function _setUp()
7878
$di = $metadata->getService('di');
7979

8080
// Auto-inject $tester property
81-
if ($actor = $metadata->getCurrent('actor')) {
82-
$suffix = (string) Configuration::config()['actor_suffix'];
83-
$property = lcfirst($suffix);
84-
if (property_exists($this, $property)) {
85-
$this->{$property} = $di->instantiate($actor);
86-
}
81+
if (
82+
($actor = $this->getMetadata()->getCurrent('actor')) &&
83+
($property = lcfirst((string) Configuration::config()['actor_suffix']))
84+
) {
85+
$this->{$property} = $di->instantiate($actor);
8786
}
8887

8988
$this->scenario = $di->get(Scenario::class);

0 commit comments

Comments
 (0)
0