Merge pull request #989 from SevanNerse/wizard
Deleting problem of currencies at wizard step is fixed. It also solve…
This commit is contained in:
commit
69aa0834e2
@ -1,5 +1,4 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace Database\Seeds;
|
namespace Database\Seeds;
|
||||||
|
|
||||||
use App\Abstracts\Model;
|
use App\Abstracts\Model;
|
||||||
@ -9,6 +8,7 @@ use Illuminate\Database\Seeder;
|
|||||||
|
|
||||||
class Roles extends Seeder
|
class Roles extends Seeder
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Run the database seeds.
|
* Run the database seeds.
|
||||||
*
|
*
|
||||||
@ -76,9 +76,9 @@ class Roles extends Seeder
|
|||||||
'settings-schedule' => 'r',
|
'settings-schedule' => 'r',
|
||||||
'settings-taxes' => 'c,r,u,d',
|
'settings-taxes' => 'c,r,u,d',
|
||||||
'wizard-companies' => 'c,r,u',
|
'wizard-companies' => 'c,r,u',
|
||||||
'wizard-currencies' => 'c,r,u',
|
'wizard-currencies' => 'c,r,u,d',
|
||||||
'wizard-finish' => 'c,r,u',
|
'wizard-finish' => 'c,r,u',
|
||||||
'wizard-taxes' => 'c,r,u',
|
'wizard-taxes' => 'c,r,u'
|
||||||
],
|
],
|
||||||
'manager' => [
|
'manager' => [
|
||||||
'admin-panel' => 'r',
|
'admin-panel' => 'r',
|
||||||
@ -118,14 +118,14 @@ class Roles extends Seeder
|
|||||||
'settings-modules' => 'r,u',
|
'settings-modules' => 'r,u',
|
||||||
'settings-settings' => 'r,u',
|
'settings-settings' => 'r,u',
|
||||||
'settings-schedule' => 'r',
|
'settings-schedule' => 'r',
|
||||||
'settings-taxes' => 'c,r,u,d',
|
'settings-taxes' => 'c,r,u,d'
|
||||||
],
|
],
|
||||||
'customer' => [
|
'customer' => [
|
||||||
'client-portal' => 'r',
|
'client-portal' => 'r',
|
||||||
'portal-invoices' => 'r,u',
|
'portal-invoices' => 'r,u',
|
||||||
'portal-payments' => 'r,u',
|
'portal-payments' => 'r,u',
|
||||||
'portal-profile' => 'r,u',
|
'portal-profile' => 'r,u'
|
||||||
],
|
]
|
||||||
];
|
];
|
||||||
|
|
||||||
return $rows;
|
return $rows;
|
||||||
@ -169,7 +169,7 @@ class Roles extends Seeder
|
|||||||
$permission = Permission::firstOrCreate([
|
$permission = Permission::firstOrCreate([
|
||||||
'name' => $permissionValue . '-' . $module,
|
'name' => $permissionValue . '-' . $module,
|
||||||
'display_name' => ucfirst($permissionValue) . ' ' . $moduleName,
|
'display_name' => ucfirst($permissionValue) . ' ' . $moduleName,
|
||||||
'description' => ucfirst($permissionValue) . ' ' . $moduleName,
|
'description' => ucfirst($permissionValue) . ' ' . $moduleName
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$this->command->info('Creating Permission to ' . $permissionValue . ' for ' . $moduleName);
|
$this->command->info('Creating Permission to ' . $permissionValue . ' for ' . $moduleName);
|
||||||
|
@ -1,11 +1,12 @@
|
|||||||
<?php
|
<?php
|
||||||
|
Route::group([
|
||||||
Route::group(['as' => 'wizard.'], function () {
|
'as' => 'wizard.'
|
||||||
|
], function () {
|
||||||
Route::get('companies', 'Wizard\Companies@edit')->name('companies.edit');
|
Route::get('companies', 'Wizard\Companies@edit')->name('companies.edit');
|
||||||
Route::patch('companies', 'Wizard\Companies@update')->name('companies.update');
|
Route::patch('companies', 'Wizard\Companies@update')->name('companies.update');
|
||||||
|
|
||||||
Route::get('currencies', 'Wizard\Currencies@index')->name('currencies.index');
|
Route::get('currencies', 'Wizard\Currencies@index')->name('currencies.index');
|
||||||
Route::get('currencies/{currency}/delete', 'Wizard\Currencies@destroy')->name('currencies.delete');
|
Route::delete('currencies/{currency}', 'Wizard\Currencies@destroy')->name('currencies.delete');
|
||||||
Route::post('currencies', 'Wizard\Currencies@store')->name('currencies.store');
|
Route::post('currencies', 'Wizard\Currencies@store')->name('currencies.store');
|
||||||
Route::patch('currencies/{currency}', 'Wizard\Currencies@update')->name('currencies.update');
|
Route::patch('currencies/{currency}', 'Wizard\Currencies@update')->name('currencies.update');
|
||||||
|
|
||||||
@ -16,3 +17,4 @@ Route::group(['as' => 'wizard.'], function () {
|
|||||||
|
|
||||||
Route::get('finish', 'Wizard\Finish@index')->name('finish.index');
|
Route::get('finish', 'Wizard\Finish@index')->name('finish.index');
|
||||||
});
|
});
|
||||||
|
|
70
tests/Feature/Wizard/CurrenciesTest.php
Normal file
70
tests/Feature/Wizard/CurrenciesTest.php
Normal file
@ -0,0 +1,70 @@
|
|||||||
|
<?php
|
||||||
|
namespace Tests\Feature\Wizard;
|
||||||
|
|
||||||
|
use App\Jobs\Setting\CreateCurrency;
|
||||||
|
use Tests\Feature\FeatureTestCase;
|
||||||
|
|
||||||
|
class CurrenciesTest extends FeatureTestCase
|
||||||
|
{
|
||||||
|
|
||||||
|
public function testItShouldSeeCurrencyListPage()
|
||||||
|
{
|
||||||
|
$this->loginAs()
|
||||||
|
->get(route('wizard.currencies.index'))
|
||||||
|
->assertStatus(200)
|
||||||
|
->assertSeeText(trans_choice('general.currencies', 2));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testItShouldCreateCurrency()
|
||||||
|
{
|
||||||
|
$this->loginAs()
|
||||||
|
->post(route('wizard.currencies.store'), $this->getCurrencyRequest())
|
||||||
|
->assertStatus(200);
|
||||||
|
|
||||||
|
$this->assertFlashLevel('success');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testItShouldUpdateCurrency()
|
||||||
|
{
|
||||||
|
$request = $this->getCurrencyRequest();
|
||||||
|
|
||||||
|
$currency = $this->dispatch(new CreateCurrency($request));
|
||||||
|
|
||||||
|
$request['name'] = $this->faker->text(15);
|
||||||
|
|
||||||
|
$this->loginAs()
|
||||||
|
->patch(route('wizard.currencies.update', $currency->id), $request)
|
||||||
|
->assertStatus(200);
|
||||||
|
|
||||||
|
$this->assertFlashLevel('success');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testItShouldDeleteCurrency()
|
||||||
|
{
|
||||||
|
$currency = $this->dispatch(new CreateCurrency($this->getCurrencyRequest()));
|
||||||
|
|
||||||
|
$this->loginAs()
|
||||||
|
->delete(route('wizard.currencies.delete', $currency->id))
|
||||||
|
->assertStatus(200);
|
||||||
|
|
||||||
|
$this->assertFlashLevel('success');
|
||||||
|
}
|
||||||
|
|
||||||
|
private function getCurrencyRequest()
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'company_id' => $this->company->id,
|
||||||
|
'name' => $this->faker->text(15),
|
||||||
|
'code' => $this->faker->text(strtoupper(5)),
|
||||||
|
'rate' => $this->faker->boolean(1),
|
||||||
|
'precision' => $this->faker->text(5),
|
||||||
|
'symbol' => $this->faker->text(5),
|
||||||
|
'symbol_first' => 1,
|
||||||
|
'symbol_position' => 'after_amount',
|
||||||
|
'decimal_mark' => $this->faker->text(5),
|
||||||
|
'thousands_separator' => $this->faker->text(5),
|
||||||
|
'enabled' => $this->faker->boolean ? 1 : 0,
|
||||||
|
'default_currency' => 0
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user