public function PluginTestBase::testInvalidExpressions in Purge 8.3
Test if all invalid string expressions fail to instantiate the object.
See also
\Drupal\purge\Plugin\Purge\Invalidation\InvalidationInterface::__construct
File
- tests/
src/ Kernel/ Invalidation/ PluginTestBase.php, line 427
Class
- PluginTestBase
- Provides an abstract test class to thoroughly test invalidation types.
Namespace
Drupal\Tests\purge\Kernel\InvalidationCode
public function testInvalidExpressions() : void {
foreach ($this->expressionsInvalid as $exp) {
$thrown = FALSE;
try {
$this->purgeInvalidationFactory
->get($this->pluginId, $exp);
} catch (\Exception $e) {
$thrown = $e;
}
if (is_null($exp)) {
$this
->assertInstanceOf(MissingExpressionException::class, $thrown);
}
else {
$this
->assertInstanceOf(InvalidExpressionException::class, $thrown);
}
}
}