1<?php 2 3/** 4 * Container for all possible variation test cases of functions 5 */ 6class gtVariationContainerFunction extends gtVariationContainer { 7 8 protected $function; 9 protected $optionalSections; 10 11 public function __construct($osl) { 12 $this->optionalSections = $osl; 13 } 14 15 /** 16 * Sets function being tested 17 * 18 * @param gtFunction $function 19 */ 20 public function setFunction(gtFunction $function) { 21 $this->function = $function; 22 } 23 24 25 /** 26 * constructs all possible variation testcases in array $this->variationTests 27 * 28 */ 29 public function constructAll() { 30 31 32 $numberOfArguments = count($this->function->getMandatoryArgumentNames()) + count($this->function->getOptionalArgumentNames()); 33 for($i = 1; $i <= $numberOfArguments; $i++) { 34 foreach ($this->dataTypes as $d) { 35 $testCase = gtVariationTestCase::getInstance($this->optionalSections); 36 $testCase->setUp($this->function, $i, $d); 37 $testCase->constructTestCase(); 38 $this->variationTests[] = $testCase->toString(); 39 } 40 } 41 } 42} 43?>