Esempio n. 1
0
 /**
  * {@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);
 }
Esempio n. 2
0
 /**
  * {@inheritdoc}
  */
 protected function setUp()
 {
     parent::setUp();
     // Despite the protected variable being defined in FormTestBase it is not
     // defined.
     $this->translationManager = $this->getMockBuilder('Drupal\\Core\\StringTranslation\\TranslationManager')->disableOriginalConstructor()->getMock();
     $this->container = new ContainerBuilder();
     $this->container->set('string_translation', $this->translationManager);
     \Drupal::setContainer($this->container);
     $this->form_state = new FormState();
     $definition = ['id' => static::PLUGIN_ID, 'title' => static::PLUGIN_TITLE, 'storage_method' => static::PLUGIN_STORAGE];
     $plugin_class = static::PLUGIN_CLASS;
     $this->plugin = new $plugin_class([], static::PLUGIN_ID, $definition);
 }
 /**
  * {@inheritdoc}
  */
 protected function tearDown()
 {
     parent::tearDown();
     \Drupal::setContainer(new ContainerBuilder());
 }