ComplexWorkflowTypeTest.php

Same filename in other branches
  1. 8.9.x core/modules/workflows/tests/src/Kernel/ComplexWorkflowTypeTest.php
  2. 10 core/modules/workflows/tests/src/Kernel/ComplexWorkflowTypeTest.php
  3. 11.x core/modules/workflows/tests/src/Kernel/ComplexWorkflowTypeTest.php

Namespace

Drupal\Tests\workflows\Kernel

File

core/modules/workflows/tests/src/Kernel/ComplexWorkflowTypeTest.php

View source
<?php

namespace Drupal\Tests\workflows\Kernel;

use Drupal\KernelTests\KernelTestBase;
use Drupal\workflows\Entity\Workflow;

/**
 * Workflow entity tests that require modules or storage.
 *
 * @coversDefaultClass \Drupal\workflow_type_test\Plugin\WorkflowType\ComplexTestType
 *
 * @group workflows
 */
class ComplexWorkflowTypeTest extends KernelTestBase {
    
    /**
     * {@inheritdoc}
     */
    protected static $modules = [
        'workflows',
        'workflow_type_test',
    ];
    
    /**
     * @covers \Drupal\workflows\Entity\Workflow::loadMultipleByType
     */
    public function testLoadMultipleByType() {
        $workflow1 = Workflow::create([
            'id' => 'test1',
            'type' => 'workflow_type_complex_test',
        ]);
        $workflow1->save();
        $workflow2 = Workflow::create([
            'id' => 'test2',
            'type' => 'workflow_type_complex_test',
        ]);
        $workflow2->save();
        $workflow3 = Workflow::create([
            'id' => 'test3',
            'type' => 'workflow_type_test',
        ]);
        $workflow3->save();
        $this->assertEquals([
            'test1',
            'test2',
        ], array_keys(Workflow::loadMultipleByType('workflow_type_complex_test')));
        $this->assertEquals([
            'test3',
        ], array_keys(Workflow::loadMultipleByType('workflow_type_test')));
        $this->assertEquals([], Workflow::loadMultipleByType('a_type_that_does_not_exist'));
    }

}

Classes

Title Deprecated Summary
ComplexWorkflowTypeTest Workflow entity tests that require modules or storage.

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.