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