Browse Source

Apply fixes from StyleCI (#5)

pull/6/head
Nafies Luthfi 9 years ago
committed by GitHub
parent
commit
2a7a163de1
  1. 2
      app/Http/Controllers/Api/ProductsController.php
  2. 2
      app/Http/Controllers/CartController.php
  3. 1
      app/Http/Controllers/ProductsController.php
  4. 2
      app/Http/Controllers/TransactionsController.php
  5. 1
      app/Transaction.php
  6. 2
      config/store.php
  7. 3
      routes/api.php
  8. 4
      tests/Feature/Cart/SearchProductsTest.php
  9. 8
      tests/Feature/TransactionEntryTest.php
  10. 16
      tests/TestCase.php

2
app/Http/Controllers/Api/ProductsController.php

@ -21,6 +21,6 @@ class ProductsController extends Controller
})->with('unit')->get();
}
return view('cart.partials.product-search-result-box', compact('queriedProducts','draftType','draftKey','formToken'));
return view('cart.partials.product-search-result-box', compact('queriedProducts', 'draftType', 'draftKey', 'formToken'));
}
}

2
app/Http/Controllers/CartController.php

@ -63,7 +63,7 @@ class CartController extends Controller
$this->cart->addItemToDraft($draftKey, $item);
flash(trans('cart.item_added', [
'product_name' => $product->name . ' (' . $product->unit->name . ')',
'product_name' => $product->name.' ('.$product->unit->name.')',
'qty' => $request->qty,
]));

1
app/Http/Controllers/ProductsController.php

@ -83,6 +83,7 @@ class ProductsController extends Controller
public function priceList()
{
$products = Product::orderBy('name')->with('unit')->get();
return view('products.price-list', compact('products'));
// $pdf = PDF::loadView('products.price-list', compact('products'));

2
app/Http/Controllers/TransactionsController.php

@ -24,7 +24,7 @@ class TransactionsController extends Controller
{
// return view('transactions.pdf', compact('transaction'));
$pdf = PDF::loadView('transactions.pdf', compact('transaction'));
return $pdf->stream($transaction->invoice_no.'.faktur.pdf');
return $pdf->stream($transaction->invoice_no.'.faktur.pdf');
}
}

1
app/Transaction.php

@ -2,7 +2,6 @@
namespace App;
use App\User;
use Illuminate\Database\Eloquent\Model;
class Transaction extends Model

2
config/store.php

@ -1,7 +1,7 @@
<?php
return [
'name' => env('STORE_NAME','Laravel'),
'name' => env('STORE_NAME', 'Laravel'),
'address' => env('STORE_ADDRESS'),
'phone' => env('STORE_PHONE'),
];

3
routes/api.php

@ -1,7 +1,6 @@
<?php
use Illuminate\Http\Request;
Route::group(['prefix' => 'v1','namespace' => 'Api', 'as' => 'api.', 'middleware' => []], function() {
Route::group(['prefix' => 'v1', 'namespace' => 'Api', 'as' => 'api.', 'middleware' => []], function () {
Route::post('products/search', ['as' => 'products.search', 'uses' => 'ProductsController@search']);
});

4
tests/Feature/Cart/SearchProductsTest.php

@ -28,9 +28,9 @@ class SearchProductsTest extends TestCase
$user = $this->loginAsUser();
$response = $this->post(route('api.products.search'), [
'query'=> 'Bis',
'query' => 'Bis',
'draftType'=> $draft->type,
'draftKey'=> $draft->draftKey,
'draftKey' => $draft->draftKey,
]);
$response->assertSuccessful();

8
tests/Feature/TransactionEntryTest.php

@ -91,15 +91,15 @@ class TransactionEntryTest extends BrowserKitTestCase
$this->type(2, 'qty');
$this->press('add-product-'.$product1->id);
$this->see(trans('cart.item_added', [
'product_name' => $product1->name . ' (' . $product1->unit->name . ')',
'qty' => 2
'product_name' => $product1->name.' ('.$product1->unit->name.')',
'qty' => 2,
]));
$this->type(3, 'qty');
$this->press('add-product-'.$product2->id);
$this->see(trans('cart.item_added', [
'product_name' => $product2->name . ' (' . $product2->unit->name . ')',
'qty' => 3
'product_name' => $product2->name.' ('.$product2->unit->name.')',
'qty' => 3,
]));
$this->seePageIs(route('cart.show', [$draft->draftKey, 'query' => 'testing']));

16
tests/TestCase.php

@ -2,10 +2,10 @@
namespace Tests;
use App\User;
use Illuminate\Foundation\Testing\TestCase as BaseTestCase;
use App\Exceptions\Handler;
use App\User;
use Illuminate\Contracts\Debug\ExceptionHandler;
use Illuminate\Foundation\Testing\TestCase as BaseTestCase;
abstract class TestCase extends BaseTestCase
{
@ -23,9 +23,15 @@ abstract class TestCase extends BaseTestCase
{
// Disable Laravel's default exception handling
// and allow exceptions to bubble up the stack
$this->app->instance(ExceptionHandler::class, new class extends Handler {
public function __construct() {}
public function report(\Exception $exception) {}
$this->app->instance(ExceptionHandler::class, new class() extends Handler {
public function __construct()
{
}
public function report(\Exception $exception)
{
}
public function render($request, \Exception $exception)
{
throw $exception;

Loading…
Cancel
Save