suppress deprecation notice, convert route param (#3391)

This commit is contained in:
Kevin Papst
2022-06-30 12:14:01 +02:00
committed by GitHub
parent 665f0d0ca7
commit cd297150ea
3 changed files with 43 additions and 20 deletions

View File

@@ -69,19 +69,19 @@ class SystemConfigurationControllerTest extends ControllerBaseTest
public function getTestDataForms()
{
return [
['form[name=system_configuration_form_timesheet]', $this->createUrl('/admin/system-config/update/timesheet/0')],
['form[name=system_configuration_form_quick_entry]', $this->createUrl('/admin/system-config/update/quick_entry/0')],
['form[name=system_configuration_form_lockdown_period]', $this->createUrl('/admin/system-config/update/lockdown_period/0')],
['form[name=system_configuration_form_invoice]', $this->createUrl('/admin/system-config/update/invoice/0')],
['form[name=system_configuration_form_authentication]', $this->createUrl('/admin/system-config/update/authentication/0')],
['form[name=system_configuration_form_rounding]', $this->createUrl('/admin/system-config/update/rounding/0')],
['form[name=system_configuration_form_customer]', $this->createUrl('/admin/system-config/update/customer/0')],
['form[name=system_configuration_form_project]', $this->createUrl('/admin/system-config/update/project/0')],
['form[name=system_configuration_form_activity]', $this->createUrl('/admin/system-config/update/activity/0')],
['form[name=system_configuration_form_user]', $this->createUrl('/admin/system-config/update/user/0')],
['form[name=system_configuration_form_theme]', $this->createUrl('/admin/system-config/update/theme/0')],
['form[name=system_configuration_form_calendar]', $this->createUrl('/admin/system-config/update/calendar/0')],
['form[name=system_configuration_form_branding]', $this->createUrl('/admin/system-config/update/branding/0')],
['form[name=system_configuration_form_timesheet]', $this->createUrl('/admin/system-config/update/timesheet')],
['form[name=system_configuration_form_quick_entry]', $this->createUrl('/admin/system-config/update/quick_entry')],
['form[name=system_configuration_form_lockdown_period]', $this->createUrl('/admin/system-config/update/lockdown_period')],
['form[name=system_configuration_form_invoice]', $this->createUrl('/admin/system-config/update/invoice')],
['form[name=system_configuration_form_authentication]', $this->createUrl('/admin/system-config/update/authentication')],
['form[name=system_configuration_form_rounding]', $this->createUrl('/admin/system-config/update/rounding')],
['form[name=system_configuration_form_customer]', $this->createUrl('/admin/system-config/update/customer')],
['form[name=system_configuration_form_project]', $this->createUrl('/admin/system-config/update/project')],
['form[name=system_configuration_form_activity]', $this->createUrl('/admin/system-config/update/activity')],
['form[name=system_configuration_form_user]', $this->createUrl('/admin/system-config/update/user')],
['form[name=system_configuration_form_theme]', $this->createUrl('/admin/system-config/update/theme')],
['form[name=system_configuration_form_calendar]', $this->createUrl('/admin/system-config/update/calendar')],
['form[name=system_configuration_form_branding]', $this->createUrl('/admin/system-config/update/branding')],
];
}
@@ -217,6 +217,29 @@ class SystemConfigurationControllerTest extends ControllerBaseTest
$this->assertEquals('GBP', $configService->find('defaults.customer.currency'));
}
public function testUpdateCustomerConfigWithSingleParam()
{
$client = $this->getClientForAuthenticatedUser(User::ROLE_SUPER_ADMIN);
$this->assertAccessIsGranted($client, '/admin/system-config/edit/customer');
$form = $client->getCrawler()->filter('form[name=system_configuration_form_customer]')->form();
self::assertStringEndsWith('/admin/system-config/update/customer/1', $form->getUri());
$client->submit($form, [
'system_configuration_form_customer' => [
'configuration' => [
['name' => 'defaults.customer.timezone', 'value' => 'Atlantic/Canary'],
['name' => 'defaults.customer.country', 'value' => 'BB'],
['name' => 'defaults.customer.currency', 'value' => 'GBP'],
]
]
]);
$this->assertIsRedirect($client, $this->createUrl('/admin/system-config/edit/customer'));
$client->followRedirect();
$this->assertTrue($client->getResponse()->isSuccessful());
$this->assertHasFlashSaveSuccess($client);
}
public function testUpdateUserConfig()
{
$client = $this->getClientForAuthenticatedUser(User::ROLE_SUPER_ADMIN);