Comments (4)
Seems like you haven't provided the entire stack trace. Fiber switches are blocked in a few specific places, such as destructors, so there's likely something in your call stack, that's blocking the fiber switch.
from amp.
Thank you:)
https://github.com/hellowork-mhlw/laravel/actions/runs/3901650348/jobs/6663754802
I run it from artisan command. it works
Run vendor/bin/phpunit
PHPUnit 9.5.27 by Sebastian Bergmann and contributors.
.E 2 / 2 (100%)Let's start:
Time: 00:00.136, Memory: 26.00 MB
There was 1 error:
1) Tests\Feature\ExampleTest::test_amphp_vs_pmphp
FiberError: Cannot switch fibers in current execution context
/home/runner/work/laravel/laravel/vendor/revolt/event-loop/src/EventLoop/Internal/AbstractDriver.php:[8](https://github.com/hellowork-mhlw/laravel/actions/runs/3901650348/jobs/6663754802#step:12:9)6
/home/runner/work/laravel/laravel/vendor/revolt/event-loop/src/EventLoop/Internal/DriverSuspension.php:[9](https://github.com/hellowork-mhlw/laravel/actions/runs/3901650348/jobs/6663754802#step:12:10)7
/home/runner/work/laravel/laravel/vendor/amphp/amp/src/Future.php:251
/home/runner/work/laravel/laravel/app/Console/Commands/test.php:58
/home/runner/work/laravel/laravel/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php:36
/home/runner/work/laravel/laravel/vendor/laravel/framework/src/Illuminate/Container/Util.php:41
/home/runner/work/laravel/laravel/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php:93
/home/runner/work/laravel/laravel/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php:35
/home/runner/work/laravel/laravel/vendor/laravel/framework/src/Illuminate/Container/Container.php:651
/home/runner/work/laravel/laravel/vendor/laravel/framework/src/Illuminate/Console/Command.php:182
/home/runner/work/laravel/laravel/vendor/symfony/console/Command/Command.php:312
/home/runner/work/laravel/laravel/vendor/laravel/framework/src/Illuminate/Console/Command.php:151
/home/runner/work/laravel/laravel/vendor/symfony/console/Application.php:[10](https://github.com/hellowork-mhlw/laravel/actions/runs/3901650348/jobs/6663754802#step:12:11)22
/home/runner/work/laravel/laravel/vendor/symfony/console/Application.php:3[14](https://github.com/hellowork-mhlw/laravel/actions/runs/3901650348/jobs/6663754802#step:12:15)
/home/runner/work/laravel/laravel/vendor/symfony/console/Application.php:168
/home/runner/work/laravel/laravel/vendor/laravel/framework/src/Illuminate/Console/Application.php:102
/home/runner/work/laravel/laravel/vendor/laravel/framework/src/Illuminate/Console/Application.php:193
/home/runner/work/laravel/laravel/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php:336
/home/runner/work/laravel/laravel/vendor/laravel/framework/src/Illuminate/Testing/PendingCommand.php:[29](https://github.com/hellowork-mhlw/laravel/actions/runs/3901650348/jobs/6663754802#step:12:30)6
/home/runner/work/laravel/laravel/vendor/laravel/framework/src/Illuminate/Testing/PendingCommand.php:481
/home/runner/work/laravel/laravel/tests/Feature/ExampleTest.php:17
ERRORS!
Tests: 2, Assertions: 1, Errors: 1.
Error: Process completed with exit code 2.
from amp.
Laravel execute code from the destructor;( Is there any workaround? @taylorotwell @GrahamCampbell @crynobone
https://github.com/illuminate/testing/blob/master/PendingCommand.php#L481
/**
* Handle the object's destruction.
*
* @return void
*/
public function __destruct()
{
if ($this->hasExecuted) {
return;
}
$this->run();
}
from amp.
I use Facades:) Thank you @kelunik
This is completely work.
https://github.com/hellowork-mhlw/laravel/blob/9.x/tests/Feature/ExampleTest.php
<?php
namespace Tests\Feature;
use Tests\TestCase;
use Illuminate\Support\Facades\Artisan;
use Symfony\Component\Console\Command\Command;
class ExampleTest extends TestCase
{
/**
* A basic test example.
*
* @return void
*/
public function test_amphp_vs_pmphp()
{
$exitCode = Artisan::call('command:name');
$this->assertSame($exitCode, Command::SUCCESS);
}
}
from amp.
Related Issues (20)
- QUIC support HOT 2
- A concise way of resolving results that may turn out to be Promise, Generator or something else HOT 4
- An object reference sticks in the library HOT 1
- Running an async task in a synchronous application HOT 9
- stream_select hangs forever when FDs > 1024 are used HOT 5
- Getting access to child process data on SIGCHLD in Loop::onSignal. HOT 16
- Confusing diagram in README HOT 6
- Return self in Future::ignore HOT 1
- UnhandledFutureError is hard to debug HOT 2
- Migration guide for combinator functions HOT 5
- 32 bit PHP: Return value of Amp\Loop\NativeDriver::now() must be of the type int, float returned HOT 5
- Functions should require callable instead of closures HOT 10
- Any way to create or get a context for coroutine. HOT 5
- Version confusion HOT 8
- Shouldn't Future::finally() pass the future data to the provided callback? HOT 7
- Event loop terminated without resuming the current suspension (the cause is either a fiber deadlock, or an incorrectly unreferenced/canceled watcher) HOT 3
- Future combinators HOT 8
- When to not to use `async`?
- Comparison with ReactPHP HOT 8
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from amp.