mirror of
https://github.com/pestphp/pest.git
synced 2026-03-06 07:47:22 +01:00
fix tests against PhpUnit 10 refactors
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@ -4,6 +4,7 @@ composer.lock
|
|||||||
/vendor/
|
/vendor/
|
||||||
coverage.xml
|
coverage.xml
|
||||||
.phpunit.result.cache
|
.phpunit.result.cache
|
||||||
|
.phpunit.cache
|
||||||
/.php-cs-fixer.php
|
/.php-cs-fixer.php
|
||||||
.php-cs-fixer.cache
|
.php-cs-fixer.cache
|
||||||
.temp/coverage.php
|
.temp/coverage.php
|
||||||
|
|||||||
@ -1,14 +1,15 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
xsi:noNamespaceSchemaLocation="./vendor/phpunit/phpunit/phpunit.xsd"
|
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.0/phpunit.xsd"
|
||||||
colors="true"
|
colors="true"
|
||||||
|
cacheDirectory=".phpunit.cache"
|
||||||
>
|
>
|
||||||
<testsuites>
|
<testsuites>
|
||||||
<testsuite name="default">
|
<testsuite name="default">
|
||||||
<directory suffix=".php">./tests</directory>
|
<directory suffix=".php">./tests</directory>
|
||||||
</testsuite>
|
</testsuite>
|
||||||
</testsuites>
|
</testsuites>
|
||||||
<coverage processUncoveredFiles="true">
|
<coverage>
|
||||||
<include>
|
<include>
|
||||||
<directory suffix=".php">./src</directory>
|
<directory suffix=".php">./src</directory>
|
||||||
</include>
|
</include>
|
||||||
|
|||||||
@ -73,7 +73,7 @@ final class Reflection
|
|||||||
|
|
||||||
return $test === null
|
return $test === null
|
||||||
? static::bindCallable($callable)
|
? static::bindCallable($callable)
|
||||||
: Closure::fromCallable($callable)->bindTo($test)(...$test->getProvidedData());
|
: Closure::fromCallable($callable)->bindTo($test)(...$test->providedData());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -60,13 +60,13 @@ it('guesses if the given argument is a class or function', function () {
|
|||||||
})->covers(TestCoversClass3::class, 'testCoversFunction');
|
})->covers(TestCoversClass3::class, 'testCoversFunction');
|
||||||
|
|
||||||
it('appends CoversNothing to method attributes', function () {
|
it('appends CoversNothing to method attributes', function () {
|
||||||
$phpDoc = (new ReflectionClass($this))->getMethod($this->getName());
|
$phpDoc = (new ReflectionClass($this))->getMethod($this->name());
|
||||||
|
|
||||||
expect(str_contains($phpDoc->getDocComment(), '* @coversNothing'))->toBeTrue();
|
expect(str_contains($phpDoc->getDocComment(), '* @coversNothing'))->toBeTrue();
|
||||||
})->coversNothing();
|
})->coversNothing();
|
||||||
|
|
||||||
it('does not append CoversNothing to other methods', function () {
|
it('does not append CoversNothing to other methods', function () {
|
||||||
$phpDoc = (new ReflectionClass($this))->getMethod($this->getName());
|
$phpDoc = (new ReflectionClass($this))->getMethod($this->name());
|
||||||
|
|
||||||
expect(str_contains($phpDoc->getDocComment(), '* @coversNothing'))->toBeFalse();
|
expect(str_contains($phpDoc->getDocComment(), '* @coversNothing'))->toBeFalse();
|
||||||
});
|
});
|
||||||
|
|||||||
@ -38,8 +38,9 @@ it('allows to call underlying protected/private methods', function () {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('throws error if method do not exist', function () {
|
it('throws error if method do not exist', function () {
|
||||||
test()->name();
|
$user = new User();
|
||||||
})->throws(\ReflectionException::class, 'Call to undefined method PHPUnit\Framework\TestCase::name()');
|
$user->foo();
|
||||||
|
})->throws(Error::class, 'Call to undefined method User::foo()');
|
||||||
|
|
||||||
it('can forward unexpected calls to any global function')->_assertThat();
|
it('can forward unexpected calls to any global function')->_assertThat();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user