From 0eac099cdaba74ed93bf4ff2b5ead56b965221ba Mon Sep 17 00:00:00 2001 From: Kevin Dierkx Date: Thu, 10 Nov 2022 15:13:02 +0100 Subject: [PATCH] PHPCS --- LICENSE | 2 +- build/report.junit.xml | 33 +++++++++++++++++++ .../Exceptions/MissingConfigException.php | 4 ++- .../Exceptions/MissingEnvException.php | 4 ++- tests/src/Commands/AppUrlCommandTest.php | 8 ++--- tests/src/Commands/AppVersionCommandTest.php | 10 +++--- tests/src/Commands/KeySetCommandTest.php | 8 ++--- tests/src/TestCase.php | 10 +++--- 8 files changed, 58 insertions(+), 21 deletions(-) create mode 100644 build/report.junit.xml diff --git a/LICENSE b/LICENSE index e8cb1aa..83d7c5e 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright (c) 2020 Kevin Dierkx +Copyright (c) 2022 Kevin Dierkx Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/build/report.junit.xml b/build/report.junit.xml new file mode 100644 index 0000000..0309fb9 --- /dev/null +++ b/build/report.junit.xml @@ -0,0 +1,33 @@ + + + + + + + + + + + + + + + + + + + + + DistortedFusion\Env\Tests\Commands\KeySetCommandTest::testNothingHappensWhenKeyIsNotEmptyInProductionAndConfirmationIsNo +Output "Command Canceled!" was not printed. + +/home/vagrant/code/distortedfusion/laravel-env-management/vendor/laravel/framework/src/Illuminate/Testing/PendingCommand.php:347 +/home/vagrant/code/distortedfusion/laravel-env-management/vendor/laravel/framework/src/Illuminate/Testing/PendingCommand.php:317 +/home/vagrant/code/distortedfusion/laravel-env-management/vendor/laravel/framework/src/Illuminate/Testing/PendingCommand.php:481 +/home/vagrant/code/distortedfusion/laravel-env-management/tests/src/Commands/KeySetCommandTest.php:40 + + + + + + diff --git a/src/Commands/Exceptions/MissingConfigException.php b/src/Commands/Exceptions/MissingConfigException.php index 19eb1e8..fb2831f 100644 --- a/src/Commands/Exceptions/MissingConfigException.php +++ b/src/Commands/Exceptions/MissingConfigException.php @@ -2,6 +2,8 @@ namespace DistortedFusion\Env\Commands\Exceptions; -class MissingConfigException extends \RuntimeException +use RuntimeException; + +class MissingConfigException extends RuntimeException { } diff --git a/src/Commands/Exceptions/MissingEnvException.php b/src/Commands/Exceptions/MissingEnvException.php index d95ce04..6575406 100644 --- a/src/Commands/Exceptions/MissingEnvException.php +++ b/src/Commands/Exceptions/MissingEnvException.php @@ -2,6 +2,8 @@ namespace DistortedFusion\Env\Commands\Exceptions; -class MissingEnvException extends \RuntimeException +use RuntimeException; + +class MissingEnvException extends RuntimeException { } diff --git a/tests/src/Commands/AppUrlCommandTest.php b/tests/src/Commands/AppUrlCommandTest.php index 6e55daa..fc893ac 100644 --- a/tests/src/Commands/AppUrlCommandTest.php +++ b/tests/src/Commands/AppUrlCommandTest.php @@ -7,7 +7,7 @@ class AppUrlCommandTest extends TestCase { - public function test_getting_url_when_none_is_set_shows_error() + public function testGettingUrlWhenNoneIsSetShowsError() { $this->createTmpEnv(self::ENV_STUB); $this->app['config']->set('app.url', null); @@ -17,7 +17,7 @@ public function test_getting_url_when_none_is_set_shows_error() ->assertExitCode(1); } - public function test_getting_url_shows_current_url() + public function testGettingUrlShowsCurrentUrl() { $this->createTmpEnv(self::ENV_URL_STUB); $this->app['config']->set('app.url', 'http://localhost'); @@ -27,7 +27,7 @@ public function test_getting_url_shows_current_url() ->assertExitCode(0); } - public function test_setting_url_persists_url_in_env_and_sets_config() + public function testSettingUrlPersistsUrlInEnvAndSetsConfig() { $this->createTmpEnv(self::ENV_URL_STUB); $this->app['config']->set('app.url', 'http://localhost'); @@ -48,7 +48,7 @@ public function test_setting_url_persists_url_in_env_and_sets_config() ->assertExitCode(0); } - public function test_missing_env_variable_throws_exception() + public function testMissingEnvVariableThrowsException() { $this->createTmpEnv(self::ENV_EMPTY_STUB); diff --git a/tests/src/Commands/AppVersionCommandTest.php b/tests/src/Commands/AppVersionCommandTest.php index ede6ba9..ad030d1 100644 --- a/tests/src/Commands/AppVersionCommandTest.php +++ b/tests/src/Commands/AppVersionCommandTest.php @@ -7,7 +7,7 @@ class AppVersionCommandTest extends TestCase { - public function test_getting_version_when_none_is_set_shows_error() + public function testGettingVersionWhenNoneIsSetShowsError() { $this->createTmpEnv(self::ENV_STUB); $this->app['config']->set('app.version', null); @@ -17,7 +17,7 @@ public function test_getting_version_when_none_is_set_shows_error() ->assertExitCode(1); } - public function test_getting_version_shows_current_version() + public function testGettingVersionShowsCurrentVersion() { $this->createTmpEnv(self::ENV_VERSION_STUB); $this->app['config']->set('app.version', '0.0.0'); @@ -27,7 +27,7 @@ public function test_getting_version_shows_current_version() ->assertExitCode(0); } - public function test_setting_version_persists_version_in_env_and_sets_config() + public function testSettingVersionPersistsVersionInEnvAndSetsConfig() { $this->createTmpEnv(self::ENV_VERSION_STUB); $this->app['config']->set('app.version', '0.0.0'); @@ -48,7 +48,7 @@ public function test_setting_version_persists_version_in_env_and_sets_config() ->assertExitCode(0); } - public function test_missing_env_variable_throws_exception() + public function testMissingEnvVariableThrowsException() { $this->createTmpEnv(self::ENV_EMPTY_STUB); @@ -57,7 +57,7 @@ public function test_missing_env_variable_throws_exception() $this->artisan('app:version 9.9.9'); } - public function test_missing_config_variable_throws_exception() + public function testMissingConfigVariableThrowsException() { $this->createTmpEnv(self::ENV_VERSION_STUB); diff --git a/tests/src/Commands/KeySetCommandTest.php b/tests/src/Commands/KeySetCommandTest.php index 0d37b5e..5f97320 100644 --- a/tests/src/Commands/KeySetCommandTest.php +++ b/tests/src/Commands/KeySetCommandTest.php @@ -7,9 +7,9 @@ class KeySetCommandTest extends TestCase { - const TEST_KEY = 'base64:SGVsbG8gV29ybGQh'; + public const TEST_KEY = 'base64:SGVsbG8gV29ybGQh'; - public function test_setting_key_persists_key_in_env() + public function testSettingKeyPersistsKeyInEnv() { $this->artisan('key:set '.self::TEST_KEY) ->expectsOutput('Application key set successfully.') @@ -23,7 +23,7 @@ public function test_setting_key_persists_key_in_env() $this->assertSame($this->app['config']['app.key'], self::TEST_KEY); } - public function test_nothing_happens_when_key_is_not_empty_in_production_and_confirmation_is_no() + public function testNothingHappensWhenKeyIsNotEmptyInProductionAndConfirmationIsNo() { $this->createTmpEnv(self::ENV_KEY_STUB); $this->app['config']->set('app.key', self::TEST_KEY); @@ -40,7 +40,7 @@ public function test_nothing_happens_when_key_is_not_empty_in_production_and_con ->assertExitCode(1); } - public function test_missing_env_variable_throws_exception() + public function testMissingEnvVariableThrowsException() { $this->createTmpEnv(self::ENV_EMPTY_STUB); diff --git a/tests/src/TestCase.php b/tests/src/TestCase.php index a187914..e800196 100644 --- a/tests/src/TestCase.php +++ b/tests/src/TestCase.php @@ -6,11 +6,11 @@ abstract class TestCase extends \Orchestra\Testbench\TestCase { - const ENV_EMPTY_STUB = '../stubs/.env_empty'; - const ENV_KEY_STUB = '../stubs/.env_key'; - const ENV_STUB = '../stubs/.env'; - const ENV_URL_STUB = '../stubs/.env_url'; - const ENV_VERSION_STUB = '../stubs/.env_version'; + public const ENV_EMPTY_STUB = '../stubs/.env_empty'; + public const ENV_KEY_STUB = '../stubs/.env_key'; + public const ENV_STUB = '../stubs/.env'; + public const ENV_URL_STUB = '../stubs/.env_url'; + public const ENV_VERSION_STUB = '../stubs/.env_version'; private $tempDir;