1<?php
2require_once 'PHPUnit/Framework.php';
3require_once dirname(__FILE__) . '/../src/gtAutoload.php';
4
5
6class gtMethodTest extends PHPUnit_Framework_TestCase
7{
8  public function testGetParams() {
9    $m = new gtMethod('DOMDocument', 'createAttribute');
10    $m->setArgumentNames();
11    $a = $m->getMandatoryArgumentNames();
12    $this->assertEquals($a[0], 'name');
13  }
14
15  public function testConstructor() {
16    $m = new gtMethod('DOMDocument', 'createAttribute');
17    $m->setConstructorArgumentNames();
18    $a = $m->getConstructorArgumentNames();
19    $this->assertEquals($a[0], 'version');
20    $this->assertEquals($a[1], 'encoding');
21  }
22
23  public function testExtraParamList() {
24    $m = new gtMethod('DOMDocument', 'createAttribute');
25    $m->setArgumentNames();
26    $m->setExtraArgumentList();
27    $this->assertEquals('$name, $extra_arg',$m->getExtraArgumentList());
28  }
29
30  public function testShortParamList() {
31    $m = new gtMethod('DOMDocument', 'createAttribute');
32    $m->setArgumentNames();
33    $m->setShortArgumentList();
34    $this->assertEquals('',$m->getShortArgumentList());
35  }
36
37  public function testAllParamList() {
38    $m = new gtMethod('DOMDocument', 'createAttribute');
39    $m->setArgumentNames();
40    $m->setValidArgumentLists();
41    $a = $m->getValidArgumentLists();
42    $this->assertEquals('$name',$a[0]);
43  }
44
45  public function testMaxParamList() {
46    $m = new gtMethod('DOMDocument', 'createAttribute');
47    $m->setArgumentNames();
48    $m->setValidArgumentLists();
49    $this->assertEquals('$name',$m->getMaximumArgumentList());
50  }
51
52
53
54  public function testConstructorList() {
55    $m = new gtMethod('Phar', 'buildFromDirectory');
56    $m->setArgumentNames();
57    $m->setConstructorArgumentNames();
58
59    $m->setConstructorArgumentList();
60    $this->assertEquals('$filename, $flags, $alias, $fileformat',$m->getConstructorArgumentList());
61
62  }
63
64  public function testConstructorInit() {
65    $m = new gtMethod('Phar', 'buildFromDirectory');
66    $m->setArgumentNames();
67    $m->setConstructorArgumentNames();
68
69    $m->setConstructorInitStatements();
70    $a = $m->getConstructorInitStatements();
71    $this->assertEquals('$filename = ',$a[0]);
72    $this->assertEquals('$flags = ',$a[1]);
73    $this->assertEquals('$alias = ',$a[2]);
74    $this->assertEquals('$fileformat = ',$a[3]);
75  }
76
77
78
79
80}
81
82?>