1<?php 2 3/** 4 * Class for simple errors - one too many args and one too few 5 */ 6 7abstract class gtErrorTestCase extends gtTestCase { 8 9 protected $shortArgumentList = ''; 10 protected $longArgumentList = ''; 11 12 13 /** 14 * Return instance of either method or function error test case 15 * 16 * @param string $type 17 * @return test case object 18 */ 19 public static function getInstance($optionalSections, $type = 'function') { 20 21 if($type == 'function') { 22 return new gtErrorTestCaseFunction($optionalSections); 23 } 24 if($type =='method') { 25 return new gtErrorTestCaseMethod($optionalSections); 26 } 27 28 } 29 30 public function getShortArgumentList() { 31 return $this->shortArgumentList; 32 } 33 34 public function getLongArgumentList() { 35 return $this->longArgumentList; 36 } 37 38 public function constructSubjectCalls() { 39 $this->argInit(); 40 41 //Initialise the additional argument 42 $this->testCase[] = "\$extra_arg = "; 43 44 $this->subjectCalls(); 45 } 46 47 public function addErrorEcho() { 48 $this->testCase[] = "echo \"*** Test by calling method or function with incorrect numbers of arguments ***\\n\";"; 49 $this->testCase = gtCodeSnippet::appendBlankLines(1, $this->testCase ); 50 } 51} 52 53?>