Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: PHP CS Fixer should check test files too. #23

Merged
merged 2 commits into from
Jan 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

$finder = PhpCsFixer\Finder::create()
->in(__DIR__ . '/app')
->in(__DIR__ . '/tests')
->append([
__DIR__ . '/.php-cs-fixer.dist.php',
]);
Expand Down
4 changes: 3 additions & 1 deletion app/Commands/InstallCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ private function tasks(): bool

$this->task('Copy Larastan config', function () {
$this->copyFilesFromVendorDirectory('stickee/larastan-config/dist');

return $this->amendLarastanConfig();
});

Expand Down Expand Up @@ -119,8 +120,9 @@ private function amendLarastanConfig(): bool

if (! $disk->exists($path)) {
$this->newLine();
$this->error("Something went wrong.");
$this->error('Something went wrong.');
$this->error("Could not amend your {$larastanConfig} file.");

return false;
}

Expand Down
4 changes: 2 additions & 2 deletions tests/Feature/FixCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@

use Illuminate\Support\Facades\Storage;

beforeEach(function() {
beforeEach(function () {
$fileName = '.php-cs-fixer.cache';
Storage::disk('cwd')->move($fileName, "{$fileName}.old");
});

afterEach(function() {
afterEach(function () {
$fileName = '.php-cs-fixer.cache';
Storage::disk('cwd')->move("{$fileName}.old", $fileName);
});
Expand Down
6 changes: 3 additions & 3 deletions tests/Feature/InstallCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
'.lintstagedrc.json',
'phpstan.ci.neon',
'phpstan.dist.neon',
'rector.php'
'rector.php',
];

beforeEach(function () use ($requiredFiles) {
Expand Down Expand Up @@ -47,7 +47,7 @@
);
});

it ('overwrites copied GitHub workflow with its own', function () {
it('overwrites copied GitHub workflow with its own', function () {
$this->artisan('install');

$file = '.github/workflows/php.yaml';
Expand Down Expand Up @@ -108,7 +108,7 @@
$disk->deleteDirectory($directory);
});

it ('updates the Larastan config paths', function () {
it('updates the Larastan config paths', function () {
$this->artisan('install');

$contents = Storage::disk('cwd')->get('phpstan.dist.neon');
Expand Down
1 change: 0 additions & 1 deletion tests/Pest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,3 @@
use Tests\TestCase;

uses(TestCase::class)->in('Feature', 'Unit');