Skip to content

Commit

Permalink
PHPCS
Browse files Browse the repository at this point in the history
  • Loading branch information
kevindierkx committed Nov 10, 2022
1 parent d73a822 commit 0eac099
Show file tree
Hide file tree
Showing 8 changed files with 58 additions and 21 deletions.
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The MIT License (MIT)

Copyright (c) 2020 Kevin Dierkx <[email protected]>
Copyright (c) 2022 Kevin Dierkx <[email protected]>

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
33 changes: 33 additions & 0 deletions build/report.junit.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?xml version="1.0" encoding="UTF-8"?>
<testsuites>
<testsuite name="" tests="12" assertions="32" errors="0" warnings="0" failures="1" skipped="0" time="0.819127">
<testsuite name="all" tests="12" assertions="32" errors="0" warnings="0" failures="1" skipped="0" time="0.819127">
<testsuite name="DistortedFusion\Env\Tests\Commands\AppUrlCommandTest" file="/home/vagrant/code/distortedfusion/laravel-env-management/tests/src/Commands/AppUrlCommandTest.php" tests="4" assertions="11" errors="0" warnings="0" failures="0" skipped="0" time="0.574510">
<testcase name="testGettingUrlWhenNoneIsSetShowsError" class="DistortedFusion\Env\Tests\Commands\AppUrlCommandTest" classname="DistortedFusion.Env.Tests.Commands.AppUrlCommandTest" file="/home/vagrant/code/distortedfusion/laravel-env-management/tests/src/Commands/AppUrlCommandTest.php" line="10" assertions="2" time="0.488609"/>
<testcase name="testGettingUrlShowsCurrentUrl" class="DistortedFusion\Env\Tests\Commands\AppUrlCommandTest" classname="DistortedFusion.Env.Tests.Commands.AppUrlCommandTest" file="/home/vagrant/code/distortedfusion/laravel-env-management/tests/src/Commands/AppUrlCommandTest.php" line="20" assertions="2" time="0.025413"/>
<testcase name="testSettingUrlPersistsUrlInEnvAndSetsConfig" class="DistortedFusion\Env\Tests\Commands\AppUrlCommandTest" classname="DistortedFusion.Env.Tests.Commands.AppUrlCommandTest" file="/home/vagrant/code/distortedfusion/laravel-env-management/tests/src/Commands/AppUrlCommandTest.php" line="30" assertions="6" time="0.031070"/>
<testcase name="testMissingEnvVariableThrowsException" class="DistortedFusion\Env\Tests\Commands\AppUrlCommandTest" classname="DistortedFusion.Env.Tests.Commands.AppUrlCommandTest" file="/home/vagrant/code/distortedfusion/laravel-env-management/tests/src/Commands/AppUrlCommandTest.php" line="51" assertions="1" time="0.029418"/>
</testsuite>
<testsuite name="DistortedFusion\Env\Tests\Commands\AppVersionCommandTest" file="/home/vagrant/code/distortedfusion/laravel-env-management/tests/src/Commands/AppVersionCommandTest.php" tests="5" assertions="12" errors="0" warnings="0" failures="0" skipped="0" time="0.126135">
<testcase name="testGettingVersionWhenNoneIsSetShowsError" class="DistortedFusion\Env\Tests\Commands\AppVersionCommandTest" classname="DistortedFusion.Env.Tests.Commands.AppVersionCommandTest" file="/home/vagrant/code/distortedfusion/laravel-env-management/tests/src/Commands/AppVersionCommandTest.php" line="10" assertions="2" time="0.023853"/>
<testcase name="testGettingVersionShowsCurrentVersion" class="DistortedFusion\Env\Tests\Commands\AppVersionCommandTest" classname="DistortedFusion.Env.Tests.Commands.AppVersionCommandTest" file="/home/vagrant/code/distortedfusion/laravel-env-management/tests/src/Commands/AppVersionCommandTest.php" line="20" assertions="2" time="0.022952"/>
<testcase name="testSettingVersionPersistsVersionInEnvAndSetsConfig" class="DistortedFusion\Env\Tests\Commands\AppVersionCommandTest" classname="DistortedFusion.Env.Tests.Commands.AppVersionCommandTest" file="/home/vagrant/code/distortedfusion/laravel-env-management/tests/src/Commands/AppVersionCommandTest.php" line="30" assertions="6" time="0.027678"/>
<testcase name="testMissingEnvVariableThrowsException" class="DistortedFusion\Env\Tests\Commands\AppVersionCommandTest" classname="DistortedFusion.Env.Tests.Commands.AppVersionCommandTest" file="/home/vagrant/code/distortedfusion/laravel-env-management/tests/src/Commands/AppVersionCommandTest.php" line="51" assertions="1" time="0.025685"/>
<testcase name="testMissingConfigVariableThrowsException" class="DistortedFusion\Env\Tests\Commands\AppVersionCommandTest" classname="DistortedFusion.Env.Tests.Commands.AppVersionCommandTest" file="/home/vagrant/code/distortedfusion/laravel-env-management/tests/src/Commands/AppVersionCommandTest.php" line="60" assertions="1" time="0.025966"/>
</testsuite>
<testsuite name="DistortedFusion\Env\Tests\Commands\KeySetCommandTest" file="/home/vagrant/code/distortedfusion/laravel-env-management/tests/src/Commands/KeySetCommandTest.php" tests="3" assertions="9" errors="0" warnings="0" failures="1" skipped="0" time="0.118482">
<testcase name="testSettingKeyPersistsKeyInEnv" class="DistortedFusion\Env\Tests\Commands\KeySetCommandTest" classname="DistortedFusion.Env.Tests.Commands.KeySetCommandTest" file="/home/vagrant/code/distortedfusion/laravel-env-management/tests/src/Commands/KeySetCommandTest.php" line="12" assertions="4" time="0.028152"/>
<testcase name="testNothingHappensWhenKeyIsNotEmptyInProductionAndConfirmationIsNo" class="DistortedFusion\Env\Tests\Commands\KeySetCommandTest" classname="DistortedFusion.Env.Tests.Commands.KeySetCommandTest" file="/home/vagrant/code/distortedfusion/laravel-env-management/tests/src/Commands/KeySetCommandTest.php" line="26" assertions="4" time="0.064424">
<failure type="PHPUnit\Framework\AssertionFailedError">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</failure>
</testcase>
<testcase name="testMissingEnvVariableThrowsException" class="DistortedFusion\Env\Tests\Commands\KeySetCommandTest" classname="DistortedFusion.Env.Tests.Commands.KeySetCommandTest" file="/home/vagrant/code/distortedfusion/laravel-env-management/tests/src/Commands/KeySetCommandTest.php" line="43" assertions="1" time="0.025905"/>
</testsuite>
</testsuite>
</testsuite>
</testsuites>
4 changes: 3 additions & 1 deletion src/Commands/Exceptions/MissingConfigException.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

namespace DistortedFusion\Env\Commands\Exceptions;

class MissingConfigException extends \RuntimeException
use RuntimeException;

class MissingConfigException extends RuntimeException
{
}
4 changes: 3 additions & 1 deletion src/Commands/Exceptions/MissingEnvException.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

namespace DistortedFusion\Env\Commands\Exceptions;

class MissingEnvException extends \RuntimeException
use RuntimeException;

class MissingEnvException extends RuntimeException
{
}
8 changes: 4 additions & 4 deletions tests/src/Commands/AppUrlCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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');
Expand All @@ -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');
Expand All @@ -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);

Expand Down
10 changes: 5 additions & 5 deletions tests/src/Commands/AppVersionCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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');
Expand All @@ -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');
Expand All @@ -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);

Expand All @@ -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);

Expand Down
8 changes: 4 additions & 4 deletions tests/src/Commands/KeySetCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.')
Expand All @@ -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);
Expand All @@ -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);

Expand Down
10 changes: 5 additions & 5 deletions tests/src/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down

0 comments on commit 0eac099

Please sign in to comment.