-
-
Notifications
You must be signed in to change notification settings - Fork 30
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Phpunit 10 doesn't works with bypass-finals #38
Comments
Hi, I don't use phpunit, so it would be nice if you (or someone else) would resolve this and send a PR |
thanks for your response. after more investigations, I found that the issue was not in bypass, but in phpunit-bridge and it has been already fixed on version 6.2.10. |
Well it doesn't work for me in combination with mockery:
$myserviceSoapClient = \Mockery::mock(MyServiceSoapClient::class); <extensions>
<extension class="MyVendor\MyBundle\tests\Hooks\BypassFinalHook"/>
</extensions> <?php
namespace MyVendor\MyBundle\tests\Hooks;
use DG\BypassFinals;
use PHPUnit\Runner\BeforeTestHook;
final class BypassFinalHook implements BeforeTestHook
{
/** @inheritDoc */
public function executeBeforeTest(string $test): void
{
BypassFinals::enable();
}
} Any ideas? EDIT: nvm: sebastianbergmann/phpunit#4595 |
|
Enabling BypassFinals is quite easy with the new extension system of PHPUnit 10. Just create an extension: final class BypassFinalExtension implements \PHPUnit\Runner\Extension\Extension
{
public function bootstrap(Configuration $configuration, Facade $facade, ParameterCollection $parameters): void
{
BypassFinals::enable();
}
} And at it to the PHPUnit configuration: <extensions>
<bootstrap class="App\Tests\Extensions\BypassFinalExtension"/>
</extensions> |
I added the extension directly to the repository efe2fe0 |
`An error occurred inside PHPUnit.
Message: call_user_func(): Argument #1 ($callback) must be a valid callback, class "PHPUnit\Util\ErrorHandler" not found
Location: /Users/aleksandrsavin/norse/api/vendor/symfony/phpunit-bridge/DeprecationErrorHandler.php:126
#0 [internal function]: Symfony\Bridge\PhpUnit\DeprecationErrorHandler->handleError(2, 'stat(): stat fa...', '/Users/aleksand...', 206)
#1 /Users/aleksandrsavin/norse/api/vendor/dg/bypass-finals/src/NativeWrapper.php(206): stat('/Users/aleksand...')
#2 /Users/aleksandrsavin/norse/api/vendor/dg/bypass-finals/src/NativeWrapper.php(193): DG\NativeWrapper->native('stat', '/Users/aleksand...')
#3 /Users/aleksandrsavin/norse/api/vendor/dg/bypass-finals/src/BypassFinals.php(173): DG\NativeWrapper->url_stat('/Users/aleksand...', 6)
#4 [internal function]: DG\BypassFinals->__call('url_stat', Array)
#5 /Users/aleksandrsavin/norse/api/vendor/phpunit/phpunit/src/Runner/ResultCache/DefaultResultCache.php(56): is_dir('/Users/aleksand...')
#6 /Users/aleksandrsavin/norse/api/vendor/phpunit/phpunit/src/TextUI/Application.php(586): PHPUnit\Runner\ResultCache\DefaultResultCache->__construct('/Users/aleksand...')
#7 /Users/aleksandrsavin/norse/api/vendor/phpunit/phpunit/src/TextUI/Application.php(159): PHPUnit\TextUI\Application->initializeTestResultCache(Object(PHPUnit\TextUI\Configuration\Configuration))
#8 /Users/aleksandrsavin/norse/api/vendor/phpunit/phpunit/phpunit(99): PHPUnit\TextUI\Application->run(Array)
#9 /Users/aleksandrsavin/norse/api/vendor/bin/phpunit(123): include('/Users/aleksand...')
#10 /private/var/folders/fl/4xt09qyx6_g6c4s87yrq3vs80000gn/T/ide-phpunit.php(224): require_once('/Users/aleksand...')
#11 /private/var/folders/fl/4xt09qyx6_g6c4s87yrq3vs80000gn/T/ide-phpunit.php(173): IDE_PHPUnit_Loader::loadByAutoloader('/Users/aleksand...')
#12 /private/var/folders/fl/4xt09qyx6_g6c4s87yrq3vs80000gn/T/ide-phpunit.php(228): IDE_PHPUnit_Loader::init()
#13 {main}`
do you have in plans to adapt bypass for phpunit 10?
The text was updated successfully, but these errors were encountered: