You are here

protected function CommerceReportsBaseTestCase::createProducts in Commerce Reporting 7.4

Helper function creating multiple dummy products with a variable price.

7 calls to CommerceReportsBaseTestCase::createProducts()
CommerceReportsBaseTestCase::createOrders in src/Tests/CommerceReportsBaseTestCase.php
Helper function creating multiple dummy orders. If no customers or products exist, then one of each get created.
CommerceReportsCustomerTestCase::testMultipleCustomers in src/Tests/CommerceReportsCustomerTestCase.php
Make one customer perform multiple orders with multiple products. Then verifies if the reporting is correct.
CommerceReportsCustomerTestCase::testSingleCustomerMultipleProducts in src/Tests/CommerceReportsCustomerTestCase.php
Make one customer perform multiple orders with multiple products. Then verifies if the reporting is correct.
CommerceReportsProductTestCase::testMultipleOrdersProducts in src/Tests/CommerceReportsProductTestCase.php
Tests creating a multiple orders, containing multiple products with a variable quantity. Then verifies if the reporting is correct.
CommerceReportsProductTestCase::testMultipleProducts in src/Tests/CommerceReportsProductTestCase.php
Tests creating a single order, containing multiple products with a variable quantity. Then verifies if the reporting is correct.

... See full list

File

src/Tests/CommerceReportsBaseTestCase.php, line 64

Class

CommerceReportsBaseTestCase
Class CommerceReportsBaseTestCase

Namespace

Drupal\commerce_reports\Tests

Code

protected function createProducts($amount = 1) {
  for ($i = 0; $i < $amount; $i++) {
    $product = $this
      ->createDummyProduct($this
      ->randomName(), '', rand(1, 1000));
    $this->products[$product->product_id] = $product;
  }
}