You are here

public function TransitionManagerTest::testValidate in Lightning Workflow 8.2

Same name and namespace in other branches
  1. 8.3 modules/lightning_scheduler/tests/src/Kernel/TransitionManagerTest.php \Drupal\Tests\lightning_scheduler\Kernel\TransitionManagerTest::testValidate()

@covers ::validate

@dataProvider providerValidate

File

modules/lightning_scheduler/tests/src/Kernel/TransitionManagerTest.php, line 50

Class

TransitionManagerTest
@coversDefaultClass \Drupal\lightning_scheduler\TransitionManager

Namespace

Drupal\Tests\lightning_scheduler\Kernel

Code

public function testValidate($value, $expect_errors) {
  $element = [
    '#value' => Json::encode($value),
    '#name' => 'test_element',
    '#parents' => [
      'test_element',
    ],
  ];
  $form_state = new FormState();
  $form_state
    ->setFormObject($this
    ->prophesize(FormInterface::class)
    ->reveal());
  TransitionManager::validate($element, $form_state);
  $this
    ->assertSame($expect_errors, FormState::hasAnyErrors());
}