mirror of
https://github.com/pestphp/pest.git
synced 2026-03-06 07:47:22 +01:00
feat: basic PHPUnit 10 support
This commit is contained in:
@ -1,20 +0,0 @@
|
||||
<?php
|
||||
|
||||
use NunoMaduro\Collision\Adapters\Phpunit\Printer;
|
||||
use Pest\Actions\AddsDefaults;
|
||||
use PHPUnit\TextUI\DefaultResultPrinter;
|
||||
|
||||
it('sets defaults', function () {
|
||||
$arguments = AddsDefaults::to(['bar' => 'foo']);
|
||||
|
||||
expect($arguments['printer'])->toBeInstanceOf(Printer::class);
|
||||
expect($arguments['bar'])->toBe('foo');
|
||||
});
|
||||
|
||||
it('does not override options', function () {
|
||||
$defaultResultPrinter = new DefaultResultPrinter();
|
||||
|
||||
expect(AddsDefaults::to(['printer' => $defaultResultPrinter]))->tobe([
|
||||
'printer' => $defaultResultPrinter,
|
||||
]);
|
||||
});
|
||||
@ -1,32 +0,0 @@
|
||||
<?php
|
||||
|
||||
use Pest\Actions\AddsTests;
|
||||
use PHPUnit\Framework\TestCase as PhpUnitTestCase;
|
||||
use PHPUnit\Framework\TestSuite;
|
||||
use PHPUnit\Framework\WarningTestCase;
|
||||
|
||||
$closure = function () {
|
||||
};
|
||||
$pestTestCase = new class() extends \PHPUnit\Framework\TestCase {
|
||||
};
|
||||
|
||||
test('default php unit tests', function () {
|
||||
$testSuite = new TestSuite();
|
||||
|
||||
$phpUnitTestCase = new class() extends PhpUnitTestCase {
|
||||
};
|
||||
$testSuite->addTest($phpUnitTestCase);
|
||||
expect($testSuite->tests())->toHaveCount(1);
|
||||
|
||||
AddsTests::to($testSuite, new \Pest\TestSuite(getcwd(), 'tests'));
|
||||
expect($testSuite->tests())->toHaveCount(1);
|
||||
});
|
||||
|
||||
it('removes warnings', function () {
|
||||
$testSuite = new TestSuite();
|
||||
$warningTestCase = new WarningTestCase('No tests found in class "Pest\TestCase".');
|
||||
$testSuite->addTest($warningTestCase);
|
||||
|
||||
AddsTests::to($testSuite, new \Pest\TestSuite(getcwd(), 'tests'));
|
||||
expect($testSuite->tests())->toHaveCount(0);
|
||||
});
|
||||
@ -1,42 +0,0 @@
|
||||
<?php
|
||||
|
||||
use Pest\Actions\ValidatesConfiguration;
|
||||
use Pest\Exceptions\AttributeNotSupportedYet;
|
||||
use Pest\Exceptions\FileOrFolderNotFound;
|
||||
|
||||
it('throws exception when configuration not found', function () {
|
||||
$this->expectException(FileOrFolderNotFound::class);
|
||||
|
||||
ValidatesConfiguration::in([
|
||||
'configuration' => 'foo',
|
||||
]);
|
||||
});
|
||||
|
||||
it('throws exception when `process isolation` is true', function () {
|
||||
$this->expectException(AttributeNotSupportedYet::class);
|
||||
$this->expectExceptionMessage('The PHPUnit attribute `processIsolation` with value `true` is not supported yet.');
|
||||
|
||||
$filename = implode(DIRECTORY_SEPARATOR, [
|
||||
dirname(__DIR__, 2),
|
||||
'Fixtures',
|
||||
'phpunit-in-isolation.xml',
|
||||
]);
|
||||
|
||||
ValidatesConfiguration::in([
|
||||
'configuration' => $filename,
|
||||
]);
|
||||
});
|
||||
|
||||
it('do not throws exception when `process isolation` is false', function () {
|
||||
$filename = implode(DIRECTORY_SEPARATOR, [
|
||||
dirname(__DIR__, 2),
|
||||
'Fixtures',
|
||||
'phpunit-not-in-isolation.xml',
|
||||
]);
|
||||
|
||||
ValidatesConfiguration::in([
|
||||
'configuration' => $filename,
|
||||
]);
|
||||
|
||||
expect(true)->toBeTrue();
|
||||
});
|
||||
Reference in New Issue
Block a user