public function fieldCase::testField

8.0.x fieldTest.php public fieldCase::testField()
6.x fieldTest.php public fieldCase::testField()
7.x fieldTest.php public fieldCase::testField()
4.x fieldTest.php public fieldCase::testField()
5.x fieldTest.php public fieldCase::testField()

File

tests/fieldTest.php, line 9

Class

fieldCase

Code

public function testField() {
  $this->setUpDrupal('dev', TRUE);
  $options = array(
    'yes' => NULL,
    'root' => $this->sites['dev']['root'],
    'uri' => 'dev',
  );
  // Create two field instances on article content type.
  $this->drush('field-create', array('user', 'city,text,text_textfield', 'subtitle,text,text_textfield'), $options + array('entity_type' => 'user'));
  $output = $this->getOutput();
  list($city, $subtitle) = explode(' ', $output);
  $url = parse_url($subtitle);
  $this->assertEquals('/admin/config/people/accounts/fields/subtitle', $url['path']);

  // Assure that the second field instance was created correctly (subtitle).
  $this->verifyInstance('subtitle', $options);

  // Assure that field update URL looks correct.
  $this->drush('field-update', array('subtitle'), $options);
  $output = $this->getOutput();
  $url = parse_url($this->getOutput());
  $this->assertEquals('/admin/config/people/accounts/fields/subtitle', $url['path']);

  // Assure that field-clone actually clones.
  $this->drush('field-clone', array('subtitle', 'subtitlecloned'), $options);
  $this->verifyInstance('subtitlecloned', $options);

  // Assure that delete works.
  $this->drush('field-delete', array('subtitlecloned'), $options);
  $this->verifyInstance('subtitlecloned', $options, FALSE);
}