You are here

public function UCXFTestCase::setupFields in Extra Fields Checkout Pane 7

Same name and namespace in other branches
  1. 6.2 uc_extra_fields_pane.test \UCXFTestCase::setupFields()

Create default fields

Return value

void

3 calls to UCXFTestCase::setupFields()
UCXFApiTestCase::testUCXF_Value in ./uc_extra_fields_pane.test
Test if UCXF_Value behaves as excepted.
UCXFCheckoutTestCase::testCheckout in ./uc_extra_fields_pane.test
Test if checkout works as expected.
UCXFOrderTestCase::testOrder in ./uc_extra_fields_pane.test
Test the order administration.

File

./uc_extra_fields_pane.test, line 92
Automated tests for Extra Fields Pane

Class

UCXFTestCase
Base class for all Extra Fields Pane test cases.

Code

public function setupFields() {

  // Login as admin
  $this
    ->drupalLogin($this->adminUser);

  // Create address fields
  $this->textField = $this
    ->createAddressField(UCXF_Field::UCXF_WIDGET_TYPE_TEXTFIELD);
  $this->selectField = $this
    ->createAddressField(UCXF_Field::UCXF_WIDGET_TYPE_SELECT);
  $this
    ->assertNoText(t('In this example the key of the first item is just a single space.'), t('The select field was saved without problems.'));
  $this->constantField = $this
    ->createAddressField(UCXF_Field::UCXF_WIDGET_TYPE_CONSTANT);
  $this->checkboxField = $this
    ->createAddressField(UCXF_Field::UCXF_WIDGET_TYPE_CHECKBOX);
  $this->phpField = $this
    ->createAddressField(UCXF_Field::UCXF_WIDGET_TYPE_PHP);
  $this->phpSelectField = $this
    ->createAddressField(UCXF_Field::UCXF_WIDGET_TYPE_PHP_SELECT);
  $this
    ->assertNoText(t('In this example the key of the first item is an empty string.'), t('The php select field was saved without problems.'));

  // A "hidden" constant field.
  $this->hiddenConstantField = $this
    ->createAddressField(UCXF_Field::UCXF_WIDGET_TYPE_CONSTANT, array(
    'ucxf[display_settings][checkout]' => FALSE,
    'ucxf[value]' => 'hidden constant',
  ));

  // A "hidden" PHP field.
  $this->hiddenPhpField = $this
    ->createAddressField(UCXF_Field::UCXF_WIDGET_TYPE_PHP, array(
    'ucxf[display_settings][checkout]' => FALSE,
    'ucxf[value]' => '<?php return "hidden string"; ?>',
  ));
}