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