3 namespace Drupal\Tests\workflows\Functional;
5 use Drupal\Tests\BrowserTestBase;
8 * Tests workflow UI when there are no types.
12 class WorkflowUiNoTypeTest extends BrowserTestBase {
19 public static $modules = ['workflows', 'block'];
24 protected function setUp() {
26 // We're testing local actions.
27 $this->drupalPlaceBlock('local_actions_block');
31 * Tests the creation of a workflow through the UI.
33 public function testWorkflowUiWithNoType() {
34 $this->drupalLogin($this->createUser(['access administration pages', 'administer workflows']));
35 $this->drupalGet('admin/config/workflow/workflows/add');
36 // There are no workflow types so this should be a 403.
37 $this->assertSession()->statusCodeEquals(403);
39 $this->drupalGet('admin/config/workflow/workflows');
40 $this->assertSession()->pageTextContains('There are no workflow types available. In order to create workflows you need to install a module that provides a workflow type. For example, the Content Moderation module provides a workflow type that enables workflows for content entities.');
41 $this->assertSession()->pageTextNotContains('Add workflow');
43 $this->container->get('module_installer')->install(['workflow_type_test']);
44 // The render cache needs to be cleared because although the cache tags are
45 // correctly set the render cache does not pick it up.
46 \Drupal::cache('render')->deleteAll();
48 $this->drupalGet('admin/config/workflow/workflows');
49 $this->assertSession()->pageTextNotContains('There are no workflow types available. In order to create workflows you need to install a module that provides a workflow type. For example, the Content Moderation module provides a workflow type that enables workflows for content entities.');
50 $this->assertSession()->linkExists('Add workflow');
51 $this->assertSession()->pageTextContains('There is no Workflow yet.');