wizard taxes test
This commit is contained in:
parent
10f07075ad
commit
4965a1c315
@ -1,20 +1,11 @@
|
||||
<?php
|
||||
Route::group([
|
||||
'as' => 'wizard.'
|
||||
], function () {
|
||||
|
||||
Route::group(['as' => 'wizard.'], function () {
|
||||
Route::get('companies', 'Wizard\Companies@edit')->name('companies.edit');
|
||||
Route::patch('companies', 'Wizard\Companies@update')->name('companies.update');
|
||||
|
||||
Route::get('currencies', 'Wizard\Currencies@index')->name('currencies.index');
|
||||
Route::delete('currencies/{currency}', 'Wizard\Currencies@destroy')->name('currencies.delete');
|
||||
Route::post('currencies', 'Wizard\Currencies@store')->name('currencies.store');
|
||||
Route::patch('currencies/{currency}', 'Wizard\Currencies@update')->name('currencies.update');
|
||||
|
||||
Route::get('taxes', 'Wizard\Taxes@index')->name('taxes.index');
|
||||
Route::get('taxes/{tax}/delete', 'Wizard\Taxes@destroy')->name('taxes.delete');
|
||||
Route::post('taxes', 'Wizard\Taxes@store')->name('taxes.store');
|
||||
Route::patch('taxes/{tax}', 'Wizard\Taxes@update')->name('taxes.update');
|
||||
Route::resource('currencies', 'Wizard\Currencies');
|
||||
Route::resource('taxes', 'Wizard\Taxes');
|
||||
|
||||
Route::get('finish', 'Wizard\Finish@index')->name('finish.index');
|
||||
});
|
||||
|
@ -44,7 +44,7 @@ class CurrenciesTest extends FeatureTestCase
|
||||
$currency = $this->dispatch(new CreateCurrency($this->getRequest()));
|
||||
|
||||
$this->loginAs()
|
||||
->delete(route('wizard.currencies.delete', $currency->id))
|
||||
->delete(route('wizard.currencies.destroy', $currency->id))
|
||||
->assertStatus(200);
|
||||
|
||||
$this->assertFlashLevel('success');
|
||||
|
57
tests/Feature/Wizard/TaxesTest.php
Normal file
57
tests/Feature/Wizard/TaxesTest.php
Normal file
@ -0,0 +1,57 @@
|
||||
<?php
|
||||
namespace Tests\Feature\Wizard;
|
||||
|
||||
use App\Jobs\Setting\CreateTax;
|
||||
use App\Models\Setting\Tax;
|
||||
use Tests\Feature\FeatureTestCase;
|
||||
|
||||
class TaxesTest extends FeatureTestCase
|
||||
{
|
||||
public function testItShouldSeeTaxListPage()
|
||||
{
|
||||
$this->loginAs()
|
||||
->get(route('wizard.taxes.index'))
|
||||
->assertStatus(200)
|
||||
->assertSeeText(trans('general.add_new'));
|
||||
}
|
||||
|
||||
public function testItShouldCreateTax()
|
||||
{
|
||||
$this->loginAs()
|
||||
->post(route('wizard.taxes.store'), $this->getRequest())
|
||||
->assertStatus(200);
|
||||
|
||||
$this->assertFlashLevel('success');
|
||||
}
|
||||
|
||||
public function testItShouldUpdateTax()
|
||||
{
|
||||
$request = $this->getRequest();
|
||||
|
||||
$tax = $this->dispatch(new CreateTax($request));
|
||||
|
||||
$request['name'] = $this->faker->text(15);
|
||||
|
||||
$this->loginAs()
|
||||
->patch(route('wizard.taxes.update', $tax->id), $request)
|
||||
->assertStatus(200);
|
||||
|
||||
$this->assertFlashLevel('success');
|
||||
}
|
||||
|
||||
public function testItShouldDeleteTax()
|
||||
{
|
||||
$tax = $this->dispatch(new CreateTax($this->getRequest()));
|
||||
|
||||
$this->loginAs()
|
||||
->delete(route('wizard.taxes.destroy', $tax->id))
|
||||
->assertStatus(200);
|
||||
|
||||
$this->assertFlashLevel('success');
|
||||
}
|
||||
|
||||
public function getRequest()
|
||||
{
|
||||
return factory(Tax::class)->states('enabled')->raw();
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user