private function RabbitHoleBehaviorSettingsEntityMethodsTest::behaviorSettingExceptionThrown in Rabbit Hole 2.x
Same name and namespace in other branches
- 8 tests/src/Functional/RabbitHoleBehaviorSettingsEntityMethodsTest.php \Drupal\Tests\rabbit_hole\Functional\RabbitHoleBehaviorSettingsEntityMethodsTest::behaviorSettingExceptionThrown()
Test that BehaviorSettingExceptions are thrown when we expect them to.
Test that a BehaviorSettingException gets thrown when $entity executes $method with $args. This uses call_user_func internally.
Parameters
\Drupal\rabbit_hole\Entity\BehaviorSettings $entity: The BehaviorSettings entity.
string $method: The method to call.
array $args: The arguments to pass to the method.
string $parent: The name of the method which calls this method.
3 calls to RabbitHoleBehaviorSettingsEntityMethodsTest::behaviorSettingExceptionThrown()
- RabbitHoleBehaviorSettingsEntityMethodsTest::testSetAllowOverride in tests/
src/ Functional/ RabbitHoleBehaviorSettingsEntityMethodsTest.php - Test that setAllowOverride works as expected.
- RabbitHoleBehaviorSettingsEntityMethodsTest::testSetRedirectCode in tests/
src/ Functional/ RabbitHoleBehaviorSettingsEntityMethodsTest.php - Test that setRedirectCode works as expected.
- RabbitHoleBehaviorSettingsEntityMethodsTest::testSetRedirectPath in tests/
src/ Functional/ RabbitHoleBehaviorSettingsEntityMethodsTest.php - Test that setRedirectPath works as expected.
File
- tests/
src/ Functional/ RabbitHoleBehaviorSettingsEntityMethodsTest.php, line 176
Class
- RabbitHoleBehaviorSettingsEntityMethodsTest
- Test the functionality of the rabbit hole form additions to the node form.
Namespace
Drupal\Tests\rabbit_hole\FunctionalCode
private function behaviorSettingExceptionThrown(BehaviorSettings $entity, $method, array $args, $parent) {
$exception_was_thrown = FALSE;
try {
call_user_func([
$entity,
$method,
], $args);
} catch (InvalidBehaviorSettingException $ex) {
$exception_was_thrown = TRUE;
}
$this
->assertTrue($exception_was_thrown, 'Exception thrown executing ' . $method . ', called from ' . $parent);
}