WorkflowDependenciesTest.php in Drupal 9
File
core/modules/workflows/tests/src/Kernel/WorkflowDependenciesTest.php
View source
<?php
namespace Drupal\Tests\workflows\Kernel;
use Drupal\KernelTests\KernelTestBase;
use Drupal\workflows\Entity\Workflow;
class WorkflowDependenciesTest extends KernelTestBase {
protected static $modules = [
'system',
'workflows',
'workflow_type_test',
'workflow_third_party_settings_test',
];
public function testOnDependencyRemoval() {
$workflow = Workflow::create([
'id' => 'test3',
'type' => 'workflow_type_complex_test',
]);
$workflow
->setThirdPartySetting('workflow_third_party_settings_test', 'key', 'value');
$workflow
->save();
$this
->assertSame([
'workflow_third_party_settings_test',
'workflow_type_test',
], $workflow
->getDependencies()['module']);
\Drupal::service('module_installer')
->uninstall([
'node',
'workflow_third_party_settings_test',
]);
$workflow = \Drupal::entityTypeManager()
->getStorage('workflow')
->loadUnchanged($workflow
->id());
$this
->assertSame([
'workflow_type_test',
], $workflow
->getDependencies()['module']);
}
}