public function CommerceBaseTestCase::createDummyProductNodeBatch in Commerce Core 7
Create a full product node without worrying about the earlier steps in the process.
Parameters
$count: Number of product nodes to create. Each one will have a new product entity associated with it. SKUs will be like PROD-n. Titles will be like 'Product #n'. Price will be 10*n. Counting begins at 1.
Return value
An array of product node objects.
1 call to CommerceBaseTestCase::createDummyProductNodeBatch()
- CommerceBaseTesterTestCase::testTestCreateDummyProductNodeBatch in tests/
commerce_base.test - Test the createDummyProductNodeBatch function.
File
- tests/
commerce_base.test, line 503 - Defines abstract base test class for the Commerce module tests.
Class
- CommerceBaseTestCase
- Abstract class for Commerce testing. All Commerce tests should extend this class.
Code
public function createDummyProductNodeBatch($count) {
$this
->createDummyProductDisplayContentType();
$product_nodes = array();
for ($i = 1; $i < $count; $i++) {
$sku = "PROD-{$i}";
$title = "Product #{$i}";
$price = $i * 10;
$product = $this
->createDummyProduct($sku, $title, $price);
$product_node = $this
->createDummyProductNode(array(
$product->product_id,
), $title);
$product_nodes[$i] = $product_node;
}
return $product_nodes;
}