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