You are here

class CommerceReportsPaymentMethodTestCase in Commerce Reporting 7.4

Hierarchy

Expanded class hierarchy of CommerceReportsPaymentMethodTestCase

File

src/Tests/CommerceReportsPaymentMethodTestCase.php, line 5

Namespace

Drupal\commerce_reports\Tests
View source
class CommerceReportsPaymentMethodTestCase extends CommerceReportsBaseTestCase {
  public static function getInfo() {
    return array(
      'name' => 'Payment method reports',
      'description' => 'Test the payment method reports.',
      'group' => 'Commerce Reports',
    );
  }
  public function testExampleMethod() {
    $this
      ->createOrders(10, TRUE);
    $transactions = 0;
    $revenue = 0;
    foreach ($this->orders as $order) {
      $transactions++;
      $revenue += $order['commerce_transaction']->amount;
    }
    $report = views_get_view_result('commerce_reports_payment_methods', 'default');
    $this
      ->assertEqual(count($report), 1, t('Exactly one payment method was reported upon.'));
    foreach ($report as $line) {
      $this
        ->assertEqual($line->commerce_payment_transaction_payment_method, 'commerce_payment_example', t('The example payment method was used for this transaction.'));
      $this
        ->assertEqual($line->transaction_id, $transactions, t('The right amount of transactions were reported.'));
      $this
        ->assertEqual($line->commerce_payment_transaction_amount, $revenue, t('The right amount of revenue was reported.'));
    }
  }

}

Members

Namesort descending Modifiers Type Description Overrides
CommerceReportsBaseTestCase::$additional_modules protected property
CommerceReportsBaseTestCase::$customers protected property
CommerceReportsBaseTestCase::$orders protected property
CommerceReportsBaseTestCase::$products protected property
CommerceReportsBaseTestCase::$profile protected property Don't need most of default core modules.
CommerceReportsBaseTestCase::$store_admin protected property
CommerceReportsBaseTestCase::createCustomers protected function Helper function creating multiple dummy customers.
CommerceReportsBaseTestCase::createdCustomersData protected function Returns information about created customers for tests.
CommerceReportsBaseTestCase::createdProductsData protected function Returns information about created products for tests.
CommerceReportsBaseTestCase::createOrders protected function Helper function creating multiple dummy orders. If no customers or products exist, then one of each get created.
CommerceReportsBaseTestCase::createProducts protected function Helper function creating multiple dummy products with a variable price.
CommerceReportsBaseTestCase::getTotal protected function
CommerceReportsBaseTestCase::getView protected function Return a an executed View.
CommerceReportsBaseTestCase::permissionBuilder protected function Overrides CommerceBaseTestCase::permissionBuilder().
CommerceReportsBaseTestCase::setUp function Overrides DrupalWebTestCase::setUp(). 3
CommerceReportsPaymentMethodTestCase::getInfo public static function
CommerceReportsPaymentMethodTestCase::testExampleMethod public function