1<?php
2
3/**
4 * Error test case for a PHP function
5 *
6 */
7class gtErrorTestCaseFunction extends gtErrorTestCase {
8
9  public function __construct($opt) {
10    $this->optionalSections = $opt;
11  }
12
13  /**
14   * Set the function name
15   *
16   * @param string $function
17   */
18  public function setFunction($function) {
19    $this->subject = $function;
20  }
21
22
23  /**
24   * Construct the test case as an array of strings
25   *
26   */
27  public function constructTestCase() {
28    $this->constructCommonHeaders();
29
30    $this->addErrorEcho();
31
32    $this->constructSubjectCalls();
33
34    $this->constructCommonClosing();
35
36  }
37
38
39  public function testHeader() {
40    $this->testCase[] = "--TEST--";
41    $this->testCase[] = "Test function ".$this->subject->getName()."() by calling it more than or less than its expected arguments";
42  }
43
44  public function subjectCalls() {
45    // Construct the argument lists to pass to the function being tested
46    $list = $this->subject->getExtraArgumentList();
47    $this->testCase = gtCodeSnippet::appendBlankLines(1, $this->testCase );
48    $this->testCase[] = "var_dump(".$this->subject->getName()."( ".$list." ) );";
49
50    $list = $this->subject->getShortArgumentList();
51    $this->testCase = gtCodeSnippet::appendBlankLines(1, $this->testCase );
52    $this->testCase[] = "var_dump(".$this->subject->getName()."( ".$list." ) );";
53    $this->testCase = gtCodeSnippet::appendBlankLines(2, $this->testCase );
54  }
55
56}
57?>
58