Skip to content

Create Checks class#57

Merged
jjgrainger merged 10 commits into
trunkfrom
feature/create-checks-class
Jan 27, 2023
Merged

Create Checks class#57
jjgrainger merged 10 commits into
trunkfrom
feature/create-checks-class

Conversation

@jjgrainger
Copy link
Copy Markdown
Contributor

@jjgrainger jjgrainger commented Jan 12, 2023

Adds the Checks class

  • Addresses the acceptance criteria in Create Checks class #12
  • TODO: Check's will need to be added to the get_checks() method once implemented. Check AC's will be updated to include this step.

Closes #12

@jjgrainger jjgrainger added [Type] Enhancement A suggestion for improvement of an existing feature Infrastructure Issues for the overall plugin infrastructure Milestone 1 labels Jan 12, 2023
@jjgrainger jjgrainger marked this pull request as ready for review January 13, 2023 10:50
Copy link
Copy Markdown
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 There are still a few things to address here, left some feedback.

Comment thread includes/Checker/Checks.php Outdated
Comment thread includes/Checker/Checks.php Outdated
Comment thread includes/Checker/Checks.php Outdated
Comment thread tests/Checker/Checks_Tests.php Outdated
Comment thread tests/Checker/Checks_Tests.php Outdated
Comment on lines +45 to +55
public function test_run_all_checks_throws_exception_if_not_prepared() {
$this->expectException( Exception::class );

$this->checks->run_all_checks();
}

public function test_run_single_check_throws_exception_if_not_prepared() {
$this->expectException( Exception::class );

$this->checks->run_single_check( 'check' );
}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Can you also add tests for these two methods when the environment is prepared? Right now we only test the error case, but it's arguably even more important to test the success case.

If you had those tests, it would also have shown the PHP error in the Checks class above.

@felixarntz felixarntz mentioned this pull request Jan 13, 2023
@jjgrainger jjgrainger requested a review from felixarntz January 19, 2023 20:11
Copy link
Copy Markdown
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 A few small things, almost good to go.

Comment thread composer.json Outdated
Comment thread includes/Checker/Checks.php
Comment thread includes/Checker/Checks.php Outdated
Comment thread tests/Checker/Checks_Tests.php Outdated
@jjgrainger jjgrainger requested a review from felixarntz January 24, 2023 17:43
* @throws Exception Thrown when check fails with critical error.
*/
public function run_checks( array $checks ) {
$result = new Check_Result( $this->check_context );
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@jjgrainger Do we needs to add use WordPress\Plugin_Check\Checker\Check_Result;?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@mukeshpanchal27 it's not necessarily a requirement as it shares the same namespace, but I see no harm in explicitly defining this.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Not really needed, I think we can avoid that in the future. But okay to keep for now.

Copy link
Copy Markdown
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.

Great work, thanks @jjgrainger!

Comment thread tests/Checker/Checks_Tests.php
@vishalkakadiya
Copy link
Copy Markdown

@jjgrainger Added comment to add function doc block, other than that LGTM!, Thanks!

@jjgrainger jjgrainger merged commit 330096e into trunk Jan 27, 2023
@jjgrainger jjgrainger deleted the feature/create-checks-class branch January 27, 2023 10:04
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.

Create Checks class

4 participants