suppress deprecation notice, convert route param (#3391)
This commit is contained in:
@@ -137,17 +137,16 @@ trait StringAccessibleConfigTrait
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
public function offsetExists($offset): bool
|
||||||
* @return bool
|
|
||||||
*/
|
|
||||||
public function offsetExists($offset)
|
|
||||||
{
|
{
|
||||||
return $this->has($offset);
|
return $this->has($offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return mixed
|
* @param $offset
|
||||||
|
* @return array|bool|float|int|string|null
|
||||||
*/
|
*/
|
||||||
|
#[\ReturnTypeWillChange]
|
||||||
public function offsetGet($offset)
|
public function offsetGet($offset)
|
||||||
{
|
{
|
||||||
return $this->find($offset);
|
return $this->find($offset);
|
||||||
|
|||||||
@@ -125,15 +125,16 @@ final class SystemConfigurationController extends AbstractController
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Route(path="/update/{section}/{single}", name="system_configuration_update", methods={"POST"})
|
* @Route(path="/update/{section}/{single}", defaults={"single": "0"}, name="system_configuration_update", methods={"POST"})
|
||||||
*
|
*
|
||||||
* @internal do not link directly to this route
|
* @internal do not link directly to this route
|
||||||
* @param Request $request
|
* @param Request $request
|
||||||
* @param string $section
|
* @param string $section
|
||||||
* @return \Symfony\Component\HttpFoundation\RedirectResponse|\Symfony\Component\HttpFoundation\Response
|
* @return \Symfony\Component\HttpFoundation\RedirectResponse|\Symfony\Component\HttpFoundation\Response
|
||||||
*/
|
*/
|
||||||
public function configUpdate(Request $request, string $section, bool $single)
|
public function configUpdate(Request $request, string $section, string $single)
|
||||||
{
|
{
|
||||||
|
$single = (bool) $single;
|
||||||
$configModel = null;
|
$configModel = null;
|
||||||
$configSettings = $this->getInitializedConfigurations();
|
$configSettings = $this->getInitializedConfigurations();
|
||||||
|
|
||||||
|
|||||||
@@ -69,19 +69,19 @@ class SystemConfigurationControllerTest extends ControllerBaseTest
|
|||||||
public function getTestDataForms()
|
public function getTestDataForms()
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
['form[name=system_configuration_form_timesheet]', $this->createUrl('/admin/system-config/update/timesheet/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/0')],
|
['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/0')],
|
['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/0')],
|
['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/0')],
|
['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/0')],
|
['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/0')],
|
['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/0')],
|
['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/0')],
|
['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/0')],
|
['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/0')],
|
['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/0')],
|
['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/0')],
|
['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'));
|
$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()
|
public function testUpdateUserConfig()
|
||||||
{
|
{
|
||||||
$client = $this->getClientForAuthenticatedUser(User::ROLE_SUPER_ADMIN);
|
$client = $this->getClientForAuthenticatedUser(User::ROLE_SUPER_ADMIN);
|
||||||
|
|||||||
Reference in New Issue
Block a user