1<?php 2 3/** 4 * Class for basic test case construction for class methods 5 */ 6class gtBasicTestCaseMethod extends gtBasicTestCase { 7 8 public function __construct($opt) { 9 $this->optionalSections = $opt; 10 } 11 12 /** 13 * Set the method 14 * 15 * @param gtMethod $method 16 */ 17 public function setMethod($method) { 18 $this->subject = $method; 19 } 20 21public function constructTestCase() { 22 $this->constructCommonHeaders(); 23 24 $this->addBasicEcho(); 25 26 $this->constructorArgInit(); 27 $this->constructorCreateInstance(); 28 29 $this->constructSubjectCalls(); 30 31 $this->constructCommonClosing(); 32 33 } 34 35 public function testHeader() { 36 $this->testCase[] = "--TEST--"; 37 $this->testCase[] = "Test class ".$this->subject->getClassName()." method ".$this->subject->getName()."() by calling it with its expected arguments"; 38 39 } 40 41 public function subjectCalls() { 42 $lists = $this->subject->getValidArgumentLists(); 43 44 foreach($lists as $list){ 45 $this->testCase[] = "var_dump( \$class->".$this->subject->getName()."( ".$list." ) );"; 46 $this->testCase = gtCodeSnippet::appendBlankLines(1, $this->testCase ); 47 } 48 $this->testCase = gtCodeSnippet::appendBlankLines(2, $this->testCase ); 49 } 50 51} 52?> 53