public function FileLogSettingsTest::providerTestSettingsForm in File Log 2.0.x
Data provider for ::testSettingsForm.
Return value
array An array of test cases.
File
- tests/
src/ Functional/ FileLogSettingsTest.php, line 107
Class
- FileLogSettingsTest
- Test the filelog settings form.
Namespace
Drupal\Tests\filelog\FunctionalCode
public function providerTestSettingsForm() : array {
$default_settings = [
'enabled' => TRUE,
'location' => 'public://logs',
'rotation' => [
'schedule' => 'daily',
'delete' => FALSE,
'destination' => 'archive/[date:custom:Y/m/d].log',
'gzip' => TRUE,
],
'format' => '[[log:created]] [[log:level]] [[log:channel]] [client: [log:ip], [log:user]] [log:message]',
'level' => 7,
'channels_type' => 'exclude',
'channels' => [],
];
$test_cases = [];
// Test multiple channels, with one per line.
$case['settings']['filelog[channels]'] = "channel1\nchannel2\nchannel3";
$case['expected'] = $default_settings;
$case['expected']['channels'] = [
'channel1',
'channel2',
'channel3',
];
$test_cases[] = $case;
$case['settings']['filelog[channels]'] = "channel1\rchannel2\nchannel3\r\nchannel4\n\n\rchannel5";
$case['expected']['channels'] = [
'channel1',
'channel2',
'channel3',
'channel4',
'channel5',
];
$test_cases[] = $case;
return $test_cases;
}