From b6dbfe07efc1d32aade6b4940351eb46a46b95ef Mon Sep 17 00:00:00 2001 From: Alex Date: Thu, 26 Jun 2025 13:32:35 +0300 Subject: [PATCH 1/2] Improve docs to avoid Risky test warnings --- README.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/README.md b/README.md index 2bbd89674..5820c371d 100644 --- a/README.md +++ b/README.md @@ -67,6 +67,14 @@ assertThat($result === true); assertThat(true, is(true)); ``` +:warning: To prevent tests from being marked as Risky (the `This test did not perform any assertions` message) +add this code to your test case `tearDown` method: + +```php +$this->addToAssertionCount(\Hamcrest\MatcherAssert::getCount()); +\Hamcrest\MatcherAssert::resetCount(); +``` + :warning: **NOTE:** the global proxy-functions aren't autoloaded by default, so you will need to load them first: ```php From 4a02785f4cd2a9b1452ba86e63f31874e6d56a0c Mon Sep 17 00:00:00 2001 From: Alex Date: Thu, 26 Jun 2025 16:47:51 +0300 Subject: [PATCH 2/2] Improve formatting --- README.md | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index 5820c371d..a55c338a4 100644 --- a/README.md +++ b/README.md @@ -67,19 +67,21 @@ assertThat($result === true); assertThat(true, is(true)); ``` -:warning: To prevent tests from being marked as Risky (the `This test did not perform any assertions` message) -add this code to your test case `tearDown` method: - -```php -$this->addToAssertionCount(\Hamcrest\MatcherAssert::getCount()); -\Hamcrest\MatcherAssert::resetCount(); -``` - -:warning: **NOTE:** the global proxy-functions aren't autoloaded by default, so you will need to load them first: - -```php -\Hamcrest\Util::registerGlobalFunctions(); -``` +> [!NOTE] +> To prevent tests from being marked as Risky (the `This test did not perform any assertions` message) +> add this code to your test case `tearDown` method: +> +> ```php +> $this->addToAssertionCount(\Hamcrest\MatcherAssert::getCount()); +> \Hamcrest\MatcherAssert::resetCount(); +> ``` + +> [!WARNING] +> the global proxy-functions aren't autoloaded by default, so you will need to load them first: +> +> ```php +> \Hamcrest\Util::registerGlobalFunctions(); +> ``` For brevity, all of the examples below use the proxy-functions.