-
-
Notifications
You must be signed in to change notification settings - Fork 312
/
Todo.php
41 lines (30 loc) · 1.2 KB
/
Todo.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
<?php
use Symfony\Component\Process\Process;
$run = function (string $target, bool $parallel) {
$process = new Process(['php', 'bin/pest', $target, $parallel ? '--parallel' : '', '--colors=always'], dirname(__DIR__, 2),
['COLLISION_PRINTER' => 'DefaultPrinter', 'COLLISION_IGNORE_DURATION' => 'true'],
);
$process->run();
expect($process->getExitCode())->toBe(0);
return removeAnsiEscapeSequences($process->getOutput());
};
$snapshot = function ($name) {
$testsPath = dirname(__DIR__);
return file_get_contents(implode(DIRECTORY_SEPARATOR, [
$testsPath,
'.snapshots',
"$name.txt",
]));
};
test('todos', function () use ($run, $snapshot) {
expect($run('--todos', false))->toContain($snapshot('todos'));
})->skipOnWindows();
test('todos in parallel', function () use ($run, $snapshot) {
expect($run('--todos', true))->toContain($snapshot('todos'));
})->skipOnWindows();
test('todo', function () use ($run, $snapshot) {
expect($run('--todo', false))->toContain($snapshot('todo'));
})->skipOnWindows();
test('todo in parallel', function () use ($run, $snapshot) {
expect($run('--todo', true))->toContain($snapshot('todo'));
})->skipOnWindows();