This repository was archived by the owner on Feb 13, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path_dsl.php
97 lines (85 loc) · 2.18 KB
/
_dsl.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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
<?php
namespace June;
use June\Framework\Factories\HarnessFactory;
use June\Framework\Runtime\Harness;
use RuntimeException;
/**
* Returns the current harness instance.
*/
function harness(): Harness
{
static $instance;
if (! $instance) {
$instance = (new HarnessFactory)->get();
}
return $instance;
}
/**
* Registers a testing step in the form of a bug.
*
* Bug steps are semantically differentiated from tests to separate out
* design from reality.
*
* The $step callback will be executed when the framework reaches the step.
*/
function bug(string $name, callable $steps)
{
harness(null)->bug($name, $steps);
}
/**
* Registers a testing step in the form of a test.
*
* Test steps are semantically differentiated from bugs to separate out
* reality from design.
*
* The $step callback will be executed when the framework reaches the step.
*/
function test(string $name, callable $steps)
{
harness()->test($name, $steps);
}
/**
* When `psy/psysh` is installed, this function can be used to drop into a
* terminal to debug failing test steps.
*/
function tinker(array $context = [])
{
\Psy\debug($context);
}
/**
* Registers a unit to be tested.
*
* The $tests callback will be invoked immediately and should in turn register
* any required test steps for the unit with the framework.
*/
function unit(string $name, callable $tests)
{
harness()->unit($name);
$tests();
}
/**
* Registers a disabled testing step in the form of a bug.
*
* Bug steps are semantically differentiated from tests to separate out
* design from reality.
*
* The $step callback will not be executed and as such this helper can be used
* to temporarily disable a failing test step.
*/
function xbug(string $name, callable $steps)
{
harness()->skipped($name, $steps);
}
/**
* Registers a disabled testing step in the form of a test.
*
* Test steps are semantically differentiated from bugs to separate out
* reality from design.
*
* The $step callback will not be executed and as such this helper can be used
* to temporarily disable a failing test step.
*/
function xtest(string $name, callable $steps)
{
harness()->skipped($name, $steps);
}