You are here

public function AmazonBaseTest::amazon_test_get_amazon_styles in Amazon Product Advertisement API 7.2

Provides an list of styles to be tested.

2 calls to AmazonBaseTest::amazon_test_get_amazon_styles()
AmazonNodesTest::testFieldFormatters in tests/amazon.nodes.test
Test the field formatters.
AmazonTemplatesTest::testAmazonTemplates in tests/amazon.templates.test
Test the Amazon templates.

File

tests/amazon.base.test, line 71
Base tests for Amazon module.

Class

AmazonBaseTest
@file Base tests for Amazon module.

Code

public function amazon_test_get_amazon_styles() {

  // Xpath to test title.
  // i.e. //div[contains(@class, "amazon-product--container") and contains(@class, "amazon-item") and contains(@class, "amazon-item-default")]//a[text()='The Complete Matrix Trilogy'][contains(@href, "test-20")]
  $xpath_title = array(
    'query' => '//div[contains(@class, :container_class)' . ' and contains(@class, :item_class)' . ' and contains(@class, :style_class)]' . '//a[text()=:link_text][contains(@href, :track_id)]',
    'values' => array(
      ':container_class' => 'amazon-product--container',
      ':item_class' => 'amazon-item',
      ':style_class' => "amazon-item-default",
      ':link_text' => 'The Complete Matrix Trilogy',
      ':track_id' => variable_get('amazon_locale_US_associate_id'),
    ),
  );

  // Xpath to test gallery.
  // i.e //div[contains(@class, 'amazon-product--container') and contains(@class, 'amazon-item')]//img[@height>1 and @width>1][contains(@alt, 'Image of The Complete Matrix Trilogy')][contains(@title, 'The Complete Matrix Trilogy')][contains(@src, 'images-amazon.com')]
  $xpath_gallery = array(
    'query' => '//div[contains(@class, :item_class)]' . '//img[@height>1 and @width>1]' . '[contains(@alt, :alt_text)]' . '[contains(@title, :title_text)]' . '[contains(@src, :src)]',
    'values' => array(
      ':container_class' => 'amazon-product--container',
      ':item_class' => 'amazon-item',
      ':alt_text' => 'Image of The Complete Matrix Trilogy',
      ':title_text' => 'The Complete Matrix Trilogy',
      ':src' => 'images-amazon.com/images',
    ),
  );

  // Xpath to test inline items.
  // i.e //span[contains(@class, 'amazon-item')][contains(@class, 'amazon-item-inline')]//a[text()='The Complete Matrix Trilogy'][contains(@href, "test-20")]
  $xpath_inline = array(
    'query' => '//span[contains(@class, :item_class)]' . '[contains(@class, :style_class)]' . '//a[text()=:title_text]' . '[contains(@href, :track_id)]',
    'values' => array(
      ':item_class' => 'amazon-item',
      ':style_class' => "amazon-item-default",
      ':title_text' => 'The Complete Matrix Trilogy',
      ':track_id' => variable_get('amazon_locale_US_associate_id'),
    ),
  );

  // Xpath to test plain items.
  // i.e //div[contains(@class, 'field-type-asin')]//div[contains(text(), "B001CEE1YE")]
  $xpath_plain = array(
    'query' => '//div[contains(@class, :container_class)]' . '//div[contains(text(), :asin)]',
    'values' => array(
      ':container_class' => 'field-type-asin',
      ':asin' => 'B001CEE1YE',
    ),
  );
  return array(
    'default' => array(
      'xpath' => array(
        $xpath_title,
        $xpath_gallery,
      ),
    ),
    'default_gallery' => array(
      'xpath' => array(
        $xpath_title,
        $xpath_gallery,
      ),
    ),
    'details' => array(
      'xpath' => array(
        $xpath_title,
        $xpath_gallery,
      ),
    ),
    'details_gallery' => array(
      'xpath' => array(
        $xpath_title,
        $xpath_gallery,
      ),
    ),
    'thumbnail' => array(
      'xpath' => array(
        $xpath_gallery,
      ),
    ),
    'thumbnail_gallery' => array(
      'xpath' => array(
        $xpath_gallery,
      ),
    ),
    'medium' => array(
      'xpath' => array(
        $xpath_gallery,
      ),
    ),
    'medium_gallery' => array(
      'xpath' => array(
        $xpath_gallery,
      ),
    ),
    'large' => array(
      'xpath' => array(
        $xpath_gallery,
      ),
    ),
    'large_gallery' => array(
      'xpath' => array(
        $xpath_gallery,
      ),
    ),
    'inline' => array(
      'xpath' => array(
        $xpath_inline,
      ),
    ),
    'plain' => array(
      'xpath' => array(
        $xpath_plain,
      ),
    ),
  );
}