You are here

public function TransitionManagerTest::providerValidate 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::providerValidate()

Data provider for ::testValidate().

Return value

array

File

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

Class

TransitionManagerTest
@coversDefaultClass \Drupal\lightning_scheduler\TransitionManager

Namespace

Drupal\Tests\lightning_scheduler\Kernel

Code

public function providerValidate() {
  return [
    'empty string' => [
      '',
      TRUE,
    ],
    'null' => [
      NULL,
      TRUE,
    ],
    'boolean false' => [
      FALSE,
      TRUE,
    ],
    'boolean true' => [
      TRUE,
      TRUE,
    ],
    'random string' => [
      $this
        ->randomString(128),
      TRUE,
    ],
    'integer' => [
      123,
      TRUE,
    ],
    'empty array' => [
      [],
      FALSE,
    ],
    'valid time, missing date' => [
      [
        'when' => '08:57',
      ],
      TRUE,
    ],
    'valid date, missing time' => [
      [
        [
          'state' => 'fubar',
          'when' => '1984-09-19',
        ],
      ],
      FALSE,
    ],
    'valid time, invalid date' => [
      [
        [
          'when' => '1938-37-12 08:57',
        ],
      ],
      TRUE,
    ],
    'valid date, invalid time' => [
      [
        [
          'when' => '1984-09-19 26:39',
        ],
      ],
      TRUE,
    ],
    'invalid date and time' => [
      [
        [
          'when' => '1938-37-12 26:39',
        ],
      ],
      TRUE,
    ],
    'valid date and time, invalid order' => [
      [
        [
          'state' => 'fubar',
          'when' => '2018-11-05 15:42',
        ],
        [
          'state' => 'fubar',
          'when' => '2018-09-04 02:30',
        ],
      ],
      TRUE,
    ],
    'valid same dates, valid times, invalid order' => [
      [
        [
          'state' => 'fubar',
          'when' => '2022-09-19 06:30',
        ],
        [
          'state' => 'fubar',
          'when' => '2022-09-19 04:46',
        ],
      ],
      TRUE,
    ],
    'valid different dates' => [
      [
        [
          'state' => 'fubar',
          'when' => '2022-09-04 02:30',
        ],
        [
          'state' => 'fubar',
          'when' => '2022-11-05 15:42',
        ],
      ],
      FALSE,
    ],
    'valid same dates, different times' => [
      [
        [
          'state' => 'fubar',
          'when' => '2022-09-19 02:30',
        ],
        [
          'state' => 'fubar',
          'when' => '2022-09-19 15:42',
        ],
      ],
      FALSE,
    ],
  ];
}