Migrates to Pint

This commit is contained in:
Nuno Maduro
2022-09-16 10:45:53 +01:00
parent 579b975318
commit e9564febaf
94 changed files with 413 additions and 471 deletions

View File

@ -4,18 +4,18 @@ use Pest\Console\Help;
use Symfony\Component\Console\Output\BufferedOutput;
test('visual snapshot of help command output', function () {
$snapshot = __DIR__ . '/../.snapshots/help-command.txt';
$snapshot = __DIR__.'/../.snapshots/help-command.txt';
if (getenv('REBUILD_SNAPSHOTS')) {
$outputBuffer = new BufferedOutput();
$plugin = new Help($outputBuffer);
$plugin = new Help($outputBuffer);
$plugin();
file_put_contents($snapshot, $outputBuffer->fetch());
}
$output = function () {
$output = function () {
$process = (new Symfony\Component\Process\Process(['php', 'bin/pest', '--help'], null, ['COLLISION_PRINTER' => 'DefaultPrinter', 'COLLISION_IGNORE_DURATION' => 'true']));
$process->run();

View File

@ -6,11 +6,11 @@ use PHPUnit\Framework\TestSuite;
use PHPUnit\Framework\Warning;
beforeEach(function () {
file_put_contents(__DIR__ . '/junit.html', '');
file_put_contents(__DIR__.'/junit.html', '');
});
it('is can successfully call all public methods', function () {
$junit = new JUnit(__DIR__ . '/junit.html');
$junit = new JUnit(__DIR__.'/junit.html');
$junit->startTestSuite(new TestSuite());
$junit->startTest($this);
$junit->addError($this, new Exception(), 0);
@ -25,5 +25,5 @@ it('is can successfully call all public methods', function () {
})->skip('Not supported yet.');
afterEach(function () {
unlink(__DIR__ . '/junit.html');
unlink(__DIR__.'/junit.html');
});

View File

@ -2,7 +2,7 @@
use Symfony\Component\Process\Process;
$run = function (string $target, $decorated = false) {
$run = function (string $target, $decorated = false) {
$process = new Process(['php', 'bin/pest', $target, '--colors=always'], dirname(__DIR__, 2),
['COLLISION_PRINTER' => 'DefaultPrinter', 'COLLISION_IGNORE_DURATION' => 'true'],
);
@ -12,7 +12,7 @@ $run = function (string $target, $decorated = false) {
return $decorated ? $process->getOutput() : preg_replace('#\\x1b[[][^A-Za-z]*[A-Za-z]#', '', $process->getOutput());
};
$snapshot = function ($name) {
$snapshot = function ($name) {
$testsPath = dirname(__DIR__);
return file_get_contents(implode(DIRECTORY_SEPARATOR, [

View File

@ -2,13 +2,13 @@
test('visual snapshot of test suite on success', function () {
$testsPath = dirname(__DIR__);
$snapshot = implode(DIRECTORY_SEPARATOR, [
$snapshot = implode(DIRECTORY_SEPARATOR, [
$testsPath,
'.snapshots',
'success.txt',
]);
$output = function () use ($testsPath) {
$output = function () use ($testsPath) {
$process = (new Symfony\Component\Process\Process(
['php', 'bin/pest'],
dirname($testsPath),
@ -31,12 +31,12 @@ test('visual snapshot of test suite on success', function () {
$outputContent = preg_replace('/Time\: \s+\d+\.\d+s\s+/m', '', $output());
file_put_contents($snapshot, $outputContent);
} elseif (!getenv('EXCLUDE')) {
} elseif (! getenv('EXCLUDE')) {
$output = explode("\n", $output());
array_pop($output);
array_pop($output);
expect(implode("\n", $output))->toContain(file_get_contents($snapshot));
}
})->skip(!getenv('REBUILD_SNAPSHOTS') && getenv('EXCLUDE'))
})->skip(! getenv('REBUILD_SNAPSHOTS') && getenv('EXCLUDE'))
->skip(PHP_OS_FAMILY === 'Windows');

View File

@ -8,11 +8,11 @@ use PHPUnit\Framework\Warning;
use PHPUnit\TextUI\DefaultResultPrinter;
beforeEach(function () {
file_put_contents(__DIR__ . '/output.txt', '');
file_put_contents(__DIR__.'/output.txt', '');
});
it('is can successfully call all public methods', function () {
$teamCity = new TeamCity(__DIR__ . '/output.txt', false, DefaultResultPrinter::COLOR_ALWAYS);
$teamCity = new TeamCity(__DIR__.'/output.txt', false, DefaultResultPrinter::COLOR_ALWAYS);
expect($teamCity::isPestTest($this))->toBeTrue();
$teamCity->startTestSuite(new TestSuite());
$teamCity->startTest($this);
@ -28,5 +28,5 @@ it('is can successfully call all public methods', function () {
})->skip('Not supported yet.');
afterEach(function () {
unlink(__DIR__ . '/output.txt');
unlink(__DIR__.'/output.txt');
});