You are here

function PaymentTestPaymentLineItemFormElementWebTestCase::testDefaultValues in Payment 7

Test default value handling.

File

tests/payment_test/tests/PaymentTestPaymentLineItemFormElementWebTestCase.test, line 84
Contains class PaymentTestPaymentLineItemFormElementWebTestCase.

Class

PaymentTestPaymentLineItemFormElementWebTestCase
Tests the payment_line_item form element.

Code

function testDefaultValues() {
  $this
    ->drupalGet('payment_test-form-element-payment-line-item/default-values');
  foreach (payment_test_default_line_items() as $delta => $line_item) {
    $properties = array(
      'amount' => $line_item->amount,
      'description' => $line_item->description,
      'name' => $line_item->name,
      'quantity' => $line_item->quantity,
      'tax_rate' => $line_item->tax_rate * 100,
    );
    foreach ($properties as $property => $value) {
      $elements = $this
        ->xpath('//input[@id="edit-line-item-container-' . $delta . '-' . drupal_clean_css_identifier($property) . '" and @value="' . $value . '"]');
      $this
        ->assertTrue(isset($elements[0]), "The element contains the <em>{$property}</em> value for default line item {$delta}.");
    }
  }
}