Exemplo n.º 1
0
 /**
  * {@inheritdoc}
  */
 protected function setUp()
 {
     parent::setUp();
     $this->actionManager = $this->container->get('plugin.manager.action');
     $this->installEntitySchema('user');
     $this->installSchema('system', array('sequences'));
 }
Exemplo n.º 2
0
 /**
  * {@inheritdoc}
  */
 function setUp()
 {
     parent::setUp();
     $this->installSchema('system', array('url_alias', 'router'));
     $this->installEntitySchema('user');
     $this->installEntitySchema('entity_test');
     $this->installConfig(array('field', 'language'));
     // Add English as a language.
     $english = new Language(array('id' => 'en', 'name' => 'English'));
     language_save($english);
     // Add German as a language.
     $german = new Language(array('id' => 'de', 'name' => 'Deutsch', 'weight' => -1));
     language_save($german);
     // Create the test text field.
     entity_create('field_storage_config', array('name' => 'field_test_text', 'entity_type' => 'entity_test', 'type' => 'text'))->save();
     entity_create('field_instance_config', array('entity_type' => 'entity_test', 'field_name' => 'field_test_text', 'bundle' => 'entity_test', 'translatable' => FALSE))->save();
     // Create the test translatable field.
     entity_create('field_storage_config', array('name' => 'field_test_translatable_text', 'entity_type' => 'entity_test', 'type' => 'text'))->save();
     entity_create('field_instance_config', array('entity_type' => 'entity_test', 'field_name' => 'field_test_translatable_text', 'bundle' => 'entity_test', 'translatable' => TRUE))->save();
     // Create the test entity reference field.
     entity_create('field_storage_config', array('name' => 'field_test_entity_reference', 'entity_type' => 'entity_test', 'type' => 'entity_reference', 'settings' => array('target_type' => 'entity_test')))->save();
     entity_create('field_instance_config', array('entity_type' => 'entity_test', 'field_name' => 'field_test_entity_reference', 'bundle' => 'entity_test', 'translatable' => TRUE))->save();
     $entity_manager = \Drupal::entityManager();
     $link_manager = new LinkManager(new TypeLinkManager(new MemoryBackend('default')), new RelationLinkManager(new MemoryBackend('default'), $entity_manager));
     $chain_resolver = new ChainEntityResolver(array(new UuidResolver($entity_manager), new TargetIdResolver()));
     // Set up the mock serializer.
     $normalizers = array(new ContentEntityNormalizer($link_manager, $entity_manager, \Drupal::moduleHandler()), new EntityReferenceItemNormalizer($link_manager, $chain_resolver), new FieldItemNormalizer(), new FieldNormalizer());
     $encoders = array(new JsonEncoder());
     $this->serializer = new Serializer($normalizers, $encoders);
 }
 /**
  * {@inheritdoc}
  */
 protected function setUp()
 {
     parent::setUp();
     $this->container->get('module_handler')->loadInclude('user', 'install');
     $this->installEntitySchema('user');
     user_install();
 }
 protected function setUp()
 {
     parent::setUp();
     // Ensure the global variable being asserted by this test does not exist;
     // a previous test executed in this request/process might have set it.
     unset($GLOBALS['hook_config_test']);
 }
Exemplo n.º 5
0
 function setUp()
 {
     parent::setUp();
     // Configure the theme system.
     $this->installConfig(array('system', 'field'));
     $this->installEntitySchema('entity_test');
     // @todo Add helper methods for all of the following.
     $this->entity_type = 'entity_test';
     if (!isset($this->bundle)) {
         $this->bundle = $this->entity_type;
     }
     $this->field_name = drupal_strtolower($this->randomName());
     $this->field_type = 'text_long';
     $this->field_settings = array();
     $this->instance_settings = array('text_processing' => FALSE);
     $this->formatter_type = 'string';
     $this->formatter_settings = array();
     $this->fieldStorage = entity_create('field_storage_config', array('name' => $this->field_name, 'entity_type' => $this->entity_type, 'type' => $this->field_type, 'settings' => $this->field_settings));
     $this->fieldStorage->save();
     $this->instance = entity_create('field_instance_config', array('field_storage' => $this->fieldStorage, 'bundle' => $this->bundle, 'label' => $this->randomName(), 'settings' => $this->instance_settings));
     $this->instance->save();
     $this->view_mode = 'default';
     $this->display = entity_get_display($this->entity_type, $this->bundle, $this->view_mode)->setComponent($this->field_name, array('type' => $this->formatter_type, 'settings' => $this->formatter_settings));
     $this->display->save();
     $this->langcode = LanguageInterface::LANGCODE_NOT_SPECIFIED;
 }
 protected function setUp()
 {
     parent::setUp();
     $this->installConfig(array('system'));
     $this->installSchema('system', array('router'));
     \Drupal::service('router.builder')->rebuild();
 }
Exemplo n.º 7
0
 function setUp()
 {
     parent::setUp();
     // There are dependencies in drupal_get_js() on the theme layer so we need
     // to initialize it.
     drupal_theme_initialize();
 }
Exemplo n.º 8
0
 /**
  * Set the default field storage backend for fields created during tests.
  */
 protected function setUp()
 {
     parent::setUp();
     $this->installEntitySchema('user');
     // Set default storage backend.
     $this->installConfig(array('field'));
 }
Exemplo n.º 9
0
 /**
  * Sets the default field storage backend for fields created during tests.
  */
 protected function setUp()
 {
     parent::setUp();
     $this->fields = new \ArrayObject(array(), \ArrayObject::ARRAY_AS_PROPS);
     $this->installEntitySchema('entity_test');
     $this->installConfig(array('field', 'filter'));
 }
Exemplo n.º 10
0
 public function setUp()
 {
     parent::setUp();
     // Update the config snapshot. This allows the parent::setUp() to write
     // configuration files.
     \Drupal::service('config.manager')->createSnapshot(\Drupal::service('config.storage'), \Drupal::service('config.storage.snapshot'));
     $this->copyConfig($this->container->get('config.storage'), $this->container->get('config.storage.staging'));
 }
 /**
  * {@inheritdoc}
  */
 protected function setUp()
 {
     parent::setUp();
     $this->installEntitySchema('user');
     $this->installSchema('system', array('sequences'));
     // Make sure that the default roles exist.
     $this->installConfig(array('user'));
 }
 protected function setUp()
 {
     parent::setUp();
     $this->installConfig(array('language'));
     // Setup Italian.
     ConfigurableLanguage::createFromLangcode('it')->save();
     $this->manager = $this->container->get('plugin.manager.condition');
 }
Exemplo n.º 13
0
 protected function setUp()
 {
     parent::setUp();
     $this->installConfig(array('system'));
     $manager = $this->container->get('plugin.manager.filter');
     $bag = new FilterBag($manager, array());
     $this->filters = $bag->getAll();
 }
Exemplo n.º 14
0
 protected function checkRequirements()
 {
     // GD2 support is available.
     if (!function_exists('imagegd2')) {
         return array('Image manipulations for the GD toolkit cannot run because the GD toolkit is not available.');
     }
     return parent::checkRequirements();
 }
Exemplo n.º 15
0
 function tearDown()
 {
     // Restore configured value for JavaScript preprocessing.
     $config = \Drupal::config('system.performance');
     $config->set('js.preprocess', $this->preprocess_js);
     $config->save();
     parent::tearDown();
 }
Exemplo n.º 16
0
 public function setUp()
 {
     parent::setUp();
     $this->installSchema('system', array('key_value_expire'));
     $this->form_build_id = $this->randomName();
     $this->form = array('#property' => $this->randomName());
     $this->form_state = \Drupal::formBuilder()->getFormStateDefaults();
     $this->form_state['example'] = $this->randomName();
 }
 /**
  * {@inheritdoc}
  */
 protected function setUp()
 {
     parent::setUp();
     $this->installConfig(array('language'));
     $this->state = $this->container->get('state');
     // Ensure we are building a new Language object for each test.
     $this->languageManager = $this->container->get('language_manager');
     $this->languageManager->reset();
 }
Exemplo n.º 18
0
 function setUp()
 {
     parent::setUp();
     $this->installConfig(array('system'));
     $this->registerStreamWrapper('private', 'Drupal\\Core\\StreamWrapper\\PrivateStream');
     if (isset($this->scheme)) {
         $this->registerStreamWrapper($this->scheme, $this->classname);
     }
 }
 function setUp()
 {
     parent::setUp();
     // filter_permission() calls into url() to output a link in the description.
     $this->installSchema('system', 'url_alias');
     $this->installEntitySchema('user');
     // Install filter_test module, which ships with custom default format.
     $this->installConfig(array('user', 'filter_test'));
 }
 protected function setUp()
 {
     parent::setUp();
     $this->installEntitySchema('node');
     $this->copyConfig($this->container->get('config.storage'), $this->container->get('config.storage.staging'));
     // Set up the ConfigImporter object for testing.
     $storage_comparer = new StorageComparer($this->container->get('config.storage.staging'), $this->container->get('config.storage'), $this->container->get('config.manager'));
     $this->configImporter = new ConfigImporter($storage_comparer->createChangelist(), $this->container->get('event_dispatcher'), $this->container->get('config.manager'), $this->container->get('lock'), $this->container->get('config.typed'), $this->container->get('module_handler'), $this->container->get('theme_handler'), $this->container->get('string_translation'));
 }
Exemplo n.º 21
0
 /**
  * Set the default field storage backend for fields created during tests.
  */
 function setUp()
 {
     parent::setUp();
     $this->installEntitySchema('entity_test');
     $this->installEntitySchema('user');
     $this->installSchema('system', array('sequences'));
     // Set default storage backend and configure the theme system.
     $this->installConfig(array('field', 'system'));
 }
Exemplo n.º 22
0
 public function setUp()
 {
     parent::setUp();
     $this->installSchema('system', array('key_value_expire'));
     $this->form_build_id = $this->randomMachineName();
     $this->form = array('#property' => $this->randomMachineName());
     $this->form_state = new FormState();
     $this->form_state['example'] = $this->randomMachineName();
 }
 protected function setUp()
 {
     parent::setUp();
     // Theme settings rely on System module's system.theme.global configuration.
     $this->installConfig(array('system'));
     if (!isset($this->availableThemes)) {
         $discovery = new ExtensionDiscovery();
         $this->availableThemes = $discovery->scan('theme');
     }
 }
Exemplo n.º 24
0
 /**
  * Set the default field storage backend for fields created during tests.
  */
 protected function setUp()
 {
     parent::setUp();
     $this->fieldTestData = new \ArrayObject(array(), \ArrayObject::ARRAY_AS_PROPS);
     $this->installEntitySchema('entity_test');
     $this->installEntitySchema('user');
     $this->installSchema('system', array('sequences'));
     // Set default storage backend and configure the theme system.
     $this->installConfig(array('field', 'system'));
 }
Exemplo n.º 25
0
 /**
  * {@inheritdoc}
  */
 public function setUp()
 {
     parent::setUp();
     $this->controller = $this->container->get('entity.manager')->getStorage('block');
     \Drupal::state()->set('block_test.content', 'Llamas > unicorns!');
     // Create a block with only required values.
     $this->block = $this->controller->create(array('id' => 'test_block', 'theme' => 'stark', 'plugin' => 'test_cache'));
     $this->block->save();
     $this->container->get('cache.render')->deleteAll();
 }
Exemplo n.º 26
0
 public function setUp()
 {
     parent::setUp();
     $this->entityManager = $this->container->get('entity.manager');
     $this->state = $this->container->get('state');
     $this->installSchema('system', 'sequences');
     $this->installEntitySchema('user');
     $this->installEntitySchema('entity_test');
     $this->installConfig(array('field'));
 }
Exemplo n.º 27
0
 protected function setUp()
 {
     parent::setUp();
     $this->installEntitySchema('entity_test_mulrev');
     $this->installEntitySchema('user');
     $this->installSchema('system', array('url_alias'));
     $this->installConfig(array('field'));
     // Auto-create a field for testing.
     entity_create('field_storage_config', array('name' => 'field_test_text', 'entity_type' => 'entity_test_mulrev', 'type' => 'text', 'cardinality' => 1, 'translatable' => FALSE))->save();
     entity_create('field_instance_config', array('entity_type' => 'entity_test_mulrev', 'field_name' => 'field_test_text', 'bundle' => 'entity_test_mulrev', 'label' => 'Test text-field', 'widget' => array('type' => 'text_textfield', 'weight' => 0)))->save();
 }
Exemplo n.º 28
0
 protected function setUp()
 {
     parent::setUp();
     // Install field configuration.
     $this->installConfig(array('field'));
     // The users table is needed for creating dummy user accounts.
     $this->installEntitySchema('user');
     // Register entity_test text field.
     module_load_install('entity_test');
     entity_test_install();
 }
Exemplo n.º 29
0
 protected function setUp()
 {
     parent::setUp();
     $this->installConfig(array('language'));
     // Setup English.
     language_save(\Drupal::languageManager()->getDefaultLanguage());
     // Setup Italian.
     $language = new Language(array('id' => 'it', 'name' => 'Italian', 'direction' => Language::DIRECTION_LTR));
     language_save($language);
     $this->manager = $this->container->get('plugin.manager.condition');
 }
 function setUp()
 {
     parent::setUp();
     // Install the Filter module.
     $this->installSchema('system', 'url_alias');
     $this->enableModules(array('user', 'filter'));
     // Create text format, associate CKEditor.
     $filtered_html_format = entity_create('filter_format', array('format' => 'filtered_html', 'name' => 'Filtered HTML', 'weight' => 0, 'filters' => array()));
     $filtered_html_format->save();
     $editor = entity_create('editor', array('format' => 'filtered_html', 'editor' => 'ckeditor'));
     $editor->save();
 }