FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Simplify Test classes by TavoNiievez · Pull Request #6845 · Codeception/Codeception · GitHub

Simplify Test classes - #6845

Merged
TavoNiievez merged 1 commit into
Codeception:mainfrom
TavoNiievez:simplify_test
Apr 28, 2025
Merged

Simplify Test classes#6845
TavoNiievez merged 1 commit into
Codeception:mainfrom
TavoNiievez:simplify_test

Conversation

Copy link
Copy Markdown
Member

No description provided.

TavoNiievez force-pushed the simplify_test branch 30 times, most recently from 57fd083 to 77c5b6e Compare April 23, 2025 19:33
TavoNiievez force-pushed the simplify_test branch 3 times, most recently from 9cb446e to 739d91e Compare April 23, 2025 23:03
TavoNiievez marked this pull request as ready for review April 23, 2025 23:30

Copy link
Copy Markdown
Member Author

@W0rma Thank you!

TavoNiievez merged commit 209bc3c into Codeception:main Apr 28, 2025
Comment on lines +84 to +86
if (property_exists($this, $property)) {
$this->{$property} = $di->instantiate($actor);
}

W0rma May 12, 2025
edited
Loading

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

@TavoNiievez This check breaks some tests in one of my own projects if I try to access $this->tester. Error message: Undefined property: xxxTest::$tester

The test works fine if I remove the if clause and just call $this->{$property} = $di->instantiate($actor);

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

@W0rma Sounds like you're right. Could you open a PR with something like this:

$di = $this->getMetadata()->getService('di');

if (($actor = $this->getMetadata()->getCurrent('actor')) &&
    ($property = lcfirst((string) Configuration::config()['actor_suffix']))) {

    $this->{$property} = $di->instantiate($actor);
}

?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

@TavoNiievez See #6856

The change fixes the tests of my own project.

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants


Back | FazBrowse Home | New Git URL