Issue #3110296 by Hardik_Patel_12, longwave, Berdir: Remove all @deprecated code from Drupal/Core/Access/
parent
87df6a1d93
commit
b978479e86
|
@ -6,8 +6,6 @@ use Drupal\Core\Cache\Cache;
|
|||
use Drupal\Core\Cache\CacheableDependencyInterface;
|
||||
use Drupal\Core\Cache\RefinableCacheableDependencyInterface;
|
||||
use Drupal\Core\Cache\RefinableCacheableDependencyTrait;
|
||||
use Drupal\Core\Config\ConfigBase;
|
||||
use Drupal\Core\Entity\EntityInterface;
|
||||
use Drupal\Core\Session\AccountInterface;
|
||||
|
||||
/**
|
||||
|
@ -278,37 +276,6 @@ abstract class AccessResult implements AccessResultInterface, RefinableCacheable
|
|||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience method, adds the entity's cache tag.
|
||||
*
|
||||
* @param \Drupal\Core\Entity\EntityInterface $entity
|
||||
* The entity whose cache tag to set on the access result.
|
||||
*
|
||||
* @return $this
|
||||
*
|
||||
* @deprecated in drupal:8.0.0 and is removed from drupal:9.0.0. Use
|
||||
* ::addCacheableDependency() instead.
|
||||
*/
|
||||
public function cacheUntilEntityChanges(EntityInterface $entity) {
|
||||
return $this->addCacheableDependency($entity);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience method, adds the configuration object's cache tag.
|
||||
*
|
||||
* @param \Drupal\Core\Config\ConfigBase $configuration
|
||||
* The configuration object whose cache tag to set on the access result.
|
||||
*
|
||||
* @return $this
|
||||
*
|
||||
* @deprecated in drupal:8.0.0 and is removed from drupal:9.0.0. Use
|
||||
* \Drupal\Core\Access\AccessResult::addCacheableDependency() instead.
|
||||
*/
|
||||
public function cacheUntilConfigurationChanges(ConfigBase $configuration) {
|
||||
@trigger_error(__METHOD__ . ' is deprecated in drupal:8.0.0 and is removed in drupal:9.0.0. Use \Drupal\Core\Access\AccessResult::addCacheableDependency() instead.', E_USER_DEPRECATED);
|
||||
return $this->addCacheableDependency($configuration);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
|
|
|
@ -13,7 +13,6 @@ use Drupal\Core\Access\AccessResultNeutral;
|
|||
use Drupal\Core\Access\AccessResultReasonInterface;
|
||||
use Drupal\Core\Cache\Cache;
|
||||
use Drupal\Core\Cache\CacheableDependencyInterface;
|
||||
use Drupal\Core\Config\Config;
|
||||
use Drupal\Core\DependencyInjection\ContainerBuilder;
|
||||
use Drupal\Tests\UnitTestCase;
|
||||
|
||||
|
@ -969,21 +968,6 @@ class AccessResultTest extends UnitTestCase {
|
|||
return $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedDeprecation Drupal\Core\Access\AccessResult::cacheUntilConfigurationChanges is deprecated in drupal:8.0.0 and is removed in drupal:9.0.0. Use \Drupal\Core\Access\AccessResult::addCacheableDependency() instead.
|
||||
* @group legacy
|
||||
*/
|
||||
public function testCacheUntilConfigurationChanges() {
|
||||
$config = $this->prophesize(Config::class);
|
||||
$config->getCacheContexts()->willReturn(['context']);
|
||||
$config->getCacheTags()->willReturn(['tag']);
|
||||
$config->getCacheMaxAge()->willReturn(10);
|
||||
$access_result = AccessResult::neutral()->cacheUntilConfigurationChanges($config->reveal());
|
||||
$this->assertSame(['context'], $access_result->getCacheContexts());
|
||||
$this->assertSame(['tag'], $access_result->getCacheTags());
|
||||
$this->assertSame(10, $access_result->getCacheMaxAge());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class UncacheableTestAccessResult implements AccessResultInterface {
|
||||
|
|
Loading…
Reference in New Issue