Back to index

php5  5.3.10
gtVariationTestCaseMethod.php
Go to the documentation of this file.
00001 <?php
00002 
00006 class gtVariationTestCaseMethod extends gtVariationTestCase {
00007 
00008   protected $subject;
00009   protected $argumentNumber;
00010   protected $variationData;
00011   protected $testCase;
00012 
00013   public function __construct($opt) {
00014     $this->optionalSections = $opt;
00015   }
00016 
00024   public function setUp(gtMethod $method, $argumentNumber, $variationData) {
00025     $this->subject = $method;
00026     $this->argumentNumber = $argumentNumber;
00027     $this->variationData = $variationData;
00028   }
00029 
00030 
00035   public function constructTestCase() {
00036     $this->constructCommonHeaders();
00037     
00038     $this->addVariationEcho();
00039     
00040     $this->constructorArgInit();
00041     $this->constructorCreateInstance();
00042     
00043     $this->constructSubjectcalls();
00044     $this->constructCommonClosing();
00045     
00046   }
00047 
00048   public function testHeader() {
00049     $this->testCase[] = "--TEST--";
00050     $this->testCase[] = "Test class ".$this->subject->getClassName()." method ".$this->subject->getName()."() by substituting argument ".$this->argumentNumber." with ".$this->variationData." values.";
00051   }
00052 
00053   public function subjectCalls() {
00054     $this->testCase = gtCodeSnippet::append('loopStart', $this->testCase);
00055     // Construct the argument list to pass to the method being tested
00056     $argumentList = explode(",", $this->subject->getMaximumArgumentList());
00057     $argumentList[$this->argumentNumber -1 ] = "\$var ";
00058     $list = implode(", ", $argumentList);
00059 
00060 
00061     $this->testCase[] = "  var_dump(\$class->".$this->subject->getName()."( ".$list." ) );";
00062     $this->testCase = gtCodeSnippet::append('loopClose', $this->testCase);
00063 
00064   }
00065 
00066 }
00067 
00068 ?>