public function MerciBaseTestCase::createDummyProductNodeBatch in MERCI (Manage Equipment Reservations, Checkout and Inventory) 7.3
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 MerciBaseTestCase::createDummyProductNodeBatch()
- MerciBaseTesterTestCase::_testTestCreateDummyProductNodeBatch in merci_core/
tests/ merci_base.test - Test the createDummyProductNodeBatch function.
File
- merci_core/
tests/ merci_base.test, line 558 - Defines abstract base test class for the Merci module tests.
Class
- MerciBaseTestCase
- Abstract class for Merci testing. All Merci 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;
}