public function CommerceReferenceTableFormatterTest::testCommerceTableFormatter in Reference Table Formatter 7
File
- tests/
commerce_reference_table_formatter.test, line 61
Class
Code
public function testCommerceTableFormatter() {
$this
->drupalGet('admin/structure/types/manage/' . strtr($this->display_type->type, '_', '-') . '/display');
$edit = array(
'fields[field_product][type]' => 'reference_table_formatter',
'refresh_rows' => 'field_product',
);
$this
->drupalPostAJAX(NULL, $edit, array(
'op' => t('Refresh'),
));
$this
->drupalPost(NULL, array(), t('Save'));
// Create a prodcut display.
$this
->drupalPost('node/add/' . strtr($this->display_type->type, '_', '-'), array(
'title' => 'A Product Display Node',
'field_product[und][]' => array(
$this->products[1]->product_id,
$this->products[2]->product_id,
),
), 'Save');
$this
->assertRaw('<th>Product ID</th><th>SKU</th><th>Title</th><th>Price</th>');
$this
->assertRaw('<td>1</td><td>PROD-01</td><td>Product One</td><td><div class="field field-name-commerce-price field-type-commerce-price field-label-hidden"><div class="field-items"><div class="field-item even">$25.00</div></div></div></td>');
$this
->assertRaw('<td>2</td><td>PROD-02</td><td>Product Two</td><td><div class="field field-name-commerce-price field-type-commerce-price field-label-hidden"><div class="field-items"><div class="field-item even">$35.00</div></div></div></td>');
}