amazon.templates.test in Amazon Product Advertisement API 7.2
Template tests for Amazon module.
File
tests/amazon.templates.testView source
<?php
/**
* @file
* Template tests for Amazon module.
*/
class AmazonTemplatesTest extends AmazonBaseTest {
protected $admin_user;
public static function getInfo() {
return array(
'name' => 'Amazon templates',
'description' => 'Tests that Amazon templates render correctly.',
'group' => 'Amazon',
);
}
protected function setUp($modules = array()) {
// Enable modules.
parent::setUp($modules);
}
/**
* Test the Amazon templates.
*/
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.");
}
}
}
}
Classes
Name | Description |
---|---|
AmazonTemplatesTest | @file Template tests for Amazon module. |