diff --git a/module/project/test/zen/buildproductform.php b/module/project/test/zen/buildproductform.php new file mode 100755 index 0000000000..bb1ed1fdb2 --- /dev/null +++ b/module/project/test/zen/buildproductform.php @@ -0,0 +1,38 @@ +#!/usr/bin/env php +id->range('1-5'); +$table->name->range('Project1,Project2,Project3,Project4,Project5'); +$table->parent->range('1,2,1,2,1'); +$table->type->range('project'); +$table->status->range('doing'); +$table->deleted->range('0'); +$table->gen(5); + +su('admin'); + +$projectzenTest = new projectzenTest(); + +r($projectzenTest->buildProductFormTest(1, array(1 => 'Product1', 2 => 'Product2'), array(1, 2), array(1 => array(1 => 1)), array(1 => (object)array('id' => 1, 'name' => 'Product1')))) && p('currentProducts') && e('1'); +r($projectzenTest->buildProductFormTest(2, array(), array(), array(), array())) && p('currentProducts') && e('0'); +r($projectzenTest->buildProductFormTest(3, array(1 => 'Product1'), array(), array(), array())) && p('otherProducts') && e('1'); +r($projectzenTest->buildProductFormTest(null, array(1 => 'Product1'), array(1), array(), array())) && p('error') && e('Invalid project parameter'); +r($projectzenTest->buildProductFormTest(4, array_fill(1, 100, 'Product'), array_fill(1, 100, 1), array(), array())) && p('currentProducts') && e('50'); \ No newline at end of file