private function RabbitHoleBehaviorSettingsTest::saveAndTestExpectedValues in Rabbit Hole 8
Same name and namespace in other branches
- 2.x tests/src/Functional/RabbitHoleBehaviorSettingsTest.php \Drupal\Tests\rabbit_hole\Functional\RabbitHoleBehaviorSettingsTest::saveAndTestExpectedValues()
 
Helper function to test saving and confirming config.
2 calls to RabbitHoleBehaviorSettingsTest::saveAndTestExpectedValues()
- RabbitHoleBehaviorSettingsTest::testBundleSettings in tests/
src/ Functional/ RabbitHoleBehaviorSettingsTest.php  - Test that a BehaviourSettings can be given an ID and found later.
 - RabbitHoleBehaviorSettingsTest::testSettings in tests/
src/ Functional/ RabbitHoleBehaviorSettingsTest.php  - Test that a BehaviorSettings can be found and contains correct values.
 
File
- tests/
src/ Functional/ RabbitHoleBehaviorSettingsTest.php, line 133  
Class
- RabbitHoleBehaviorSettingsTest
 - Test the RabbitHoleBehaviorSettings configuration entity functionality.
 
Namespace
Drupal\Tests\rabbit_hole\FunctionalCode
private function saveAndTestExpectedValues($expected_action, $calling_method, $entity_type_label = '', $entity_id = NULL) {
  // Delete key if it already exists.
  $editable = $this->behaviorSettingsManager
    ->loadBehaviorSettingsAsEditableConfig($entity_type_label, $entity_id);
  if (isset($editable)) {
    $editable
      ->delete();
  }
  $this->behaviorSettingsManager
    ->saveBehaviorSettings([
    'action' => $expected_action,
    'allow_override' => 0,
    'redirect_code' => 0,
    'redirect' => '',
  ], $entity_type_label, $entity_id);
  $action = $this->behaviorSettingsManager
    ->loadBehaviorSettingsAsConfig($entity_type_label, $entity_id)
    ->get('action');
  $this
    ->assertEquals($expected_action, $action, 'Unexpected action ' . ' (called from ' . $calling_method . ')');
  // Clean up the entity afterwards.
  $this->behaviorSettingsManager
    ->loadBehaviorSettingsAsEditableConfig($entity_type_label, $entity_id)
    ->delete();
}