/** * @covers ::postDelete */ public function testPostDelete() { $this->cacheTagsInvalidator->expects($this->once())->method('invalidateTags')->with(array($this->entityTypeId . ':' . $this->values['id'], $this->entityTypeId . '_list')); $storage = $this->getMock('\\Drupal\\Core\\Entity\\EntityStorageInterface'); $storage->expects($this->once())->method('getEntityType')->willReturn($this->entityType); $entities = array($this->values['id'] => $this->entity); $this->entity->postDelete($storage, $entities); }
/** * @covers ::postDelete */ public function testPostDelete() { $this->cacheBackend->expects($this->once())->method('invalidateTags')->with(array($this->entityTypeId => array($this->values['id']), $this->entityTypeId . 's' => TRUE)); $storage = $this->getMock('\\Drupal\\Core\\Entity\\EntityStorageInterface'); $entity = $this->getMockBuilder('\\Drupal\\Core\\Entity\\Entity')->setConstructorArgs(array($this->values, $this->entityTypeId))->setMethods(array('onSaveOrDelete'))->getMock(); $entity->expects($this->once())->method('onSaveOrDelete'); $entities = array($this->values['id'] => $entity); $this->entity->postDelete($storage, $entities); }
/** * {@inheritdoc} */ public static function postDelete(EntityStorageInterface $storage, array $entities) { parent::postDelete($storage, $entities); // Update the has_children status of the parent. foreach ($entities as $entity) { if (!$storage->getPreventReparenting()) { $storage->updateParentalStatus($entity); } } // Also clear the menu system static caches. menu_reset_static_cache(); _menu_update_expanded_menus(); }