Implement PHP CS Fixer and a coding standard to follow (#471)

* Create PHP CS Fixer config and add to CI workflow

* Run php cs fixer on project

* Add newline at end of file

* Update to use PHP CS Fixer v3

* Run v3 config on project

* Run seperate config in CI
This commit is contained in:
Mwikala Kangwa
2021-05-21 12:57:51 +01:00
committed by GitHub
parent 633cad9b89
commit 9e98a96d61
316 changed files with 4715 additions and 3195 deletions

View File

@ -1,9 +1,9 @@
<?php
use Crater\Models\User;
use Crater\Models\Tax;
use Crater\Models\Estimate;
use Crater\Models\EstimateItem;
use Crater\Models\Tax;
use Crater\Models\User;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Artisan;
use Laravel\Sanctum\Sanctum;
@ -54,15 +54,15 @@ test('estimate belongs to estimate template', function () {
test('get next estimate number', function () {
$estimate = Estimate::factory()->create();
$estimate = Estimate::factory()->create();
$prefix = $estimate->getEstimatePrefixAttribute();
$prefix = $estimate->getEstimatePrefixAttribute();
$nextNumber = $estimate->getNextEstimateNumber($prefix);
$nextNumber = $estimate->getNextEstimateNumber($prefix);
$estimate1 = Estimate::factory()->create();
$estimate1 = Estimate::factory()->create();
$this->assertEquals($prefix.'-'.$nextNumber, $estimate1['estimate_number']);
$this->assertEquals($prefix.'-'.$nextNumber, $estimate1['estimate_number']);
});
test('get estimate prefix attribute', function () {
@ -96,7 +96,7 @@ test('create estimate', function () {
$estimate['taxes'] = [];
array_push($estimate['taxes'], Tax::factory()->raw());
$request = new Request;
$request = new Request();
$request->replace($estimate);
@ -121,7 +121,7 @@ test('create estimate', function () {
'discount_type' => $estimate['discount_type'],
'discount_val' => $estimate['discount_val'],
'tax' => $estimate['tax'],
'notes' => $estimate['notes']
'notes' => $estimate['notes'],
]);
});
@ -131,7 +131,7 @@ test('update estimate', function () {
$newEstimate = Estimate::factory()->raw();
$item = EstimateItem::factory()->raw([
'estimate_id' => $estimate->id
'estimate_id' => $estimate->id,
]);
$newEstimate['items'] = [];
@ -140,7 +140,7 @@ test('update estimate', function () {
array_push($newEstimate['items'], $item);
array_push($newEstimate['taxes'], Tax::factory()->raw());
$request = new Request;
$request = new Request();
$request->replace($newEstimate);
@ -156,7 +156,7 @@ test('update estimate', function () {
'description' => $item['description'],
'price' => $item['price'],
'total' => $item['total'],
'quantity' => $item['quantity']
'quantity' => $item['quantity'],
]);
$this->assertDatabaseHas('estimates', [
@ -169,7 +169,7 @@ test('update estimate', function () {
'discount_type' => $newEstimate['discount_type'],
'discount_val' => $newEstimate['discount_val'],
'tax' => $newEstimate['tax'],
'notes' => $newEstimate['notes']
'notes' => $newEstimate['notes'],
]);
});
@ -179,12 +179,12 @@ test('create items', function () {
$items = [];
$item = EstimateItem::factory()->raw([
'invoice_id' => $estimate->id
'invoice_id' => $estimate->id,
]);
array_push($items, $item);
$request = new Request;
$request = new Request();
$request->replace(['items' => $items ]);
@ -196,7 +196,7 @@ test('create items', function () {
'price' => $item['price'],
'tax' => $item['tax'],
'quantity' => $item['quantity'],
'total' => $item['total']
'total' => $item['total'],
]);
$this->assertCount(1, $estimate->items);
@ -207,17 +207,17 @@ test('create taxes', function () {
$taxes = [];
$tax1 = Tax::factory()->raw([
'estimate_id' => $estimate->id
'estimate_id' => $estimate->id,
]);
$tax2 = Tax::factory()->raw([
'estimate_id' => $estimate->id
'estimate_id' => $estimate->id,
]);
array_push($taxes, $tax1);
array_push($taxes, $tax2);
$request = new Request;
$request = new Request();
$request->replace(['taxes' => $taxes ]);