You are here

protected function AttributeTest::attributeFieldsToTest in Ubercart 8.4

Returns an array of available fields for product or class attributes.

Parameters

string $type: One of 'product' for products or 'class' for product classes.

Return value

array Associative array of fields values keyed by field name.

1 call to AttributeTest::attributeFieldsToTest()
AttributeTest::testAttributeApi in uc_attribute/tests/src/Functional/AttributeTest.php
Tests the basic attribute API.

File

uc_attribute/tests/src/Functional/AttributeTest.php, line 936

Class

AttributeTest
Tests the product attribute API.

Namespace

Drupal\Tests\uc_attribute\Functional

Code

protected function attributeFieldsToTest($type = '') {
  $fields = [
    'aid',
    'name',
    'ordering',
    'required',
    'display',
    'description',
    'label',
  ];
  switch ($type) {
    case 'product':
    case 'class':
      $info = uc_attribute_type_info($type);
      $fields = array_merge($fields, [
        $info['id'],
      ]);
      break;
  }
  return $fields;
}