function AggregatorPluginSettingsBaseTest::testSettingsForm
Same name in other branches
- 8.9.x core/modules/aggregator/tests/src/Unit/Plugin/AggregatorPluginSettingsBaseTest.php \Drupal\Tests\aggregator\Unit\Plugin\AggregatorPluginSettingsBaseTest::testSettingsForm()
Tests for AggregatorPluginSettingsBase.
Ensure that the settings form calls build, validate and submit methods on plugins that extend AggregatorPluginSettingsBase.
File
-
core/
modules/ aggregator/ tests/ src/ Unit/ Plugin/ AggregatorPluginSettingsBaseTest.php, line 85
Class
- AggregatorPluginSettingsBaseTest
- Tests settings configuration of individual aggregator plugins.
Namespace
Drupal\Tests\aggregator\Unit\PluginCode
public function testSettingsForm() {
// Emulate a form state of a submitted form.
$form_state = (new FormState())->setValues([
'dummy_length' => '',
'aggregator_allowed_html_tags' => '',
]);
$test_processor = $this->getMockBuilder('Drupal\\aggregator_test\\Plugin\\aggregator\\processor\\TestProcessor')
->onlyMethods([
'buildConfigurationForm',
'validateConfigurationForm',
'submitConfigurationForm',
])
->setConstructorArgs([
[],
'aggregator_test',
[
'description' => '',
],
$this->configFactory,
])
->getMock();
$test_processor->expects($this->once())
->method('buildConfigurationForm')
->with($this->anything(), $form_state)
->will($this->returnArgument(0));
$test_processor->expects($this->once())
->method('validateConfigurationForm')
->with($this->anything(), $form_state);
$test_processor->expects($this->once())
->method('submitConfigurationForm')
->with($this->anything(), $form_state);
$this->managers['processor']
->expects($this->once())
->method('createInstance')
->with($this->equalTo('aggregator_test'))
->willReturn($test_processor);
$form = $this->settingsForm
->buildForm([], $form_state);
$this->settingsForm
->validateForm($form, $form_state);
$this->settingsForm
->submitForm($form, $form_state);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.