-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathevents.html
More file actions
219 lines (213 loc) · 7.69 KB
/
events.html
File metadata and controls
219 lines (213 loc) · 7.69 KB
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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
---
layout: default
title: Events
type: leaf
---
<h1 class="text-center">Peridot Events</h1>
<p>
Peridot features an event driven architecture. This has not only greatly simplified Peridot's own source code, it also allows testers to easily customize Peridot via plugins and reporters. The Peridot event emitter can be accessed via the peridot.php file:
</p>
{% highlight php %}
<?php //peridot.php
use Evenement\EventEmitterInterface;
use Peridot\Core\Test;
return function(EventEmitterInterface $emitter) {
$emitter->on('test.failed', function (Test $test) {
//log the failure?
//abort abort abort?
//let your loved ones know about your shortcomings?
});
}
{% endhighlight %}
<p>The following events are available for your testing pleasure:</p>
<ul class="reference-list">
<li>
<div><code>peridot.start</code></div>
<p>
Fires when the Peridot application is constructed. Useful for defining additional CLI arguments and options.
</p>
<p>
<strong>Arguments:</strong><br>
<a target="_blank" href="/docs/class-Peridot.Console.Environment.html">Environment</a> <code>$environment</code><br>
<a target="_blank" href="/docs/class-Peridot.Console.Application.html">Application</a> <code>$application</code>
</p>
</li>
<li>
<div><code>peridot.configure</code></div>
<p>
Fires when the Peridot application is configured. Useful for overriding configuration values and configuring the Peridot test runner.
</p>
<p>
<strong>Arguments:</strong><br>
<a target="_blank" href="/docs/class-Peridot.Configuration.html">Configuration</a> <code>$configuration</code><br>
<a target="_blank" href="/docs/class-Peridot.Console.Application.html">Application</a> <code>$application</code>
</p>
</li>
<li>
<div><code>peridot.execute</code></div>
<p>
Fires right before Peridot starts execution. Happens after CLI options are parsed and before specs are loaded.
</p>
<p>
<strong>Arguments:</strong><br>
<a target="_blank" href="/docs/class-Symfony.Component.Console.Input.InputInterface.html">InputInterface</a> <code>$input</code><br>
<a target="_blank" href="/docs/class-Symfony.Component.Console.Output.OutputInterface.html">OutputInterface</a> <code>$output</code>
</p>
</li>
<li>
<div><code>peridot.reporters</code></div>
<p>
Fires when Peridot reporters are registered. Useful for registering additional reporters.
</p>
<p>
<strong>Arguments:</strong><br>
<a target="_blank" href="/docs/class-Symfony.Component.Console.Input.InputInterface.html">InputInterface</a> <code>$input</code><br>
<a target="_blank" href="/docs/class-Peridot.Reporter.ReporterFactory.html">ReporterFactory</a> <code>$reporters</code><br>
</p>
</li>
<li>
<div><code>peridot.load</code></div>
<p>
Fires right before Peridot starts loading tests. Useful for changing loading behavior.
</p>
<p>
<strong>Arguments:</strong><br>
<a target="_blank" href="/docs/class-Peridot.Console.Command.html">Command</a> <code>$command</code><br>
<a target="_blank" href="/docs/class-Peridot.Configuration.html">Configuration</a> <code>$configuration</code><br>
</p>
</li>
<li>
<div><code>peridot.end</code></div>
<p>
Fires when the Peridot application exits.
</p>
<p>
<strong>Arguments:</strong><br>
integer <code>$exitCode</code><br>
<a target="_blank" href="/docs/class-Symfony.Component.Console.Input.InputInterface.html">InputInterface</a> <code>$input</code><br>
<a target="_blank" href="/docs/class-Symfony.Component.Console.Output.OutputInterface.html">OutputInterface</a> <code>$output</code>
</p>
</li>
<li>
<div><code>runner.start</code></div>
<p>
Fires right before the suite runner starts.
</p>
<p>
<strong>Arguments:</strong> No arguments
</p>
</li>
<li>
<div><code>runner.end</code></div>
<p>
Fires right after the suite runner ends.
</p>
<p>
<strong>Arguments:</strong><br>
float <code>$runTime</code>
</p>
</li>
<li>
<div><code>suite.define</code></div>
<p>
Fires right before a suite definition is executed. Ideal for passing arguments to the definition function.
</p>
<p>
<strong>Arguments:</strong><br>
<a target="_blank" href="/docs/class-Peridot.Core.Suite.html">Suite</a> <code>$suite</code>
</p>
</li>
<li>
<div><code>suite.start</code></div>
<p>
Fires right before a suite runs.
</p>
<p>
<strong>Arguments:</strong><br>
<a target="_blank" href="/docs/class-Peridot.Core.Suite.html">Suite</a> <code>$suite</code>
</p>
</li>
<li>
<div><code>suite.end</code></div>
<p>
Fires right after a suite runs.
</p>
<p>
<strong>Arguments:</strong><br>
<a target="_blank" href="/docs/class-Peridot.Core.Suite.html">Suite</a> <code>$suite</code>
</p>
</li>
<li>
<div><code>suite.halt</code></div>
<p>
When fired, this event signals a suite to stop running.
</p>
<p>
<strong>Arguments:</strong> No arguments
</p>
</li>
<li>
<div><code>test.passed</code></div>
<p>
Fires when a test passes.
</p>
<p>
<strong>Arguments:</strong><br>
<a target="_blank" href="/docs/class-Peridot.Core.Test.html">Test</a> <code>$test</code>
</p>
</li>
<li>
<div><code>test.pending</code></div>
<p>
Fires when a test pends.
</p>
<p>
<strong>Arguments:</strong><br>
<a target="_blank" href="/docs/class-Peridot.Core.Test.html">Test</a> <code>$test</code>
</p>
</li>
<li>
<div><code>test.failed</code></div>
<p>
Fires when a test fails.
</p>
<p>
<strong>Arguments:</strong><br>
<a target="_blank" href="/docs/class-Peridot.Core.Test.html">Test</a> <code>$test</code><br>
<a target="_blank" href="/docs/class-Exception.html">Exception</a> <code>$exception</code>
</p>
</li>
<li>
<div><code>test.start</code></div>
<p>
Fires right before a test runs.
</p>
<p>
<strong>Arguments:</strong><br>
<a target="_blank" href="/docs/class-Peridot.Core.Test.html">Test</a> <code>$test</code>
</p>
</li>
<li>
<div><code>test.end</code></div>
<p>
Fires right after a test runs.
</p>
<p>
<strong>Arguments:</strong><br>
<a target="_blank" href="/docs/class-Peridot.Core.Test.html">Test</a> <code>$test</code>
</p>
</li>
<li>
<div><code>error</code></div>
<p>
Fires when a PHP error occurs. The standard error arguments passed to a function registered via PHP's native <code>set_error_handler</code> will be passed to this event.
</p>
<p>
<strong>Arguments:</strong><br>
integer <code>$errno</code><br>
string <code>$errstr</code><br>
string <code>$errfile</code><br>
string <code>$errline</code>
</p>
</li>
</ul>