-
Notifications
You must be signed in to change notification settings - Fork 2
/
blackbox.php
67 lines (62 loc) · 1.88 KB
/
blackbox.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
<?php
declare(strict_types = 1);
require 'vendor/autoload.php';
use Innmind\BlackBox\{
Application,
Runner\Load,
Runner\CodeCoverage,
Runner\IO\Collect,
};
use function Innmind\BlackBox\Runner\test;
// This test has to be done here because other tests use global functions
$result = Application::new($argv)
->codeCoverage(
CodeCoverage::of(
__DIR__.'/src/',
__DIR__.'/proofs/',
__DIR__.'/fixtures/',
)
->dumpTo('coverage.clover')
->enableWhen(\getenv('ENABLE_COVERAGE') !== false),
)
->disableGlobalFunctions()
->tryToProve(function() {
yield test(
'Global functions can be disabled',
static fn($assert) => $assert->true(
Application::new([])
->disableGlobalFunctions()
->displayOutputVia(Collect::new())
->displayErrorVia(Collect::new())
->tryToProve(function() {
yield test(
'Test function is not declared',
static fn($assert) => $assert->false(
\function_exists('test'),
),
);
})
->successful(),
),
);
});
if (!$result->successful()) {
$result->exit();
}
Application::new($argv)
->codeCoverage(
CodeCoverage::of(
__DIR__.'/src/',
__DIR__.'/proofs/',
__DIR__.'/fixtures/',
__DIR__.'/tests/',
)
->dumpTo('coverage.clover')
->enableWhen(\getenv('ENABLE_COVERAGE') !== false),
)
->scenariiPerProof(match (\getenv('ENABLE_COVERAGE')) {
false => 100,
default => 1,
})
->tryToProve(Load::everythingIn(__DIR__.'/proofs/'))
->exit();