You are here

protected function CommerceProductReferenceSelectSynonymsWebTestCase::createTerms in Synonyms 7

Method to initiate all necessary terms for testing.

Overrides AbstractSelectSynonymsWebTestCase::createTerms

File

synonyms_commerce/synonyms_commerce.test, line 554
Tests for the Synonyms Commerce module.

Class

CommerceProductReferenceSelectSynonymsWebTestCase
Test synonyms-friendly select widget for commerce product reference field.

Code

protected function createTerms() {
  $this->terms['product1'] = (object) array(
    'type' => $this->behavior_implementation['bundle'],
    'title' => 'Product 1',
    'sku' => drupal_strtolower($this
      ->randomName()),
    $this->fields['enabled']['field']['field_name'] => array(
      LANGUAGE_NONE => array(
        array(
          'value' => 'Product 1A' . $this
            ->randomName(),
        ),
        array(
          'value' => 'Product 1Z' . $this
            ->randomName(),
        ),
      ),
    ),
  );
  commerce_product_save($this->terms['product1']);
  $this->terms['product2'] = (object) array(
    'type' => $this->behavior_implementation['bundle'],
    'title' => 'Product 2',
    'sku' => drupal_strtolower($this
      ->randomName()),
    $this->fields['enabled']['field']['field_name'] => array(
      LANGUAGE_NONE => array(
        array(
          'value' => 'Product 2Z' . $this
            ->randomName(),
        ),
        array(
          'value' => 'Product 2A' . $this
            ->randomName(),
        ),
      ),
    ),
  );
  commerce_product_save($this->terms['product2']);
  $this->terms['product3'] = (object) array(
    'type' => $this->behavior_implementation['bundle'],
    'title' => 'Product 3',
    'sku' => drupal_strtolower($this
      ->randomName()),
    $this->fields['enabled']['field']['field_name'] => array(
      LANGUAGE_NONE => array(
        array(
          'value' => 'Another Product 3A' . $this
            ->randomName(),
        ),
        array(
          'value' => 'Another Product 3Z' . $this
            ->randomName(),
        ),
      ),
    ),
  );
  commerce_product_save($this->terms['product3']);
}