artisan('db:seed'); }); test('update general settings', function () { Setting::set('app_name', 'bar'); $this->assertEquals('bar', Setting::get('app_name')); $this->actingAsAdmin() ->from('/settings/general') ->post('/settings/general', ['app_name' => 'foo']) ->assertRedirect('/settings/general'); $this->assertEquals('foo', Setting::get('app_name')); }); test('only users with appropriate permission can update general settings', function () { Setting::set('app_name', 'bar'); $roleA = RoleFactory::create(); $roleB = RoleFactory::withPermissions('settings.general')->create(); $userA = UserFactory::role($roleA)->create(); $userB = UserFactory::role($roleB)->create(); $this->actingAs($userA) ->from('/settings/general') ->post('/settings/general', ['app_name' => 'foo']) ->assertStatus(403); $this->assertEquals('bar', Setting::get('app_name')); $this->actingAs($userB) ->from('/settings/general') ->post('/settings/general', ['app_name' => 'foo']) ->assertRedirect('/settings/general'); $this->assertEquals('foo', Setting::get('app_name')); });