Back to index

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