From e0dba8f3bd4e3c440d91bfb0e088e1d2e9d93e57 Mon Sep 17 00:00:00 2001 From: Akihito Koriyama Date: Mon, 5 Oct 2020 12:26:28 +0900 Subject: [PATCH 1/6] Mark @codeCoverageIgnore --- src/Extension/Transfer/NullTransfer.php | 1 + src/Inject/PsrLoggerInject.php | 3 ++- src/Inject/ResourceInject.php | 3 ++- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/Extension/Transfer/NullTransfer.php b/src/Extension/Transfer/NullTransfer.php index 3e89a7ea..a8ad7a4c 100644 --- a/src/Extension/Transfer/NullTransfer.php +++ b/src/Extension/Transfer/NullTransfer.php @@ -10,6 +10,7 @@ final class NullTransfer implements TransferInterface { /** * {@inheritdoc} + * @codeCoverageIgnore */ public function __invoke(ResourceObject $ro, array $server): void { diff --git a/src/Inject/PsrLoggerInject.php b/src/Inject/PsrLoggerInject.php index cd3885b8..619b8efa 100644 --- a/src/Inject/PsrLoggerInject.php +++ b/src/Inject/PsrLoggerInject.php @@ -13,8 +13,9 @@ trait PsrLoggerInject /** * @\Ray\Di\Di\Inject + * @codeCoverageIgnore */ - public function setPsrLogger(LoggerInterface $logger) + public function setPsrLogger(LoggerInterface $logger): void { $this->logger = $logger; } diff --git a/src/Inject/ResourceInject.php b/src/Inject/ResourceInject.php index 7a1b2eec..3149fa2b 100644 --- a/src/Inject/ResourceInject.php +++ b/src/Inject/ResourceInject.php @@ -13,8 +13,9 @@ trait ResourceInject /** * @\Ray\Di\Di\Inject + * @codeCoverageIgnore */ - public function setResource(ResourceInterface $resource) + public function setResource(ResourceInterface $resource): void { $this->resource = $resource; } From f8176ee561b4230afbb54659839e81b7f013b6f9 Mon Sep 17 00:00:00 2001 From: Akihito Koriyama Date: Mon, 5 Oct 2020 12:26:46 +0900 Subject: [PATCH 2/6] Improve code coverage --- tests/Provide/Error/NullErrorTest.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/Provide/Error/NullErrorTest.php b/tests/Provide/Error/NullErrorTest.php index f83847cf..1e0a0850 100644 --- a/tests/Provide/Error/NullErrorTest.php +++ b/tests/Provide/Error/NullErrorTest.php @@ -4,6 +4,7 @@ namespace BEAR\Sunday\Provide\Error; +use BEAR\Sunday\Extension\Error\ErrorInterface; use BEAR\Sunday\Extension\Error\NullError; use BEAR\Sunday\Extension\Router\RouterMatch; use Exception; @@ -11,11 +12,10 @@ class NullErrorTest extends TestCase { - /** - * @doesNotPerformAssertions - */ public function testNullError(): void { - (new NullError())->handle(new Exception(), new RouterMatch())->transfer(); - } + $error = (new NullError())->handle(new Exception(), new RouterMatch()); + $error->transfer(); + $this->assertInstanceOf(ErrorInterface::class, $error); + } } From 69df174f45d98959356a76573433b007a4edd4f7 Mon Sep 17 00:00:00 2001 From: Akihito Koriyama Date: Mon, 5 Oct 2020 12:27:25 +0900 Subject: [PATCH 3/6] Code coverage 100% --- codecov.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/codecov.yml b/codecov.yml index c8be0a06..7a6ecf3d 100644 --- a/codecov.yml +++ b/codecov.yml @@ -6,9 +6,9 @@ coverage: status: project: default: - target: 95% + target: 100% patch: default: - target: 95% + target: 100% comment: false From 6516344330fe2fe88d1cc53c3dab2108bea32943 Mon Sep 17 00:00:00 2001 From: Akihito Koriyama Date: Mon, 5 Oct 2020 12:41:05 +0900 Subject: [PATCH 4/6] Fix test --- tests/Provide/Error/ThrowableHandlerTest.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/Provide/Error/ThrowableHandlerTest.php b/tests/Provide/Error/ThrowableHandlerTest.php index 70a6ebc0..1e2ab8cd 100644 --- a/tests/Provide/Error/ThrowableHandlerTest.php +++ b/tests/Provide/Error/ThrowableHandlerTest.php @@ -12,6 +12,7 @@ use Exception; use PHPUnit\Framework\TestCase; +use Throwable; use function ini_set; // phpcs:disable SlevomatCodingStandard.Exceptions.ReferenceThrowableOnly.ReferencedGeneralException @@ -43,7 +44,7 @@ public function testError(): void { try { echo hello; // @phpstan-ignore-line - } catch (Exception $e) { + } catch (Throwable $e) { } $this->throableHandler->handle($e, new RouterMatch())->transfer(); // @phpstan-ignore-line From 2840c0efd7988c7cdf0100b477708ceedcad91fb Mon Sep 17 00:00:00 2001 From: Akihito Koriyama Date: Mon, 5 Oct 2020 12:41:33 +0900 Subject: [PATCH 5/6] Fix cs --- src/Extension/Transfer/NullTransfer.php | 1 + tests/Provide/Error/NullErrorTest.php | 2 +- tests/Provide/Error/ThrowableHandlerTest.php | 3 +-- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Extension/Transfer/NullTransfer.php b/src/Extension/Transfer/NullTransfer.php index a8ad7a4c..5c3743be 100644 --- a/src/Extension/Transfer/NullTransfer.php +++ b/src/Extension/Transfer/NullTransfer.php @@ -10,6 +10,7 @@ final class NullTransfer implements TransferInterface { /** * {@inheritdoc} + * * @codeCoverageIgnore */ public function __invoke(ResourceObject $ro, array $server): void diff --git a/tests/Provide/Error/NullErrorTest.php b/tests/Provide/Error/NullErrorTest.php index 1e0a0850..ab903914 100644 --- a/tests/Provide/Error/NullErrorTest.php +++ b/tests/Provide/Error/NullErrorTest.php @@ -17,5 +17,5 @@ public function testNullError(): void $error = (new NullError())->handle(new Exception(), new RouterMatch()); $error->transfer(); $this->assertInstanceOf(ErrorInterface::class, $error); - } + } } diff --git a/tests/Provide/Error/ThrowableHandlerTest.php b/tests/Provide/Error/ThrowableHandlerTest.php index 1e2ab8cd..18c763b4 100644 --- a/tests/Provide/Error/ThrowableHandlerTest.php +++ b/tests/Provide/Error/ThrowableHandlerTest.php @@ -9,10 +9,9 @@ use BEAR\Sunday\Provide\Transfer\ConditionalResponse; use BEAR\Sunday\Provide\Transfer\FakeHttpResponder; use BEAR\Sunday\Provide\Transfer\Header; -use Exception; use PHPUnit\Framework\TestCase; - use Throwable; + use function ini_set; // phpcs:disable SlevomatCodingStandard.Exceptions.ReferenceThrowableOnly.ReferencedGeneralException From fe72520b8afc01fe25143f2464eb9c7d610023ec Mon Sep 17 00:00:00 2001 From: Akihito Koriyama Date: Mon, 5 Oct 2020 12:44:26 +0900 Subject: [PATCH 6/6] Update badges --- README.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 73483ae1..483f7555 100644 --- a/README.md +++ b/README.md @@ -6,10 +6,11 @@ [![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/bearsunday/BEAR.Sunday/badges/quality-score.png?b=1.x)](https://scrutinizer-ci.com/g/bearsunday/BEAR.Sunday/?branch=1.x ) -[![Code Coverage](https://scrutinizer-ci.com/g/bearsunday/BEAR.Sunday/badges/coverage.png?b=1.x)](https://scrutinizer-ci.com/g/bearsunday/BEAR.Sunday/?branch=1.x -) +[![codecov](https://codecov.io/gh/bearsunday/BEAR.Sunday/branch/1.x/graph/badge.svg?token=eh3c9AF4Mr)](https://codecov.io/gh/koriym/BEAR.Sunday) +[![Type Coverage](https://shepherd.dev/github/bearsunday/BEAR.Sunday/coverage.svg)](https://shepherd.dev/github/bearsunday/BEAR.Sunday) [![Build Status](https://travis-ci.org/bearsunday/BEAR.Sunday.svg?branch=1.x )](https://travis-ci.org/bearsunday/BEAR.Sunday) +[![Build Status](https://scrutinizer-ci.com/g/bearsunday/BEAR.Sunday/badges/build.png?b=1.x)](https://scrutinizer-ci.com/g/bearsunday/BEAR.Sunday/build-status/1.x) ## What's BEAR.Sunday