public function AmazonTemplatesTest::testAmazonTemplates in Amazon Product Advertisement API 7.2
Test the Amazon templates.
File
- tests/
amazon.templates.test, line 27 - Template tests for Amazon module.
Class
- AmazonTemplatesTest
- @file Template tests for Amazon module.
Code
public function testAmazonTemplates() {
// Enable Amazon display on article content.
$this
->drupalGet("admin/config/services/amazon/testing/templates");
$this
->assertResponse(200);
// Test templates.
$test_styles = $this
->amazon_test_get_amazon_styles();
// @todo Investigate styles: amazon_inline_item, amazon_detail, plain.
// There is something wrong with these theme functions, removing from tests for now.
unset($test_styles['inline']);
unset($test_styles['plain']);
foreach ($test_styles as $style => $details) {
$xpath = $details['xpath'];
foreach ($xpath as $item) {
$xpath_query = $item['query'];
$xpath_values = $item['values'];
// Fill in the value for style.
if (isset($xpath_values[':style_class'])) {
$xpath_values[':style_class'] = "amazon-item-{$style}";
}
$this
->assertElementByXPath($xpath_query, $xpath_values, "Style '{$style}' was rendered correctly.");
}
}
}