diff --git a/.gitattributes b/.gitattributes index 0af6e4d..8d81342 100644 --- a/.gitattributes +++ b/.gitattributes @@ -8,6 +8,5 @@ .gitattributes export-ignore .gitignore export-ignore .scrutinizer.yml export-ignore -.travis.yml export-ignore phpunit.xml.dist export-ignore CONTRIBUTING.md export-ignore diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml new file mode 100644 index 0000000..10b997e --- /dev/null +++ b/.github/workflows/run-tests.yml @@ -0,0 +1,46 @@ +name: run-tests + +on: [push] + +jobs: + tests: + runs-on: ubuntu-latest + + strategy: + fail-fast: true + matrix: + php: [7.2, 7.3, 7.4] + laravel: [6.*] + dependency-version: [prefer-lowest, prefer-stable] + + name: PHP ${{ matrix.php }} - ${{ matrix.dependency-version }} + + steps: + - name: Checkout code + uses: actions/checkout@v1 + + - name: Cache dependencies + uses: actions/cache@v1 + with: + path: ~/.composer/cache/files + key: dependencies-laravel-${{ matrix.laravel }}-php-${{ matrix.php }}-composer-${{ hashFiles('composer.json') }} + + - name: Setup PHP + uses: shivammathur/setup-php@v1 + with: + php-version: ${{ matrix.php }} + extensions: curl, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, iconv + coverage: xdebug + + - name: Install dependencies + run: composer update --${{ matrix.dependency-version }} --prefer-dist --no-interaction --no-suggest + + - name: Execute tests + run: | + mkdir -p build/logs + vendor/bin/phpunit --coverage-text --coverage-clover=coverage.clover + + - name: Scrutinizer CI + run: | + wget https://scrutinizer-ci.com/ocular.phar + php ocular.phar code-coverage:upload --format=php-clover coverage.clover diff --git a/.scrutinizer.yml b/.scrutinizer.yml index d44a72f..8a9285f 100644 --- a/.scrutinizer.yml +++ b/.scrutinizer.yml @@ -22,7 +22,7 @@ checks: tools: external_code_coverage: timeout: 600 - runs: 2 + runs: 6 php_code_sniffer: enabled: true config: diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 0d5796f..0000000 --- a/.travis.yml +++ /dev/null @@ -1,25 +0,0 @@ -language: php - -sudo: false - -php: - - 7.2 - - 7.3 - - nightly - -matrix: - allow_failures: - - php: nightly - -before_script: - - travis_retry composer self-update - - travis_retry composer install --prefer-source --no-interaction - -script: - - composer validate - - mkdir -p build/logs - - ./vendor/bin/phpunit --coverage-text --coverage-clover=coverage.clover - -after_script: - - if [ "$TRAVIS_PHP_VERSION" != "nightly" ]; then wget https://scrutinizer-ci.com/ocular.phar; fi - - if [ "$TRAVIS_PHP_VERSION" != "nightly" ]; then php ocular.phar code-coverage:upload --format=php-clover coverage.clover; fi diff --git a/README.md b/README.md index 815bc87..8d95439 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # noCAPTCHA (new reCAPTCHA) [![Packagist License][badge_license]](LICENSE.md) [![For PHP][badge_php]][link-github-repo] -[![Travis Status][badge_build]][link-travis] +[![Github Workflow Status][badge_build]][link-github-status] [![Coverage Status][badge_coverage]][link-scrutinizer] [![Scrutinizer Code Quality][badge_quality]][link-scrutinizer] [![SensioLabs Insight][badge_insight]][link-insight] @@ -55,7 +55,7 @@ If you discover any security related issues, please email arcanedev.maroc@gmail. [badge_php]: https://img.shields.io/badge/PHP-Framework%20agnostic-4F5B93.svg?style=flat-square [badge_license]: https://img.shields.io/packagist/l/arcanedev/no-captcha.svg?style=flat-square -[badge_build]: https://img.shields.io/travis/ARCANEDEV/noCAPTCHA.svg?style=flat-square +[badge_build]: https://img.shields.io/github/workflow/status/ARCANEDEV/noCAPTCHA/run-tests?style=flat-square [badge_coverage]: https://img.shields.io/scrutinizer/coverage/g/ARCANEDEV/noCAPTCHA.svg?style=flat-square [badge_quality]: https://img.shields.io/scrutinizer/g/ARCANEDEV/noCAPTCHA.svg?style=flat-square [badge_insight]: https://img.shields.io/sensiolabs/i/ae37b4c0-5478-4afb-9a71-1fe5534d8ef5.svg?style=flat-square @@ -65,10 +65,10 @@ If you discover any security related issues, please email arcanedev.maroc@gmail. [badge_downloads]: https://img.shields.io/packagist/dt/arcanedev/no-captcha.svg?style=flat-square [link-author]: https://github.com/arcanedev-maroc +[link-github-status]: https://github.com/ARCANEDEV/noCAPTCHA/actions [link-github-repo]: https://github.com/ARCANEDEV/noCAPTCHA [link-github-issues]: https://github.com/ARCANEDEV/noCAPTCHA/issues [link-contributors]: https://github.com/ARCANEDEV/noCAPTCHA/graphs/contributors [link-packagist]: https://packagist.org/packages/arcanedev/no-captcha -[link-travis]: https://travis-ci.org/ARCANEDEV/noCAPTCHA [link-scrutinizer]: https://scrutinizer-ci.com/g/ARCANEDEV/noCAPTCHA/?branch=master [link-insight]: https://insight.sensiolabs.com/projects/ae37b4c0-5478-4afb-9a71-1fe5534d8ef5 diff --git a/composer.json b/composer.json index 51704e3..0779173 100644 --- a/composer.json +++ b/composer.json @@ -18,11 +18,11 @@ "ext-curl": "*", "ext-json": "*", "arcanedev/php-html": "^3.0", - "arcanedev/support": "^5.0", + "arcanedev/support": "^5.1", "psr/http-message": "^1.0" }, "require-dev": { - "orchestra/testbench": "^4.0", + "orchestra/testbench": "^4.5", "phpunit/phpunit": "^8.0", "phpunit/phpcov": "^6.0" }, diff --git a/src/AbstractNoCaptcha.php b/src/AbstractNoCaptcha.php index 718eca8..82760a3 100644 --- a/src/AbstractNoCaptcha.php +++ b/src/AbstractNoCaptcha.php @@ -1,4 +1,8 @@ -container['config']->get("no-captcha.{$key}"); + return $this->config->get("no-captcha.{$key}"); } } diff --git a/src/NoCaptchaServiceProvider.php b/src/NoCaptchaServiceProvider.php index 310a0f5..50a355d 100644 --- a/src/NoCaptchaServiceProvider.php +++ b/src/NoCaptchaServiceProvider.php @@ -1,4 +1,8 @@ -siteKey}'); }"; @@ -242,7 +245,7 @@ private function renderCaptchas(array $captchas) * * @return bool */ - private function hasCallbackName($callbackName) + private function hasCallbackName($callbackName): bool { return ! (is_null($callbackName) || trim($callbackName) === ''); } @@ -271,7 +274,7 @@ protected function parseResponse($json) * * @return array */ - private function prepareAttributes(array $attributes) + private function prepareAttributes(array $attributes): array { $attributes = array_merge( ['class' => 'g-recaptcha', 'data-sitekey' => $this->siteKey], @@ -294,7 +297,7 @@ private function prepareAttributes(array $attributes) * @param array $supported * @param string $default */ - private static function checkDataAttribute(array &$attributes, $name, array $supported, $default) + private static function checkDataAttribute(array &$attributes, $name, array $supported, $default): void { $attribute = $attributes[$name] ?? null; diff --git a/src/NoCaptchaV3.php b/src/NoCaptchaV3.php index 1d962be..515c4b2 100644 --- a/src/NoCaptchaV3.php +++ b/src/NoCaptchaV3.php @@ -1,4 +1,8 @@ - $this->url, CURLOPT_RETURNTRANSFER => true, @@ -99,7 +103,7 @@ public function send($url, $curled = true) * * @throws \Arcanedev\NoCaptcha\Exceptions\InvalidUrlException */ - private function checkUrl(&$url) + private function checkUrl(&$url): void { if ( ! is_string($url)) throw new InvalidUrlException( @@ -120,7 +124,7 @@ private function checkUrl(&$url) * * @return bool */ - private function isCurlExists() + private function isCurlExists(): bool { return function_exists('curl_version'); } @@ -132,7 +136,7 @@ private function isCurlExists() * * @return bool */ - private function checkResult($result) + private function checkResult($result): bool { return is_string($result) && ! empty($result); } diff --git a/src/Utilities/ResponseV2.php b/src/Utilities/ResponseV2.php index 2c6442f..356745c 100644 --- a/src/Utilities/ResponseV2.php +++ b/src/Utilities/ResponseV2.php @@ -1,4 +1,8 @@ -expectException(\InvalidArgumentException::class); $this->expectExceptionMessage('Driver [v1] not supported.'); diff --git a/tests/Laravel/ValidatorRuleTest.php b/tests/Laravel/ValidatorRuleTest.php index 885e659..9ae78e4 100644 --- a/tests/Laravel/ValidatorRuleTest.php +++ b/tests/Laravel/ValidatorRuleTest.php @@ -1,10 +1,13 @@ -mockRequest([ 'success' => true @@ -65,7 +68,7 @@ public function it_can_passes_captcha_rule() } /** @test */ - public function it_can_fails_captcha_rule() + public function it_can_fails_captcha_rule(): void { $this->mockRequest([ 'success' => false, @@ -91,7 +94,7 @@ public function it_can_fails_captcha_rule() } /** @test */ - public function it_can_skip_ips() + public function it_can_skip_ips(): void { $this->mockRequest([ 'success' => false, @@ -108,7 +111,7 @@ public function it_can_skip_ips() } /** @test */ - public function it_can_skip_ips_via_config_file() + public function it_can_skip_ips_via_config_file(): void { $this->app['config']->set('no-captcha.skip-ips', ['127.0.0.1']); @@ -131,7 +134,7 @@ public function it_can_skip_ips_via_config_file() | ----------------------------------------------------------------- */ - private function mockRequest(array $response) + private function mockRequest(array $response): void { $request = tap($this->prophesize(Request::class), function ($request) use ($response) { $request->send(Argument::type('string'))->willReturn( diff --git a/tests/LaravelTestCase.php b/tests/LaravelTestCase.php index 2233d4e..6705570 100644 --- a/tests/LaravelTestCase.php +++ b/tests/LaravelTestCase.php @@ -1,4 +1,8 @@ -noCaptcha = $this->createCaptcha(); - } - - public function tearDown(): void - { - unset($this->noCaptcha); - - parent::tearDown(); - } - /* ----------------------------------------------------------------- | Tests | ----------------------------------------------------------------- */ /** @test */ - public function it_can_get_client_url() + public function it_can_get_client_url(): void { static::assertSame( 'https://www.google.com/recaptcha/api.js', @@ -69,7 +46,7 @@ public function it_can_get_client_url() } /** @test */ - public function it_can_get_verification_url() + public function it_can_get_verification_url(): void { static::assertSame( 'https://www.google.com/recaptcha/api/siteverify', @@ -92,20 +69,22 @@ public function it_can_get_verification_url() } /** @test */ - public function it_can_be_instantiated() + public function it_can_be_instantiated(): void { - static::assertInstanceOf(NoCaptchaV2::class, $this->noCaptcha); + $noCaptcha = $this->createCaptcha(); + + static::assertInstanceOf(NoCaptchaV2::class, $noCaptcha); static::assertSame( '', - $this->noCaptcha->script()->toHtml() + $noCaptcha->script()->toHtml() ); } /** @test */ - public function it_can_be_instantiated_with_nullable_attributes() + public function it_can_be_instantiated_with_nullable_attributes(): void { - $this->noCaptcha = $this->createCaptcha(null); + $noCaptcha = $this->createCaptcha(null); $attributes = [ 'data-theme' => null, 'data-type' => null, @@ -114,7 +93,7 @@ public function it_can_be_instantiated_with_nullable_attributes() static::assertSame( '
', - $this->noCaptcha->display('captcha', $attributes)->toHtml() + $noCaptcha->display('captcha', $attributes)->toHtml() ); } @@ -126,17 +105,14 @@ public function it_can_be_instantiated_with_nullable_attributes() * @param array $attributes * @param string $expected */ - public function it_can_display_with_custom_attributes(array $attributes, $expected) + public function it_can_display_with_custom_attributes(array $attributes, $expected): void { static::assertSame( $expected, $this->createCaptcha()->display('captcha', $attributes)->toHtml() ); } - /** - * @return array - */ - public function provideNoCaptchaAttributes() + public function provideNoCaptchaAttributes(): array { return [ [ @@ -179,7 +155,7 @@ public function provideNoCaptchaAttributes() } /** @test */ - public function it_must_throw_invalid_type_exception_on_secret_key() + public function it_must_throw_invalid_type_exception_on_secret_key(): void { $this->expectException(\Arcanedev\NoCaptcha\Exceptions\ApiException::class); $this->expectExceptionMessage('The secret key must be a string value, NULL given'); @@ -188,7 +164,7 @@ public function it_must_throw_invalid_type_exception_on_secret_key() } /** @test */ - public function it_must_throw_api_exception_on_empty_secret_key() + public function it_must_throw_api_exception_on_empty_secret_key(): void { $this->expectException(\Arcanedev\NoCaptcha\Exceptions\ApiException::class); $this->expectExceptionMessage('The secret key must not be empty'); @@ -197,7 +173,7 @@ public function it_must_throw_api_exception_on_empty_secret_key() } /** @test */ - public function it_must_throw_invalid_type_exception_on_site_key() + public function it_must_throw_invalid_type_exception_on_site_key(): void { $this->expectException(\Arcanedev\NoCaptcha\Exceptions\ApiException::class); $this->expectExceptionMessage('The site key must be a string value, NULL given'); @@ -206,7 +182,7 @@ public function it_must_throw_invalid_type_exception_on_site_key() } /** @test */ - public function it_must_throw_api_exception_on_empty_site_key() + public function it_must_throw_api_exception_on_empty_site_key(): void { $this->expectException(\Arcanedev\NoCaptcha\Exceptions\ApiException::class); $this->expectExceptionMessage('The site key must not be empty'); @@ -215,45 +191,48 @@ public function it_must_throw_api_exception_on_empty_site_key() } /** @test */ - public function it_can_switch_locale() + public function it_can_switch_locale(): void { - $locale = 'fr'; - $this->noCaptcha->setLang($locale); + $noCaptcha = $this->createCaptcha() + ->setLang($locale = 'fr'); - static::assertInstanceOf(NoCaptchaV2::class, $this->noCaptcha); + static::assertInstanceOf(NoCaptchaV2::class, $noCaptcha); static::assertSame( '', - $this->noCaptcha->script()->toHtml() + $noCaptcha->script()->toHtml() ); } /** @test */ - public function it_can_render_script_tag() + public function it_can_render_script_tag(): void { + $noCaptcha = $this->createCaptcha(); + $tag = ''; - static::assertSame($tag, $this->noCaptcha->script()->toHtml()); + static::assertSame($tag, $noCaptcha->script()->toHtml()); // Echo out only once - static::assertEmpty($this->noCaptcha->script()->toHtml()); + static::assertEmpty($noCaptcha->script()->toHtml()); } /** @test */ - public function it_can_render_script_tag_with_lang() + public function it_can_render_script_tag_with_lang(): void { - $lang = 'fr'; + $noCaptcha = $this->createCaptcha($lang = 'fr'); $tag = ''; - $this->noCaptcha = $this->createCaptcha($lang); - static::assertSame($tag, $this->noCaptcha->script()->toHtml()); + static::assertSame($tag, $noCaptcha->script()->toHtml()); // Not even twice - static::assertEmpty($this->noCaptcha->script()->toHtml()); + static::assertEmpty($noCaptcha->script()->toHtml()); } /** @test */ - public function it_can_render_script_with_callback() + public function it_can_render_script_with_callback(): void { + $noCaptcha = $this->createCaptcha(); + $captchas = ['captcha-1', 'captcha-2']; $script = '', - $this->noCaptcha->script()->toHtml() + $noCaptcha->script()->toHtml() ); } /** @test */ - public function it_can_be_instantiated_with_defaults() + public function it_can_be_instantiated_with_defaults(): void { + $noCaptcha = $this->createCaptcha(); + static::assertSame( '', - $this->noCaptcha->input()->toHtml() + $noCaptcha->input()->toHtml() ); } /** @test */ - public function it_must_throw_invalid_type_exception_on_secret_key() + public function it_must_throw_invalid_type_exception_on_secret_key(): void { $this->expectException(\Arcanedev\NoCaptcha\Exceptions\ApiException::class); $this->expectExceptionMessage('The secret key must be a string value, NULL given'); @@ -120,7 +101,7 @@ public function it_must_throw_invalid_type_exception_on_secret_key() } /** @test */ - public function it_must_throw_api_exception_on_empty_secret_key() + public function it_must_throw_api_exception_on_empty_secret_key(): void { $this->expectException(\Arcanedev\NoCaptcha\Exceptions\ApiException::class); $this->expectExceptionMessage('The secret key must not be empty'); @@ -129,7 +110,7 @@ public function it_must_throw_api_exception_on_empty_secret_key() } /** @test */ - public function it_must_throw_invalid_type_exception_on_site_key() + public function it_must_throw_invalid_type_exception_on_site_key(): void { $this->expectException(\Arcanedev\NoCaptcha\Exceptions\ApiException::class); $this->expectExceptionMessage('The site key must be a string value, NULL given'); @@ -138,7 +119,7 @@ public function it_must_throw_invalid_type_exception_on_site_key() } /** @test */ - public function it_must_throw_api_exception_on_empty_site_key() + public function it_must_throw_api_exception_on_empty_site_key(): void { $this->expectException(\Arcanedev\NoCaptcha\Exceptions\ApiException::class); $this->expectExceptionMessage('The site key must not be empty'); @@ -147,58 +128,64 @@ public function it_must_throw_api_exception_on_empty_site_key() } /** @test */ - public function it_can_switch_locale() + public function it_can_switch_locale(): void { - $this->noCaptcha->setLang('fr'); + $noCaptcha = $this->createCaptcha()->setLang('fr'); - static::assertInstanceOf(NoCaptchaV3::class, $this->noCaptcha); + static::assertInstanceOf(NoCaptchaV3::class, $noCaptcha); static::assertSame( '', - $this->noCaptcha->script()->toHtml() + $noCaptcha->script()->toHtml() ); } /** @test */ - public function it_can_render_script_tag() + public function it_can_render_script_tag(): void { + $noCaptcha = $this->createCaptcha(); + static::assertSame( '', - $this->noCaptcha->script()->toHtml() + $noCaptcha->script()->toHtml() ); // Echo out only once - static::assertEmpty($this->noCaptcha->script()->toHtml()); + static::assertEmpty($noCaptcha->script()->toHtml()); } /** @test */ - public function it_can_render_script_tag_with_lang() + public function it_can_render_script_tag_with_lang(): void { - $this->noCaptcha->setLang('fr'); + $noCaptcha = $this->createCaptcha()->setLang('fr'); static::assertSame( '', - $this->noCaptcha->script()->toHtml() + $noCaptcha->script()->toHtml() ); // Not twice - static::assertEmpty($this->noCaptcha->script()->toHtml()); + static::assertEmpty($noCaptcha->script()->toHtml()); } /** @test */ - public function it_can_render_script_tag_with_onload_callback() + public function it_can_render_script_tag_with_onload_callback(): void { + $noCaptcha = $this->createCaptcha(); + static::assertSame( '', - $this->noCaptcha->script('no_captcha_onload')->toHtml() + $noCaptcha->script('no_captcha_onload')->toHtml() ); // Not twice - static::assertEmpty($this->noCaptcha->script()->toHtml()); + static::assertEmpty($noCaptcha->script()->toHtml()); } /** @test */ - public function it_can_render_api_script() + public function it_can_render_api_script(): void { + $noCaptcha = $this->createCaptcha(); + static::assertSame( "", - $this->noCaptcha->getApiScript()->toHtml() + $noCaptcha->getApiScript()->toHtml() ); } /** @test */ - public function it_can_verify() + public function it_can_verify(): void { - static::assertNull($this->noCaptcha->getLastResponse()); + $noCaptcha = $this->createCaptcha(); + + static::assertNull($noCaptcha->getLastResponse()); /** @var \Arcanedev\NoCaptcha\Utilities\Request $request */ $request = tap($this->prophesize(Request::class), function ($request) { $request->send(Argument::type('string'))->willReturn('{"success": true}'); })->reveal(); - $response = $this->noCaptcha + $response = $noCaptcha ->setRequestClient($request) ->verify('re-captcha-response'); @@ -230,12 +219,12 @@ public function it_can_verify() static::assertSame( $response, - $this->noCaptcha->getLastResponse() + $noCaptcha->getLastResponse() ); } /** @test */ - public function it_can_verify_psr7_request() + public function it_can_verify_psr7_request(): void { /** @var \Arcanedev\NoCaptcha\Utilities\Request $client */ $client = tap($this->prophesize(Request::class), function ($client) { @@ -254,7 +243,7 @@ public function it_can_verify_psr7_request() ]); })->reveal(); - $response = $this->noCaptcha + $response = $this->createCaptcha() ->setRequestClient($client) ->verifyRequest($request); @@ -262,9 +251,11 @@ public function it_can_verify_psr7_request() } /** @test */ - public function it_can_verify_with_fails() + public function it_can_verify_with_fails(): void { - $response = $this->noCaptcha->verify(''); + $noCaptcha = $this->createCaptcha(); + + $response = $noCaptcha->verify(''); static::assertFalse($response->isSuccess()); @@ -277,7 +268,7 @@ public function it_can_verify_with_fails() ); })->reveal(); - $response = $this->noCaptcha + $response = $noCaptcha ->setRequestClient($request) ->verify('re-captcha-response'); @@ -285,11 +276,13 @@ public function it_can_verify_with_fails() } /** @test */ - public function it_can_render_captcha_with_optional_name() + public function it_can_render_captcha_with_optional_name(): void { + $noCaptcha = $this->createCaptcha(); + static::assertSame( '', - $this->noCaptcha->input('g-recaptcha')->toHtml() + $noCaptcha->input('g-recaptcha')->toHtml() ); } diff --git a/tests/TestCase.php b/tests/TestCase.php index 6fed637..3805b36 100644 --- a/tests/TestCase.php +++ b/tests/TestCase.php @@ -1,4 +1,8 @@ -request); + $expectations = [ + \Arcanedev\NoCaptcha\Contracts\Utilities\Request::class, + \Arcanedev\NoCaptcha\Utilities\Request::class, + ]; + + foreach ($expectations as $expected) { + static::assertInstanceOf($expected, $this->request); + } } /** @test */ - public function it_must_throw_invalid_type_exception_on_url() + public function it_must_throw_invalid_type_exception_on_url(): void { $this->expectException(\Arcanedev\NoCaptcha\Exceptions\InvalidUrlException::class); $this->expectExceptionMessage('The url must be a string value, NULL given'); @@ -66,7 +77,7 @@ public function it_must_throw_invalid_type_exception_on_url() } /** @test */ - public function it_must_throw_api_exception_on_url() + public function it_must_throw_api_exception_on_url(): void { $this->expectException(\Arcanedev\NoCaptcha\Exceptions\InvalidUrlException::class); $this->expectExceptionMessage('The url must not be empty'); @@ -75,7 +86,7 @@ public function it_must_throw_api_exception_on_url() } /** @test */ - public function it_must_throw_invalid_url_exception_on_url() + public function it_must_throw_invalid_url_exception_on_url(): void { $this->expectException(\Arcanedev\NoCaptcha\Exceptions\InvalidUrlException::class); $this->expectExceptionMessage('The url [trust-me-im-a-valid-url] is invalid'); diff --git a/tests/Utilities/ResponseV2Test.php b/tests/Utilities/ResponseV2Test.php index a432ad2..0dcd930 100644 --- a/tests/Utilities/ResponseV2Test.php +++ b/tests/Utilities/ResponseV2Test.php @@ -1,4 +1,8 @@ - true]); @@ -47,7 +51,7 @@ public function it_can_convert_to_json() } /** @test */ - public function it_can_be_instantiated_from_array() + public function it_can_be_instantiated_from_array(): void { $response = ResponseV2::fromArray(['success' => true]); @@ -55,7 +59,7 @@ public function it_can_be_instantiated_from_array() } /** @test */ - public function it_can_get_response_data() + public function it_can_get_response_data(): void { $response = new ResponseV2( false, @@ -83,7 +87,7 @@ public function it_can_get_response_data() } /** @test */ - public function it_can_convert_to_array() + public function it_can_convert_to_array(): void { $response = new ResponseV2( false, @@ -104,7 +108,7 @@ public function it_can_convert_to_array() } /** @test */ - public function it_can_check_the_hostname() + public function it_can_check_the_hostname(): void { $response = ResponseV2::fromArray([ 'success' => true, diff --git a/tests/Utilities/ResponseV3Test.php b/tests/Utilities/ResponseV3Test.php index f35974b..6249cf3 100644 --- a/tests/Utilities/ResponseV3Test.php +++ b/tests/Utilities/ResponseV3Test.php @@ -1,4 +1,8 @@ - true]); @@ -56,7 +60,7 @@ public function it_can_convert_to_json() } /** @test */ - public function it_can_be_instantiated_from_array() + public function it_can_be_instantiated_from_array(): void { $response = ResponseV3::fromArray(['success' => true]); @@ -64,7 +68,7 @@ public function it_can_be_instantiated_from_array() } /** @test */ - public function it_can_get_response_data() + public function it_can_get_response_data(): void { $response = new ResponseV3( false, @@ -96,7 +100,7 @@ public function it_can_get_response_data() } /** @test */ - public function it_can_convert_to_array() + public function it_can_convert_to_array(): void { $response = new ResponseV3( false, @@ -121,7 +125,7 @@ public function it_can_convert_to_array() } /** @test */ - public function it_can_check_the_score() + public function it_can_check_the_score(): void { $response = ResponseV3::fromArray([ 'success' => true, @@ -146,7 +150,7 @@ public function it_can_check_the_score() } /** @test */ - public function it_can_check_the_hostname() + public function it_can_check_the_hostname(): void { $response = ResponseV3::fromArray([ 'success' => true, @@ -164,7 +168,7 @@ public function it_can_check_the_hostname() } /** @test */ - public function it_can_check_the_action_name() + public function it_can_check_the_action_name(): void { $response = ResponseV3::fromArray([ 'success' => true,