You are here

protected function PropertiesBaseTestCase::createField in Dynamic properties 7

Create a properties field for the given settings page.

Parameters

$url: URL to the manage fields form, defaults to the form for the page node type.

4 calls to PropertiesBaseTestCase::createField()
PropertiesCompareTestCase::testPropertyFieldCreation in properties_compare/properties_compare.test
Test comparing to similiar nodes.
PropertiesTemplateTestCase::testExportAsTemplate in properties_template/properties_template.test
Test for exporting a content as template.
PropertiesTemplateTestCase::testPropertyFieldCreation in properties_template/properties_template.test
Create a content based on a template.
PropertiesTestCase::testPropertyFieldCreation in ./properties.test
Test field creation functionality.

File

./properties.test, line 175
Contains tests for the properties.module

Class

PropertiesBaseTestCase
Base class for properties tests, provides helper methods.

Code

protected function createField($url = NULL) {

  // Create a new field.
  $field = array(
    'fields[_add_new_field][label]' => $this->field_label = $this
      ->randomName(),
    'fields[_add_new_field][field_name]' => $this->field_name = drupal_strtolower($this
      ->randomName()),
    'fields[_add_new_field][type]' => 'properties',
    'fields[_add_new_field][widget_type]' => 'properties_table',
  );
  if (empty($url)) {
    $url = 'admin/structure/types/manage/page/fields';
  }
  $this->field_prefix = 'field_' . $this->field_name . '[und]';
  $this
    ->drupalPost($url, $field, t('Save'));
  $this
    ->drupalPost(NULL, array(), t('Save field settings'));
  $this
    ->drupalPost(NULL, array(), t('Save settings'));
}