From 2059d3a20274961aaf9b6dfd44b041e35029df68 Mon Sep 17 00:00:00 2001 From: halnique Date: Fri, 7 Jun 2019 16:57:37 +0900 Subject: [PATCH 1/3] check access token existence --- src/WebAPI/Endpoints/WithAuthenticate.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/WebAPI/Endpoints/WithAuthenticate.php b/src/WebAPI/Endpoints/WithAuthenticate.php index 677ac6b..ede4948 100644 --- a/src/WebAPI/Endpoints/WithAuthenticate.php +++ b/src/WebAPI/Endpoints/WithAuthenticate.php @@ -9,10 +9,10 @@ public function token(): string { $token = getenv('SLACK_API_ACCESS_TOKEN'); - if (!$token) { + if ($token === null) { throw new \RuntimeException('Require Slack Api Access Token to set env: SLACK_API_ACCESS_TOKEN'); } return $token; } -} \ No newline at end of file +} From 45bcdaf3e565999e72055eadf01e1d33dc97affb Mon Sep 17 00:00:00 2001 From: halnique Date: Fri, 7 Jun 2019 17:35:31 +0900 Subject: [PATCH 2/3] fix test --- tests/WebAPI/Endpoints/WithAuthenticateTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/WebAPI/Endpoints/WithAuthenticateTest.php b/tests/WebAPI/Endpoints/WithAuthenticateTest.php index f774302..69601dd 100644 --- a/tests/WebAPI/Endpoints/WithAuthenticateTest.php +++ b/tests/WebAPI/Endpoints/WithAuthenticateTest.php @@ -22,7 +22,7 @@ public function testToken() */ public function testTokenException() { - putenv('SLACK_API_ACCESS_TOKEN='); + putenv('SLACK_API_ACCESS_TOKEN'); /** @var WithAuthenticate $withAuthenticate */ $withAuthenticate = $this->getMockForTrait(WithAuthenticate::class); $this->expectException(\RuntimeException::class); From fea3764749eb017526fb566ce610562327fce142 Mon Sep 17 00:00:00 2001 From: halnique Date: Fri, 7 Jun 2019 17:35:58 +0900 Subject: [PATCH 3/3] fix comparison --- src/WebAPI/Endpoints/WithAuthenticate.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/WebAPI/Endpoints/WithAuthenticate.php b/src/WebAPI/Endpoints/WithAuthenticate.php index ede4948..973e709 100644 --- a/src/WebAPI/Endpoints/WithAuthenticate.php +++ b/src/WebAPI/Endpoints/WithAuthenticate.php @@ -9,7 +9,7 @@ public function token(): string { $token = getenv('SLACK_API_ACCESS_TOKEN'); - if ($token === null) { + if ($token === false) { throw new \RuntimeException('Require Slack Api Access Token to set env: SLACK_API_ACCESS_TOKEN'); }