/**
  * {@inheritdoc}
  */
 protected function setUp()
 {
     parent::setUp();
     $configuration = ['test_foo_settings' => ['collection' => 'test-23', 'cache_backend_class' => '\\Drupal\\Tests\\Component\\FileCache\\StaticFileCacheBackend', 'cache_backend_configuration' => ['bin' => 'dog']]];
     FileCacheFactory::setConfiguration($configuration);
     FileCacheFactory::setPrefix('prefix');
 }
 /**
  * {@inheritdoc}
  */
 protected function setUp()
 {
     parent::setUp();
     // Mock a Discovery object to replace AnnotationClassDiscovery.
     $this->discovery = $this->getMock('Drupal\\Component\\Plugin\\Discovery\\DiscoveryInterface');
     $this->discovery->expects($this->any())->method('getDefinitions')->will($this->returnValue($this->definitions));
 }
 /**
  * {@inheritdoc}
  */
 protected function setUp()
 {
     parent::setUp();
     $this->requestStack = new RequestStack();
     $this->pathProcessor = $this->getMock('Drupal\\Core\\PathProcessor\\OutboundPathProcessorInterface');
     $this->unroutedUrlAssembler = new UnroutedUrlAssembler($this->requestStack, $this->pathProcessor);
 }
 /**
  * {@inheritdoc}
  */
 public function setUp()
 {
     parent::setUp();
     $this->key = Crypt::randomBytesBase64(55);
     $this->state = $this->getMock('Drupal\\Core\\State\\StateInterface');
     $this->privateKey = new PrivateKey($this->state);
 }
Beispiel #5
0
 /**
  * {@inheritdoc}
  */
 protected function setUp()
 {
     parent::setUp();
     $this->migration = $this->prophesize(MigrationInterface::class);
     $this->storage = $this->prophesize(EntityStorageInterface::class);
     $this->entityManager = $this->prophesize(EntityManagerInterface::class);
 }
Beispiel #6
0
  /**
   * Creates a new processor object for use in the tests.
   */
  protected function setUp() {
    parent::setUp();

    // Create a mock for the URL to be returned.
    $url = $this->getMockBuilder('Drupal\Core\Url')
      ->disableOriginalConstructor()
      ->getMock();
    $url->expects($this->any())
      ->method('toString')
      ->will($this->returnValue('http://www.example.com/node/example'));

    // Mock the data source of the indexer to return the mocked url object.
    $datasource = $this->getMock('Drupal\search_api\Datasource\DatasourceInterface');
    $datasource->expects($this->any())
      ->method('getItemUrl')
      ->withAnyParameters()
      ->will($this->returnValue($url));

    // Create a mock for the index to return the datasource mock.
    /** @var \Drupal\search_api\IndexInterface $index */
    $index = $this->index = $this->getMock('Drupal\search_api\IndexInterface');
    $this->index->expects($this->any())
      ->method('getDatasource')
      ->with('entity:node')
      ->will($this->returnValue($datasource));

    // Create the tested processor and set the mocked indexer.
    $this->processor = new AddURL(array(), 'add_url', array());
    $this->processor->setIndex($index);
    /** @var \Drupal\Core\StringTranslation\TranslationInterface $translation */
    $translation = $this->getStringTranslationStub();
    $this->processor->setStringTranslation($translation);
  }
Beispiel #7
0
 /**
  * {@inheritdoc}
  */
 protected function setUp()
 {
     parent::setUp();
     // TODO: Change the autogenerated stub
     $condition_plugin_manager = $this->getMock('Drupal\\Core\\Executable\\ExecutableManagerInterface');
     $condition_plugin_manager->expects($this->any())->method('getDefinitions')->will($this->returnValue(array()));
     $container = new ContainerBuilder();
     $container->set('plugin.manager.condition', $condition_plugin_manager);
     \Drupal::setContainer($container);
     $this->executable = $this->getMockBuilder('Drupal\\views\\ViewExecutable')->disableOriginalConstructor()->setMethods(['buildRenderable', 'setDisplay', 'setItemsPerPage'])->getMock();
     $this->executable->expects($this->any())->method('setDisplay')->with('block_1')->will($this->returnValue(TRUE));
     $this->executable->expects($this->any())->method('getShowAdminLinks')->willReturn(FALSE);
     $this->executable->display_handler = $this->getMockBuilder('Drupal\\views\\Plugin\\views\\display\\Block')->disableOriginalConstructor()->setMethods(NULL)->getMock();
     $this->view = $this->getMockBuilder('Drupal\\views\\Entity\\View')->disableOriginalConstructor()->getMock();
     $this->view->expects($this->any())->method('id')->willReturn('test_view');
     $this->executable->storage = $this->view;
     $this->executableFactory = $this->getMockBuilder('Drupal\\views\\ViewExecutableFactory')->disableOriginalConstructor()->getMock();
     $this->executableFactory->expects($this->any())->method('get')->with($this->view)->will($this->returnValue($this->executable));
     $this->displayHandler = $this->getMockBuilder('Drupal\\views\\Plugin\\views\\display\\Block')->disableOriginalConstructor()->getMock();
     $this->displayHandler->expects($this->any())->method('blockSettings')->willReturn([]);
     $this->displayHandler->expects($this->any())->method('getPluginId')->willReturn('block');
     $this->executable->display_handler = $this->displayHandler;
     $this->storage = $this->getMockBuilder('Drupal\\Core\\Config\\Entity\\ConfigEntityStorage')->disableOriginalConstructor()->getMock();
     $this->storage->expects($this->any())->method('load')->with('test_view')->will($this->returnValue($this->view));
     $this->account = $this->getMock('Drupal\\Core\\Session\\AccountInterface');
 }
 /**
  * {@inheritdoc}
  */
 protected function setUp()
 {
     parent::setUp();
     $this->accessManager = $this->getMock('\\Drupal\\Core\\Access\\AccessManagerInterface');
     $this->currentUser = $this->getMock('Drupal\\Core\\Session\\AccountInterface');
     $this->defaultMenuTreeManipulators = new DefaultMenuLinkTreeManipulators($this->accessManager, $this->currentUser);
 }
 protected function setUp()
 {
     parent::setUp();
     // Set up three memory backends to be used in the chain.
     $this->firstBackend = new MemoryBackend('foo');
     $this->secondBackend = new MemoryBackend('bar');
     $this->thirdBackend = new MemoryBackend('baz');
     // Set an initial fixed dataset for all testing. The next three data
     // collections will test two edge cases (last backend has the data, and
     // first backend has the data) and will test a normal use case (middle
     // backend has the data). We should have a complete unit test with those.
     // Note that in all cases, when the same key is set on more than one
     // backend, the values are voluntarily different, this ensures in which
     // backend we actually fetched the key when doing get calls.
     // Set a key present on all backends (for delete).
     $this->firstBackend->set('t123', 1231);
     $this->secondBackend->set('t123', 1232);
     $this->thirdBackend->set('t123', 1233);
     // Set a key present on the second and the third (for get), those two will
     // be different, this will ensure from where we get the key.
     $this->secondBackend->set('t23', 232);
     $this->thirdBackend->set('t23', 233);
     // Set a key on only the third, we will ensure propagation using this one.
     $this->thirdBackend->set('t3', 33);
     // Create the chain.
     $this->chain = new BackendChain('foobarbaz');
     $this->chain->appendBackend($this->firstBackend)->appendBackend($this->secondBackend)->appendBackend($this->thirdBackend);
 }
Beispiel #10
0
 /**
  * Creates a new processor object for use in the tests.
  */
 protected function setUp()
 {
     parent::setUp();
     $this->processor = new RoleFilter(array(), 'role_filter', array());
     /** @var \Drupal\search_api\IndexInterface $index */
     $index = $this->getMock('Drupal\\search_api\\IndexInterface');
     $node_datasource = $this->getMock('Drupal\\search_api\\Datasource\\DatasourceInterface');
     $node_datasource->expects($this->any())->method('getEntityTypeId')->will($this->returnValue('node'));
     /** @var \Drupal\search_api\Datasource\DatasourceInterface $node_datasource */
     $user_datasource = $this->getMock('Drupal\\search_api\\Datasource\\DatasourceInterface');
     $user_datasource->expects($this->any())->method('getEntityTypeId')->will($this->returnValue('user'));
     /** @var \Drupal\search_api\Datasource\DatasourceInterface $user_datasource */
     $item = Utility::createItem($index, Utility::createCombinedId('entity:node', '1:en'), $node_datasource);
     $node = $this->getMockBuilder('Drupal\\Tests\\search_api\\TestNodeInterface')->disableOriginalConstructor()->getMock();
     /** @var \Drupal\node\NodeInterface $node */
     $item->setOriginalObject(EntityAdapter::createFromEntity($node));
     $this->items[$item->getId()] = $item;
     $item = Utility::createItem($index, Utility::createCombinedId('entity:user', '1:en'), $user_datasource);
     $account1 = $this->getMockBuilder('Drupal\\Tests\\search_api\\TestUserInterface')->disableOriginalConstructor()->getMock();
     $account1->expects($this->any())->method('getRoles')->will($this->returnValue(array('authenticated' => 'authenticated', 'editor' => 'editor')));
     /** @var \Drupal\user\UserInterface $account1 */
     $item->setOriginalObject(EntityAdapter::createFromEntity($account1));
     $this->items[$item->getId()] = $item;
     $item = Utility::createItem($index, Utility::createCombinedId('entity:user', '2:en'), $user_datasource);
     $account2 = $this->getMockBuilder('Drupal\\Tests\\search_api\\TestUserInterface')->disableOriginalConstructor()->getMock();
     $account2->expects($this->any())->method('getRoles')->will($this->returnValue(array('authenticated' => 'authenticated')));
     /** @var \Drupal\user\UserInterface $account2 */
     $item->setOriginalObject(EntityAdapter::createFromEntity($account2));
     $this->items[$item->getId()] = $item;
 }
 /**
  * {@inheritdoc}
  */
 protected function setUp()
 {
     parent::setUp();
     $this->formBuilder = $this->getMock('Drupal\\Core\\Form\\FormBuilderInterface');
     $this->entityManager = $this->getMock('Drupal\\Core\\Entity\\EntityManagerInterface');
     $this->entityFormBuilder = new EntityFormBuilder($this->entityManager, $this->formBuilder);
 }
 public function setUp()
 {
     parent::setUp();
     $this->redirectDestination = $this->getMock(RedirectDestinationInterface::class);
     $this->stringTranslation = $this->getStringTranslationStub();
     $this->sut = new FixedRatesOperationsProvider($this->stringTranslation, $this->redirectDestination);
 }
 /**
  * {@inheritdoc}
  */
 protected function setUp()
 {
     parent::setUp();
     $this->entityTypeId = 'workspace';
     $first_machine_name = $this->randomMachineName();
     $second_machine_name = $this->randomMachineName();
     $this->values = [['machine_name' => $first_machine_name], ['machine_name' => $second_machine_name]];
     $this->entityType = $this->getMock('Drupal\\multiversion\\Entity\\WorkspaceInterface');
     $this->entityManager = $this->getMock('Drupal\\Core\\Entity\\EntityManagerInterface');
     $this->cacheRender = $this->getMock('Drupal\\Core\\Cache\\CacheBackendInterface');
     $this->entityManager->expects($this->any())->method('getDefinition')->with($this->entityTypeId)->will($this->returnValue($this->entityType));
     $this->requestStack = $this->getMock('Symfony\\Component\\HttpFoundation\\RequestStack');
     $container = new ContainerBuilder();
     $container->set('entity.manager', $this->entityManager);
     $container->set('request_stack', $this->requestStack);
     $container->set('cache.render', $this->cacheRender);
     \Drupal::setContainer($container);
     foreach ($this->values as $value) {
         $entity = $this->getMockBuilder('Drupal\\multiversion\\Entity\\Workspace')->disableOriginalConstructor()->getMock();
         $entity->expects($this->any())->method('create')->with($value)->will($this->returnValue($this->entityType));
         $this->entities[] = $entity;
     }
     $this->workspaceNegotiators[] = array($this->getMock('Drupal\\multiversion\\Workspace\\DefaultWorkspaceNegotiator'));
     $this->workspaceNegotiators[] = array($this->getMock('Drupal\\multiversion\\Workspace\\SessionWorkspaceNegotiator'));
 }
Beispiel #14
0
 /**
  * {@inheritdoc}
  */
 protected function setUp()
 {
     parent::setUp();
     $this->cacheTagsInvalidator = $this->getMock('Drupal\\Core\\Cache\\CacheTagsInvalidatorInterface');
     $this->libraryDiscoveryCollector = $this->getMockBuilder('Drupal\\Core\\Asset\\LibraryDiscoveryCollector')->disableOriginalConstructor()->getMock();
     $this->libraryDiscovery = new LibraryDiscovery($this->libraryDiscoveryCollector, $this->cacheTagsInvalidator);
 }
 /**
  * {@inheritdoc}
  */
 public function setUp()
 {
     parent::setUp();
     $this->route = new Route('test');
     $this->accessManager = $this->getMock('Drupal\\Core\\Access\\AccessManagerInterface');
     $this->currentUser = $this->getMock('Drupal\\Core\\Session\\AccountInterface');
 }
Beispiel #16
0
 /**
  * {@inheritdoc}
  */
 protected function setUp()
 {
     parent::setUp();
     $settings = [];
     $settings['extension_discovery_scan_tests'] = TRUE;
     new Settings($settings);
 }
 /**
  * {@inheritdoc}
  */
 protected function setUp()
 {
     parent::setUp();
     new Settings(array('hash_salt' => 'test'));
     // The mocked super user account, with the same roles as Account 2.
     $this->account1 = $this->getMockBuilder('Drupal\\user\\Entity\\User')->disableOriginalConstructor()->setMethods(array('getRoles', 'id'))->getMock();
     $this->account1->expects($this->any())->method('id')->willReturn(1);
     $this->account1->expects($this->never())->method('getRoles');
     // Account 2: 'administrator' and 'authenticated' roles.
     $roles_1 = array('administrator', 'authenticated');
     $this->account2 = $this->getMockBuilder('Drupal\\user\\Entity\\User')->disableOriginalConstructor()->setMethods(array('getRoles', 'id'))->getMock();
     $this->account2->expects($this->any())->method('getRoles')->will($this->returnValue($roles_1));
     $this->account2->expects($this->any())->method('id')->willReturn(2);
     // Account 3: 'authenticated' and 'administrator' roles (different order).
     $roles_3 = array('authenticated', 'administrator');
     $this->account3 = $this->getMockBuilder('Drupal\\user\\Entity\\User')->disableOriginalConstructor()->setMethods(array('getRoles', 'id'))->getMock();
     $this->account3->expects($this->any())->method('getRoles')->will($this->returnValue($roles_3));
     $this->account3->expects($this->any())->method('id')->willReturn(3);
     // Updated account 2: now also 'editor' role.
     $roles_2_updated = array('editor', 'administrator', 'authenticated');
     $this->account2Updated = $this->getMockBuilder('Drupal\\user\\Entity\\User')->disableOriginalConstructor()->setMethods(array('getRoles', 'id'))->getMock();
     $this->account2Updated->expects($this->any())->method('getRoles')->will($this->returnValue($roles_2_updated));
     $this->account2Updated->expects($this->any())->method('id')->willReturn(2);
     // Mocked private key + cache services.
     $random = Crypt::randomBytesBase64(55);
     $this->privateKey = $this->getMockBuilder('Drupal\\Core\\PrivateKey')->disableOriginalConstructor()->setMethods(array('get'))->getMock();
     $this->privateKey->expects($this->any())->method('get')->will($this->returnValue($random));
     $this->cache = $this->getMockBuilder('Drupal\\Core\\Cache\\CacheBackendInterface')->disableOriginalConstructor()->getMock();
     $this->staticCache = $this->getMockBuilder('Drupal\\Core\\Cache\\CacheBackendInterface')->disableOriginalConstructor()->getMock();
     $this->permissionsHash = new PermissionsHashGenerator($this->privateKey, $this->cache, $this->staticCache);
 }
Beispiel #18
0
 /**
  * {@inheritdoc}
  */
 protected function setUp()
 {
     parent::setUp();
     $storage = $this->getMockBuilder('\\Symfony\\Component\\HttpFoundation\\Session\\Storage\\MockArraySessionStorage')->setMethods(NULL)->getMock();
     $this->session = $this->getMockBuilder('\\Symfony\\Component\\HttpFoundation\\Session\\Session')->setConstructorArgs(array($storage))->setMethods(NULL)->getMock();
     $this->session->start();
 }
 /**
  * {@inheritdoc}
  */
 protected function setUp()
 {
     parent::setUp();
     $this->requestStack = $this->getMock('\\Symfony\\Component\\HttpFoundation\\RequestStack');
     $this->connection = $this->getMockBuilder('\\Drupal\\Core\\Database\\Connection')->disableOriginalConstructor()->getMock();
     $this->casHelper = $this->getMockBuilder('\\Drupal\\cas\\Service\\CasHelper')->disableOriginalConstructor()->getMock();
 }
Beispiel #20
0
  /**
   * {@inheritdoc}
   */
  public function setUp() {
    parent::setUp();

    $this->aliasProcessor = $this->getMockBuilder('Drupal\Core\PathProcessor\PathProcessorAlias')
      ->disableOriginalConstructor()
      ->getMock();

    $this->languageManager = $this->getMock('Drupal\Core\Language\LanguageManagerInterface');
    $this->languageManager->expects($this->any())
      ->method('getCurrentLanguage')
      ->willReturn(new Language(Language::$defaultValues));

    $this->pathValidator = $this->getMock('Drupal\Core\Path\PathValidatorInterface');

    $this->subPathautoSettings = $this->getMock('Drupal\Core\Config\ConfigBase');

    $this->configFactory = $this->getMock('Drupal\Core\Config\ConfigFactoryInterface');
    $this->configFactory->expects($this->any())
      ->method('get')
      ->with('subpathauto.settings')
      ->willReturn($this->subPathautoSettings);

    $this->sut = new PathProcessor($this->aliasProcessor, $this->languageManager, $this->configFactory);
    $this->sut->setPathValidator($this->pathValidator);
  }
 /**
  * {@inheritdoc}
  */
 protected function setUp()
 {
     parent::setUp();
     $this->container = new ContainerBuilder();
     $cache_contexts_manager = $this->prophesize(CacheContextsManager::class)->reveal();
     $this->container->set('cache_contexts_manager', $cache_contexts_manager);
     \Drupal::setContainer($this->container);
     $this->routeCollection = new RouteCollection();
     $this->routeCollection->add('test_route_1', new Route('/test-route-1'));
     $this->routeCollection->add('test_route_2', new Route('/test-route-2', array(), array('_access' => 'TRUE')));
     $this->routeCollection->add('test_route_3', new Route('/test-route-3', array(), array('_access' => 'FALSE')));
     $this->routeCollection->add('test_route_4', new Route('/test-route-4/{value}', array(), array('_access' => 'TRUE')));
     $this->routeProvider = $this->getMock('Drupal\\Core\\Routing\\RouteProviderInterface');
     $map = array();
     foreach ($this->routeCollection->all() as $name => $route) {
         $map[] = array($name, array(), $route);
     }
     $map[] = array('test_route_4', array('value' => 'example'), $this->routeCollection->get('test_route_4'));
     $this->routeProvider->expects($this->any())->method('getRouteByName')->will($this->returnValueMap($map));
     $map = array();
     $map[] = array('test_route_1', array(), '/test-route-1');
     $map[] = array('test_route_2', array(), '/test-route-2');
     $map[] = array('test_route_3', array(), '/test-route-3');
     $map[] = array('test_route_4', array('value' => 'example'), '/test-route-4/example');
     $this->paramConverter = $this->getMock('Drupal\\Core\\ParamConverter\\ParamConverterManagerInterface');
     $this->account = $this->getMock('Drupal\\Core\\Session\\AccountInterface');
     $this->currentUser = $this->getMock('Drupal\\Core\\Session\\AccountInterface');
     $this->argumentsResolverFactory = $this->getMock('Drupal\\Core\\Access\\AccessArgumentsResolverFactoryInterface');
     $this->checkProvider = new CheckProvider();
     $this->checkProvider->setContainer($this->container);
     $this->accessManager = new AccessManager($this->routeProvider, $this->paramConverter, $this->argumentsResolverFactory, $this->currentUser, $this->checkProvider);
 }
Beispiel #22
0
 /**
  * {@inheritdoc}
  */
 protected function setUp()
 {
     parent::setUp();
     $property = new \ReflectionProperty('Drupal\\Component\\Utility\\Html', 'seenIdsInit');
     $property->setAccessible(TRUE);
     $property->setValue(NULL);
 }
Beispiel #23
0
 /**
  * {@inheritdoc}
  */
 protected function setUp()
 {
     parent::setUp();
     $map = array();
     $map[] = array('view.frontpage.page_1', array(), array(), FALSE, '/node');
     $map[] = array('node_view', array('node' => '1'), array(), FALSE, '/node/1');
     $map[] = array('node_edit', array('node' => '2'), array(), FALSE, '/node/2/edit');
     $this->map = $map;
     $alias_map = array(array('node-alias-test', NULL, FALSE, 'node'), array('node', NULL, FALSE, 'node'), array('node/1', NULL, FALSE, 'node/1'), array('node/2/edit', NULL, FALSE, 'node/2/edit'), array('non-existent', NULL, FALSE, 'non-existent'));
     // $this->map has $collect_bubbleable_metadata = FALSE; also generate the
     // $collect_bubbleable_metadata = TRUE case for ::generateFromRoute().
     $generate_from_route_map = [];
     foreach ($this->map as $values) {
         $generate_from_route_map[] = $values;
         $generate_from_route_map[] = [$values[0], $values[1], $values[2], TRUE, (new GeneratedUrl())->setGeneratedUrl($values[4])];
     }
     $this->urlGenerator = $this->getMock('Drupal\\Core\\Routing\\UrlGeneratorInterface');
     $this->urlGenerator->expects($this->any())->method('generateFromRoute')->will($this->returnValueMap($generate_from_route_map));
     $this->pathAliasManager = $this->getMock('Drupal\\Core\\Path\\AliasManagerInterface');
     $this->pathAliasManager->expects($this->any())->method('getPathByAlias')->will($this->returnValueMap($alias_map));
     $this->router = $this->getMock('Drupal\\Tests\\Core\\Routing\\TestRouterInterface');
     $this->pathValidator = $this->getMock('Drupal\\Core\\Path\\PathValidatorInterface');
     $this->container = new ContainerBuilder();
     $this->container->set('router.no_access_checks', $this->router);
     $this->container->set('url_generator', $this->urlGenerator);
     $this->container->set('path.alias_manager', $this->pathAliasManager);
     $this->container->set('path.validator', $this->pathValidator);
     \Drupal::setContainer($this->container);
 }
 /**
  * {@inheritdoc}
  */
 protected function setUp()
 {
     parent::setUp();
     $this->renderer = $this->getMock('Drupal\\Core\\Render\\MainContent\\MainContentRendererInterface');
     $this->routeMatch = $this->getMock('Drupal\\Core\\Routing\\RouteMatchInterface');
     $this->formAjaxResponseBuilder = new FormAjaxResponseBuilder($this->renderer, $this->routeMatch);
 }
 /**
  * {@inheritdoc}
  */
 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->viewer = $this->getMock('\\Drupal\\Core\\Session\\AccountInterface');
     $this->viewer->expects($this->any())->method('hasPermission')->will($this->returnValue(FALSE));
     $this->viewer->expects($this->any())->method('id')->will($this->returnValue(1));
     $this->owner = $this->getMock('\\Drupal\\Core\\Session\\AccountInterface');
     $this->owner->expects($this->any())->method('hasPermission')->will($this->returnValueMap(array(array('administer users', FALSE), array('change own username', TRUE))));
     $this->owner->expects($this->any())->method('id')->will($this->returnValue(2));
     $this->admin = $this->getMock('\\Drupal\\Core\\Session\\AccountInterface');
     $this->admin->expects($this->any())->method('hasPermission')->will($this->returnValue(TRUE));
     $entity_type = $this->getMock('Drupal\\Core\\Entity\\EntityTypeInterface');
     $this->accessControlHandler = new UserAccessControlHandler($entity_type);
     $module_handler = $this->getMock('Drupal\\Core\\Extension\\ModuleHandlerInterface');
     $module_handler->expects($this->any())->method('getImplementations')->will($this->returnValue(array()));
     $this->accessControlHandler->setModuleHandler($module_handler);
     $this->items = $this->getMockBuilder('Drupal\\Core\\Field\\FieldItemList')->disableOriginalConstructor()->getMock();
     $this->items->expects($this->any())->method('defaultAccess')->will($this->returnValue(AccessResult::allowed()));
 }
 /**
  * {@inheritdoc}
  */
 protected function setUp()
 {
     parent::setUp();
     $this->logger = $this->getMock('Psr\\Log\\LoggerInterface');
     $this->csrfToken = $this->getMockBuilder('Drupal\\Core\\Access\\CsrfTokenGenerator')->disableOriginalConstructor()->getMock();
     $this->formErrorHandler = $this->getMock('Drupal\\Core\\Form\\FormErrorHandlerInterface');
 }
Beispiel #27
0
 /**
  * {@inheritdoc}
  */
 protected function setUp()
 {
     parent::setUp();
     $this->kernel = $this->getMock('Symfony\\Component\\HttpKernel\\HttpKernelInterface');
     $this->banManager = $this->getMock('Drupal\\ban\\BanIpManagerInterface');
     $this->banMiddleware = new BanMiddleware($this->kernel, $this->banManager);
 }
 /**
  * {@inheritdoc}
  */
 protected function setUp()
 {
     parent::setUp();
     $this->entityTypeManager = $this->prophesize(EntityTypeManagerInterface::class);
     $this->entityFieldManager = $this->prophesize(EntityFieldManagerInterface::class);
     $this->routeProvider = new TestDefaultHtmlRouteProvider($this->entityTypeManager->reveal(), $this->entityFieldManager->reveal());
 }
 protected function setUp()
 {
     parent::setUp();
     $this->state = $this->getMock('Drupal\\Core\\State\\StateInterface');
     $this->renderer = new CssCollectionRenderer($this->state);
     $this->fileCssGroup = array('group' => -100, 'type' => 'file', 'media' => 'all', 'preprocess' => TRUE, 'browsers' => array('IE' => TRUE, '!IE' => TRUE), 'items' => array(0 => array('group' => -100, 'type' => 'file', 'weight' => 0.012, 'media' => 'all', 'preprocess' => TRUE, 'data' => 'tests/Drupal/Tests/Core/Asset/foo.css', 'browsers' => array('IE' => TRUE, '!IE' => TRUE), 'basename' => 'foo.css'), 1 => array('group' => -100, 'type' => 'file', 'weight' => 0.013, 'media' => 'all', 'preprocess' => TRUE, 'data' => 'tests/Drupal/Tests/Core/Asset/bar.css', 'browsers' => array('IE' => TRUE, '!IE' => TRUE), 'basename' => 'bar.css')));
 }
Beispiel #30
0
 /**
  * {@inheritdoc}
  */
 protected function setUp()
 {
     parent::setUp();
     $this->entityStorage = $this->getMock('Drupal\\Core\\Entity\\EntityStorageInterface');
     $this->viewHandler = new ViewAreaPlugin(array(), 'view', array(), $this->entityStorage);
     $this->viewHandler->view = $this->getMockBuilder('Drupal\\views\\ViewExecutable')->disableOriginalConstructor()->getMock();
 }