public function YamlFormHandlerPluginTest::testYamlFormHandler in YAML Form 8
Tests form element plugin.
File
- src/
Tests/ YamlFormHandlerPluginTest.php, line 25
Class
- YamlFormHandlerPluginTest
- Tests for the form handler plugin.
Namespace
Drupal\yamlform\TestsCode
public function testYamlFormHandler() {
$yamlform = YamlForm::load('contact');
// Check initial dependencies.
$this
->assertEqual($yamlform
->getDependencies(), [
'module' => [
'yamlform',
],
]);
// Add 'debug' handler provided by the yamlform_devel.module.
$yamlform_handler_configuration = [
'id' => 'debug',
'label' => 'Debug',
'handler_id' => 'debug',
'status' => 1,
'weight' => 2,
'settings' => [],
];
$yamlform
->addYamlFormHandler($yamlform_handler_configuration);
$yamlform
->save();
// Check that handler has been added to the dependencies.
$this
->assertEqual($yamlform
->getDependencies(), [
'module' => [
'yamlform_devel',
'yamlform',
],
]);
// Uninstall the yamlform_devel.module which will also remove the
// debug handler.
$this->container
->get('module_installer')
->uninstall([
'yamlform_devel',
]);
$yamlform = YamlForm::load('contact');
// Check that handler was removed from the dependencies.
$this
->assertNotEqual($yamlform
->getDependencies(), [
'module' => [
'yamlform_devel',
'yamlform',
],
]);
$this
->assertEqual($yamlform
->getDependencies(), [
'module' => [
'yamlform',
],
]);
}