protected function CommerceReportsBaseTestCase::createdCustomersData in Commerce Reporting 7.4
Returns information about created customers for tests.
Return value
array
1 call to CommerceReportsBaseTestCase::createdCustomersData()
File
- src/
Tests/ CommerceReportsBaseTestCase.php, line 111
Class
- CommerceReportsBaseTestCase
- Class CommerceReportsBaseTestCase
Namespace
Drupal\commerce_reports\TestsCode
protected function createdCustomersData() {
$customers = array();
foreach ($this->orders as $order) {
$uid = $order['commerce_order']->uid;
if (empty($customers[$uid])) {
$customers[$uid] = array(
'orders' => 0,
'products' => 0,
'revenue' => 0,
);
}
$customers[$uid]['orders']++;
foreach ($order['products'] as $product_id => $quantity) {
$customers[$uid]['products'] += $quantity;
$customers[$uid]['revenue'] += $quantity * $this->products[$product_id]->commerce_price[LANGUAGE_NONE][0]['amount'];
}
}
return $customers;
}