You are here

public function PluginTestBase::testStateSwitchGoodBehavior in Purge 8.3

Test switching away from the acceptable states.

See also

\Drupal\purge\Plugin\Purge\Invalidation\InvalidationInterface::setStateContext

File

tests/src/Kernel/Invalidation/PluginTestBase.php, line 256

Class

PluginTestBase
Provides an abstract test class to thoroughly test invalidation types.

Namespace

Drupal\Tests\purge\Kernel\Invalidation

Code

public function testStateSwitchGoodBehavior() : void {
  $i = $this
    ->getInstance();
  $i
    ->setStateContext('failingpurger');
  $i
    ->setState(InvalidationInterface::NOT_SUPPORTED);
  $i
    ->setStateContext(NULL);
  $i
    ->setStateContext('failingpurger');
  $i
    ->setState(InvalidationInterface::PROCESSING);
  $i
    ->setStateContext(NULL);
  $i
    ->setStateContext('failingpurger');
  $i
    ->setState(InvalidationInterface::SUCCEEDED);
  $i
    ->setStateContext(NULL);
  $i
    ->setStateContext('failingpurger');
  $i
    ->setState(InvalidationInterface::FAILED);
  $i
    ->setStateContext(NULL);
  $this
    ->assertSame([
    'failingpurger',
  ], $i
    ->getStateContexts());
}