Skip to content

Conversation

@jjgrainger
Copy link
Contributor

@jjgrainger jjgrainger commented Dec 13, 2022

Add initial test infrastructure and workflows.

Closes #2

@jjgrainger jjgrainger added [Type] Enhancement A suggestion for improvement of an existing feature Infrastructure Issues for the overall plugin infrastructure Milestone 1 labels Dec 13, 2022
@jjgrainger jjgrainger marked this pull request as ready for review December 19, 2022 09:08
Copy link
Member

@mukeshpanchal27 mukeshpanchal27 left a comment

Choose a reason for hiding this comment

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

Thanks @jjgrainger Great start. The PR feedbacks address below mention issue.

In Performance Lab, It was introduce on WordPress/performance@5a8a5c2 commit.

Copy link
Member

@felixarntz felixarntz left a comment

Choose a reason for hiding this comment

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

@jjgrainger Left a few minor comments, mostly nit-picks. It would be good to add a multisite test setup though.

.wp-env.json Outdated
"phpVersion": "7.4"
}
}
}
Copy link
Member

Choose a reason for hiding this comment

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

package.json Outdated
"wp-env": "wp-env",
"lint-php": "wp-env run composer run-script lint",
"pretest-php": "wp-env run composer 'install --no-interaction'",
"test-php": "wp-env run phpunit 'phpunit -c /var/www/html/wp-content/plugins/plugin-check/phpunit.xml.dist --verbose'"
Copy link
Member

Choose a reason for hiding this comment

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

Should we add a multisite configuration as well (see e.g. https://github.com/WordPress/performance/blob/trunk/package.json#L30)? I would think this is just as relevant here.

*
* @test
*/
public function it_should_assert_true() {
Copy link
Member

Choose a reason for hiding this comment

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

Nit-pick to keep in mind for the future:

  • WordPress core uses the test_* method prefix as a convention.
  • At some point in Performance Lab we started doing this it_should_* convention, and in that plugin it is for now mixed between the two conventions. However I would advise we stick with the core approach.
  • Sticking with that convention also means we can avoid the @test annotation which is redudant. Usually test methods don't need a doc-block, unless they use a @dataProvider or benefit from any extra explanation. Descriptive method names plus inline comments within the test method are usually sufficient to explain what's going on.

This isn't a big issue here since this is obviously just a dummy method, but wanted to point out for future reference. Since there are a few minor other changes to make, maybe let's also rename this to e.g. test_true() and remove the doc block?

Copy link
Member

Choose a reason for hiding this comment

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

Agreed. I have raise the issue in PL GH about it WordPress/performance#514

Copy link
Member

@mukeshpanchal27 mukeshpanchal27 left a comment

Choose a reason for hiding this comment

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

Thanks @jjgrainger Left one nit-pick feedback and question.

Copy link
Member

@mukeshpanchal27 mukeshpanchal27 left a comment

Choose a reason for hiding this comment

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

Great work @jjgrainger, LGTM.

Copy link
Member

@felixarntz felixarntz left a comment

Choose a reason for hiding this comment

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

@jjgrainger Thanks, looks great!

@felixarntz felixarntz merged commit a79116b into trunk Dec 20, 2022
@felixarntz felixarntz deleted the feature/test-infrastructure branch December 20, 2022 16:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Infrastructure Issues for the overall plugin infrastructure [Type] Enhancement A suggestion for improvement of an existing feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Test Infrastructure with PHPUnit

4 participants