Rebuild routes when quick form config entities are saved/deleted.
This commit is contained in:
parent
96b6002f5d
commit
0067c85215
|
@ -175,4 +175,20 @@ class QuickFormInstance extends ConfigEntityBase implements QuickFormInstanceInt
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritdoc}
|
||||||
|
*/
|
||||||
|
public function postSave(EntityStorageInterface $storage, $update = TRUE) {
|
||||||
|
parent::postSave($storage, $update);
|
||||||
|
\Drupal::service('router.builder')->setRebuildNeeded();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritdoc}
|
||||||
|
*/
|
||||||
|
public static function postDelete(EntityStorageInterface $storage, array $entities) {
|
||||||
|
parent::postDelete($storage, $entities);
|
||||||
|
\Drupal::service('router.builder')->setRebuildNeeded();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -146,6 +146,9 @@ class QuickFormTest extends FarmBrowserTestBase {
|
||||||
]);
|
]);
|
||||||
$config_entity->save();
|
$config_entity->save();
|
||||||
|
|
||||||
|
// Rebuild routes.
|
||||||
|
\Drupal::service('router.builder')->rebuildIfNeeded();
|
||||||
|
|
||||||
// Go to the quick form index and confirm that the requires_entity_test
|
// Go to the quick form index and confirm that the requires_entity_test
|
||||||
// quick form item is visible.
|
// quick form item is visible.
|
||||||
$this->drupalGet('quick');
|
$this->drupalGet('quick');
|
||||||
|
@ -157,6 +160,15 @@ class QuickFormTest extends FarmBrowserTestBase {
|
||||||
$this->drupalGet('quick/requires_entity_test');
|
$this->drupalGet('quick/requires_entity_test');
|
||||||
$this->assertSession()->statusCodeEquals(200);
|
$this->assertSession()->statusCodeEquals(200);
|
||||||
$this->assertSession()->pageTextContains($this->t('Test field'));
|
$this->assertSession()->pageTextContains($this->t('Test field'));
|
||||||
|
|
||||||
|
// Delete the config entity and confirm that it is removed.
|
||||||
|
$config_entity->delete();
|
||||||
|
\Drupal::service('router.builder')->rebuildIfNeeded();
|
||||||
|
$this->drupalGet('quick');
|
||||||
|
$this->assertSession()->statusCodeEquals(200);
|
||||||
|
$this->assertSession()->pageTextNotContains($this->t('Test requiresEntity quick form'));
|
||||||
|
$this->drupalGet('quick/requires_entity_test');
|
||||||
|
$this->assertSession()->statusCodeEquals(404);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue