summaryrefslogtreecommitdiff
path: root/scripts/dev/generate-phpt/src/testcase/gtVariationContainerMethod.php
blob: 0d24337b3b0f72092dbb85c65ee33754081de6a1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
<?php
/**
 * Container for all possible variation test cases for a method
 */
class gtVariationContainerMethod extends gtVariationContainer {

  protected $method;
  protected $optionalSections;

  public function __construct($osl) {
    $this->optionalSections = $osl;
  }


  /**
   * Sets the method to be tested
   *
   * @param gtMethod $method
   */
  public function setMethod(gtMethod $method) {
    $this->method = $method;
  }


  /**
   * Constructs all variation tests in $this_variationTests
   *
   */
  public function constructAll() {

    $numberOfArguments = count($this->method->getMandatoryArgumentNames()) + count($this->method->getOptionalArgumentNames());

    for($i = 1; $i <= $numberOfArguments; $i++) {

      foreach ($this->dataTypes as $d) {

        $testCase = gtVariationTestCase::getInstance($this->optionalSections, 'method');
        $testCase->setUp($this->method, $i, $d);
        $testCase->constructTestCase();
        $this->variationTests[] = $testCase->toString();

      }
    }
  }
}
?>