public function AggregatorPluginSettingsBaseTest::testSettingsForm in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/modules/aggregator/tests/src/Unit/Plugin/AggregatorPluginSettingsBaseTest.php \Drupal\Tests\aggregator\Unit\Plugin\AggregatorPluginSettingsBaseTest::testSettingsForm()
Test 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 78 - Contains \Drupal\Tests\aggregator\Unit\Plugin\AggregatorPluginSettingsBaseTest.
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
->getMock('Drupal\\aggregator_test\\Plugin\\aggregator\\processor\\TestProcessor', array(
'buildConfigurationForm',
'validateConfigurationForm',
'submitConfigurationForm',
), array(
array(),
'aggregator_test',
array(
'description' => '',
),
$this->configFactory,
));
$test_processor
->expects($this
->at(0))
->method('buildConfigurationForm')
->with($this
->anything(), $form_state)
->will($this
->returnArgument(0));
$test_processor
->expects($this
->at(1))
->method('validateConfigurationForm')
->with($this
->anything(), $form_state);
$test_processor
->expects($this
->at(2))
->method('submitConfigurationForm')
->with($this
->anything(), $form_state);
$this->managers['processor']
->expects($this
->once())
->method('createInstance')
->with($this
->equalTo('aggregator_test'))
->will($this
->returnValue($test_processor));
$form = $this->settingsForm
->buildForm(array(), $form_state);
$this->settingsForm
->validateForm($form, $form_state);
$this->settingsForm
->submitForm($form, $form_state);
}