{"id":34613640,"url":"https://github.com/true-async/revolt-tests","last_synced_at":"2026-05-27T02:34:06.184Z","repository":{"id":328611288,"uuid":"1116124542","full_name":"true-async/revolt-tests","owner":"true-async","description":"revolt + TrueAsync tests","archived":false,"fork":false,"pushed_at":"2025-12-14T08:58:11.000Z","size":10,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-05-27T02:34:01.935Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/true-async.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-12-14T08:44:40.000Z","updated_at":"2026-04-29T06:37:43.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/true-async/revolt-tests","commit_stats":null,"previous_names":["true-async/revolt-tests"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/true-async/revolt-tests","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/true-async%2Frevolt-tests","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/true-async%2Frevolt-tests/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/true-async%2Frevolt-tests/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/true-async%2Frevolt-tests/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/true-async","download_url":"https://codeload.github.com/true-async/revolt-tests/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/true-async%2Frevolt-tests/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33548246,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-05-27T02:00:06.184Z","response_time":53,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-12-24T14:19:21.809Z","updated_at":"2026-05-27T02:34:06.178Z","avatar_url":"https://github.com/true-async.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Revolt + TrueAsync Integration Tests\n\nThis project tests the integration between [Revolt Event Loop](https://revolt.run) and TrueAsync (PHP's async extension with fiber support).\n\n## Overview\n\nRevolt is a rock-solid event loop for concurrent PHP applications that leverages PHP 8.1's native Fiber implementation. TrueAsync is an extension that provides async/await functionality and coroutine support for PHP.\n\nThis test suite ensures that Revolt works correctly with TrueAsync's fiber handling, garbage collection, and coroutine management.\n\n## Requirements\n\n- PHP 8.6+ with TrueAsync extension enabled (fiber-support)\n- Composer\n\n## Installation\n\n```bash\ncomposer install\n```\n\n## Running Tests\n\nRun all test suites with a single command:\n\n```bash\nphp run_tests.php\n```\n\nOr run individual test suites:\n\n```bash\nphp tests/test_event_loop.php\nphp tests/test_fiber_integration.php\nphp tests/test_streams.php\n```\n\n## Test Suites\n\n### 1. Event Loop Tests (`tests/test_event_loop.php`)\n\nTests core event loop functionality:\n- **Defer execution order** - Validates that deferred callbacks execute in FIFO order\n- **Delay timing** - Verifies accurate timing of delayed callbacks\n- **Repeat with cancellation** - Tests repeating timers and proper cancellation\n- **Callback cancellation** - Ensures cancelled callbacks don't execute\n- **Multiple defer batches** - Tests nested defers and execution order\n\n### 2. Fiber Integration Tests (`tests/test_fiber_integration.php`)\n\nTests Revolt's integration with PHP Fibers:\n- **Fiber suspend/resume** - Basic fiber lifecycle within event loop\n- **Nested fibers** - Fibers created within other fibers\n- **Fiber with delayed resume** - Combining fibers with event loop timers\n- **Multiple fibers scheduling** - Concurrent fiber execution\n- **Exception in fiber** - Proper exception handling in fibers\n\n### 3. Stream I/O Tests (`tests/test_streams.php`)\n\nTests stream handling in the event loop:\n- **Stream readable** - Reading from streams asynchronously\n- **Stream writable** - Writing to streams asynchronously\n- **Stream callback cancellation** - Cancelling stream watchers\n- **Pipe between streams** - Piping data between multiple streams\n\n## Key Issues Tested\n\nThis test suite specifically validates fixes for:\n\n1. **Fiber GC during start**: Ensures that garbage collection during `fiber-\u003estart()` doesn't cause assertion failures in TrueAsync\n2. **Suspended fiber cleanup**: Validates that suspended fibers are properly cleaned up without triggering deadlock detection\n3. **Multiple fiber lifecycle**: Tests creation, suspension, resumption, and destruction of multiple fibers\n\n## Test Results\n\nAll tests should pass with exit code 0:\n\n```\n✅ All tests passed!\n```\n\n## Exit Codes\n\n- `0` - All tests passed\n- `1` - One or more tests failed\n\n## Implementation Notes\n\n### Arrow Functions vs Closures\n\nRevolt requires all callbacks to return `null`. Arrow functions (`fn()`) always return the result of their expression, which violates this requirement. Therefore, all callbacks use regular closures:\n\n```php\n// ❌ Wrong - arrow function returns a value\nEventLoop::defer(fn() =\u003e $value = 'test');\n\n// ✅ Correct - closure returns null\nEventLoop::defer(function() use (\u0026$value) { $value = 'test'; });\n```\n\n### Non-blocking Streams\n\nStream tests use non-blocking mode (`stream_set_blocking($stream, false)`) to work properly with the event loop.\n\n## Contributing\n\nWhen adding new tests:\n1. Create a new test class extending the test pattern\n2. Add the test to `run_tests.php`\n3. Ensure all callbacks return `null`\n4. Use `$this-\u003eassert()` for test assertions\n\n## License\n\nThis is a test project for validating Revolt + TrueAsync integration.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftrue-async%2Frevolt-tests","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftrue-async%2Frevolt-tests","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftrue-async%2Frevolt-tests/lists"}