You are here

public function FeedTypeAccessControlHandlerTest::setUp in Feeds 8.3

Overrides FeedsUnitTestCase::setUp

File

tests/src/Unit/FeedTypeAccessControlHandlerTest.php, line 21

Class

FeedTypeAccessControlHandlerTest
@coversDefaultClass \Drupal\feeds\FeedTypeAccessControlHandler @group feeds

Namespace

Drupal\Tests\feeds\Unit

Code

public function setUp() {
  parent::setUp();
  $cache_contexts_manager = $this
    ->prophesize(CacheContextsManager::class);
  $cache_contexts_manager
    ->assertValidTokens()
    ->willReturn(TRUE);
  $cache_contexts_manager
    ->reveal();
  $container = new Container();
  $container
    ->set('cache_contexts_manager', $cache_contexts_manager);
  \Drupal::setContainer($container);
  $this->entity = $this
    ->prophesize(FeedTypeInterface::class);
  $this->account = $this
    ->prophesize(AccountInterface::class);
  $this->account
    ->hasPermission('administer feeds')
    ->willReturn(TRUE);
  $entity_type = $this
    ->prophesize(EntityTypeInterface::class);
  $entity_type
    ->getAdminPermission()
    ->willReturn('administer feeds');
  $entity_type
    ->id()
    ->willReturn('feed_type');
  $this->controller = new FeedTypeAccessControlHandler($entity_type
    ->reveal());
}