/**
  * @todo.
  */
 protected function setUp()
 {
     parent::setUp();
     // Setup basic fields.
     $this->setUpFieldStorages(3);
     // Setup a field with cardinality > 1.
     $this->fieldStorages[3] = entity_create('field_storage_config', array('field_name' => 'field_name_3', 'entity_type' => 'node', 'type' => 'string', 'cardinality' => FieldStorageDefinitionInterface::CARDINALITY_UNLIMITED));
     $this->fieldStorages[3]->save();
     // Setup a field that will have no value.
     $this->fieldStorages[4] = entity_create('field_storage_config', array('field_name' => 'field_name_4', 'entity_type' => 'node', 'type' => 'string', 'cardinality' => FieldStorageDefinitionInterface::CARDINALITY_UNLIMITED));
     $this->fieldStorages[4]->save();
     // Setup a text field.
     $this->fieldStorages[5] = entity_create('field_storage_config', array('field_name' => 'field_name_5', 'entity_type' => 'node', 'type' => 'text'));
     $this->fieldStorages[5]->save();
     $this->setUpFields();
     // Create some nodes.
     $this->nodes = array();
     for ($i = 0; $i < 3; $i++) {
         $edit = array('type' => 'page');
         foreach (array(0, 1, 2, 5) as $key) {
             $field_storage = $this->fieldStorages[$key];
             $edit[$field_storage->getName()][0]['value'] = $this->randomMachineName(8);
         }
         for ($j = 0; $j < 5; $j++) {
             $edit[$this->fieldStorages[3]->getName()][$j]['value'] = $this->randomMachineName(8);
         }
         // Set this field to be empty.
         $edit[$this->fieldStorages[4]->getName()] = array(array('value' => NULL));
         $this->nodes[$i] = $this->drupalCreateNode($edit);
     }
     $this->container->get('views.views_data')->clear();
 }
Exemple #2
0
 /**
  * {@inheritdoc}
  */
 public function setUp()
 {
     parent::setUp();
     $this->account = $this->drupalCreateUser(array('administer views'));
     $this->drupalLogin($this->account);
     $this->setUpFields();
     $this->setUpInstances();
 }
Exemple #3
0
 /**
  * {@inheritdoc}
  */
 protected function setUp()
 {
     parent::setUp();
     $this->account = $this->drupalCreateUser(array('administer views'));
     $this->drupalLogin($this->account);
     $this->setUpFieldStorages(1, 'text');
     $this->setUpFields();
 }
 protected function setUp()
 {
     parent::setUp();
     $field_names = $this->setUpFieldStorages(1);
     // Attach the field to nodes only.
     $field = array('field_name' => $field_names[0], 'entity_type' => 'node', 'bundle' => 'page');
     entity_create('field_config', $field)->save();
     // Now create some example nodes/users for the view result.
     for ($i = 0; $i < 5; $i++) {
         $edit = array($field_names[0] => array(array('value' => $this->randomMachineName())));
         $nodes[] = $this->drupalCreateNode($edit);
     }
 }
Exemple #5
0
 function setUp()
 {
     parent::setUp();
     $field_names = $this->setUpFields(1);
     // Attach the field to nodes only.
     $instance = array('field_name' => $field_names[0], 'entity_type' => 'node', 'bundle' => 'page');
     entity_create('field_instance_config', $instance)->save();
     // Now create some example nodes/users for the view result.
     for ($i = 0; $i < 5; $i++) {
         $edit = array($field_names[0] => array(array('value' => $this->randomMachineName())));
         $nodes[] = $this->drupalCreateNode($edit);
     }
     $this->container->get('views.views_data')->clear();
 }
 protected function setUp()
 {
     parent::setUp();
     $field_names = $this->setUpFieldStorages(1);
     // Attach the field to nodes only.
     $field = array('field_name' => $field_names[0], 'entity_type' => 'node', 'bundle' => 'page', 'label' => 'GiraffeA" label');
     FieldConfig::create($field)->save();
     // Attach the same field to a different bundle with a different label.
     $this->drupalCreateContentType(['type' => 'article']);
     FieldConfig::create(['field_name' => $field_names[0], 'entity_type' => 'node', 'bundle' => 'article', 'label' => 'GiraffeB" label'])->save();
     // Now create some example nodes/users for the view result.
     for ($i = 0; $i < 5; $i++) {
         $edit = array($field_names[0] => array(array('value' => $this->randomMachineName())));
         $nodes[] = $this->drupalCreateNode($edit);
     }
 }