-
-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathtest.twig
88 lines (76 loc) · 1.7 KB
/
test.twig
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
83
84
85
86
87
88
{{'<?php'}}
namespace {{testNamespace}};
use {{classFqcn}};
use {{phpunit}} as TestCase;
{% set special = isTrait or isAbstract or isInterface %}
{% if special %}
/**
* Wraps {{className}}.
*/
{% endif %}
{% if isTrait %}
class Test{{className}}
{
use {{className}};
}
{% elseif isInterface %}
class Test{{className}} implements {{className}}
{
//
}
{% elseif isAbstract %}
class Test{{className}} extends {{className}}
{
//
}
{% endif %}
/**
* Auto generated by `phint test`.
*/
class {{className}}Test extends TestCase
{
{% if (newable or special) and setup %}
/**
* @var {{ special ? 'Test' : ''}}{{className}}
*/
protected ${{className|lcfirst}};
{% endif %}
{% if setup %}
public function setUp()
{
parent::setUp();
{% if newable or special %}
$this->{{className|lcfirst}} = new {{ special ? 'Test' : ''}}{{className}};
{% endif %}
}
{% endif %}
{% if teardown %}
public function tearDown()
{
parent::tearDown();
}
{% endif %}
{% for name, method in methods if method.isPublic and not method.isAbstract and not method.maybeMagic %}
{% if naming == 't' %}
public function test{{name|ucfirst}}()
{% elseif naming == 'm' %}
public function test_{{name|snake}}()
{% elseif naming == 'i' %}
/**
* @test
*/
public function it_{{name}}()
{% endif %}
{
{% if method.isStatic %}
$actual = {{className}}::{{name}}();
{% elseif setup %}
$actual = $this->{{className|lcfirst}}->{{name}}();
{% else %}
${{className|lcfirst}} = new {{ special ? 'Test' : ''}}{{className}};
$actual = ${{className|lcfirst}}->{{name}}();
{% endif %}
// $this->assertSame('', $actual);
}
{% endfor %}
}