Skip to content

feat: framework refactor + decouple from Hyperf#349

Draft
binaryfire wants to merge 878 commits intohypervel:0.4from
binaryfire:feature/hyperf-decouple
Draft

feat: framework refactor + decouple from Hyperf#349
binaryfire wants to merge 878 commits intohypervel:0.4from
binaryfire:feature/hyperf-decouple

Conversation

@binaryfire
Copy link
Contributor

Hi @albertcht. This isn't ready yet but I'm opening it as a draft so we can begin discussions and code reviews. The goal of this PR is to refactor Hypervel to be a fully standalone framework that is as close to 1:1 parity with Laravel as possible.

Why one large PR

Sorry about the size of this PR. I tried spreading things across multiple branches but it made my work a lot more difficult. This is effectively a framework refactor - the database package is tightly coupled to many other packages (collections, pagination, pool) as well as several support classes, so all these things need to be updated together. Splitting it across branches would mean each branch needs multiple temporary workarounds + would have failing tests until merged together, making review and CI impractical.

A single large, reviewable PR is less risky than a stack of dependent branches that can't pass CI independently.


Reasons for the refactor

1. Outdated Hyperf packages

It's been difficult to migrate existing Laravel projects to Hypervel because Hyperf's database packages are quite outdated. There are almost 100 missing methods, missing traits, it doesn't support nested transactions, there are old Laravel bugs which haven't been fixed (eg. JSON indices aren't handled correctly), coroutine safety issues (eg. model unguard(), withoutTouching()). Other packages like pagination, collections and support are outdated too. Stringable was missing a bunch of methods and traits, for example. There are just too many to PR to Hyperf at this point.

2. Faster framework development

We need to be able to move quickly and waiting for Hyperf maintainers to merge things adds a lot of friction to framework development. Decoupling means we don't need to work around things like PHP 8.4 compatibility while waiting for it to be added upstream. Hyperf's testing package uses PHPUnit 10 so we can't update to PHPUnit 13 (and Pest 4 in the skeleton) when it releases in a couple of weeks. v13 has the fix that allows RunTestsInCoroutine to work with newer PHPUnit versions. There are lots of examples like this.

3. Parity with Laravel

We need to avoid the same drift from Laravel that's happened with Hyperf since 2019. If we're not proactive with regularly merging Laravel updates every week we'll end up in the same situation. Having a 1:1 directory and code structure to Laravel whenever possible will make this much easier. Especially when using AI tools.

Most importantly, we need to make it easier for Laravel developers to use and contribute to the framework. That means following the same APIs and directory structures and only modifying code when there's a good reason to (coroutine safety, performance, type modernisation etc).

Right now the Hypervel codebase is confusing for both Laravel developers and AI tools:

  • Some classes use Hyperf classes directly, some extend them, some replace them. You need to check multiple places to see what methods are available
  • Some Hyperf methods have old (2019) Laravel signatures while some overridden ones have new ones
  • The classes are in different locations to Laravel (eg. there's no hypervel/contracts package, the Hyperf database code is split across 3 packages, the Hyperf pagination package is hyperf/paginator and not hyperf/pagination)
  • The tests dir structure and class names are different, making it hard to know what tests are missing when comparing them to Laravel's tests dir
  • There are big differences in the API (eg. static::registerCallback('creating') vs static::creating())
  • The mix of Hyperf ConfigProvider and Laravel ServiceProvider patterns across different packages is confusing for anyone who doesn't know Hyperf
  • There are big functional differences eg. no nested database transactions

This makes it difficult for Laravel developers to port over apps and to contribute to the framework.

4. AI

The above issues mean that AI needs a lot of guidance to understand the Hypervel codebase and generate Hypervel boilerplate. A few examples:

  • Models have trained extensively on Laravel code and expect things to have the same API. Generated boilerplate almost always contains incompatible Laravel-style code which means you have to constantly interrupt and guide them to the Hypervel-specific solutions.
  • Models get confused when they have to check both Hypervel and Hyperf dependencies. They start by searching for files in the same locations as Laravel (eg. hypervel/contracts for contracts) and then have to spend a lot of time grepping for things to find them.
  • The inheritance chain causes major problems. Models often search Hypervel classes for methods and won't remember to search the parent Hyperf classes as well.

And so on... This greatly limits the effectiveness of building Hypervel apps with AI. Unfortunately MCP docs servers and CLAUDE.md rules don't solve all these problems - LLMs aren't great at following instructions well and the sheer volume of Laravel data they've trained on means they always default to Laravel-style code. The only solution is 1:1 parity. Small improvements such as adding native type hints are fine - models can solve that kind of thing quickly from exception messages.


What changed so far

New packages

Package Purpose
hypervel/database Full illuminate/database port
hypervel/collections Full illuminate/collections port
hypervel/pagination Full illuminate/pagination port
hypervel/contracts Centralised cross-cutting contracts (same as illuminate/contracts)
hypervel/pool Connection pooling (internalised from hyperf/pool)
hypervel/macroable Moved Macroable to a separate package for Laravel parity

Removed Hyperf dependencies so far

  • hyperf/database
  • hyperf/database-pgsql
  • hyperf/database-sqlite
  • hyperf/db-connection
  • hyperf/collection
  • hyperf/stringable
  • hyperf/tappable
  • hyperf/macroable
  • hyperf/codec

Database package

The big task was porting the database package, making it coroutine safe, implementing performance improvements like static caching and modernising the types.

  • Ported from Laravel 12
  • Added 50+ missing methods: whereLike, whereNot, groupLimit, rawValue, soleValue, JSON operations, etc.
  • Full Schema builder parity including schema states
  • Complete migration system (commands are still using Hyperf generators for now)
  • Both Hyperf and Hypervel previously used global PHPStan ignores on database classes. I removed these and fixed the underlying issues - only legitimate "magic" things are ignored now.

Collections package

  • Full Laravel parity across all methods
  • Modernised with PHP 8.2+ native types
  • Full LazyCollection support
  • Proper generics for static analysis

Contracts package

  • Centralised cross-cutting interfaces (like illuminate/contracts)
  • Clean dependency boundaries - packages depend on contracts, not implementations
  • Enables proper dependency inversion across the framework

Support package

  • Removed hyperf/tappable, hyperf/stringable, hyperf/macroable, hyperf/codec dependencies
  • Freshly ported Str, Env and helper classes from Laravel
  • Consistent use of Hypervel\Context wrappers (will be porting hyperf/context soon)
  • Fixed some existing bugs (eg. Number::useCurrency() wasn't actually setting the currency)

Coroutine safety

  • withoutEvents(), withoutBroadcasting(), withoutTouching() now use Context instead of static properties
  • Added UnsetContextInTaskWorkerListener to clear database context in task workers
  • Added Connection::resetForPool() to prevent state leaks between coroutines
  • Made DatabaseTransactionsManager coroutine-safe
  • Comprehensive tests verify isolation

Benefits

  1. Laravel 1:1 API parity - code from Laravel docs works directly
  2. AI compatibility - AI assistants generate working Hypervel code
  3. Easier contributions - Laravel devs can contribute without learning Hyperf
  4. Reduced maintenance - fewer external dependencies to track and update
  5. Modern PHP - native types throughout, PHP 8.2+ patterns
  6. Better static analysis - proper generics and type hints
  7. Coroutine safety - verified isolation with comprehensive tests

Testing status so far

  • PHPStan passes at level 5
  • All existing tests pass
  • Coroutine isolation tests verify safety

What's left (WIP)

  • Port the remaining Hyperf dependencies
  • Port the full Laravel and Hyperf test suites
  • Documentation updates
  • Your feedback on architectural decisions

The refactor process

Hyperf's Swoole packages like pool, coroutine, context and http-server haven't changed in many years so porting these is straightforward. A lot of the code can be simplified since we don't need SWOW support. And we can still support the ecosystem by contributing any improvements we make back to Hyperf in separate PRs.

Eventually I'll refactor the bigger pieces like the container (contextual binding would be nice!) and the config system (completely drop ConfigProvider and move entirely to service providers). But those will be future PRs. For now the main refactors are the database layer, collections and support classes + the simple Hyperf packages. I'll just port the container and config packages as-is for now.


Let me know if you have any feedback, questions or suggestions. I'm happy to make any changes you want. I suggest we just work through this gradually, as an ongoing task over the next month or so. I'll continue working in this branch and ping you each time I add something new.

@binaryfire binaryfire marked this pull request as draft January 26, 2026 03:51
@binaryfire
Copy link
Contributor Author

binaryfire commented Jan 26, 2026

@albertcht To illustrate how much easier it will be to keep Hypervel in sync with Laravel after this refactor, I asked Claude how long it would take to merge laravel/framework#58461 (as an example) into this branch. This is what it said:

Once the Laravel database tests are ported to Hypervel, incorporating Laravel PRs becomes straightforward:

  1. Fetch the PR diff with `gh pr diff <number> --repo laravel/framework`
  2. Apply the same changes to the equivalent Hypervel files (usually just namespace changes from `Illuminate` → `Hypervel`)
  3. Run the ported tests to verify the behavior matches

  The main work is already done - the logic is identical, just namespaced differently.

  The PR I just looked at would have taken ~5 minutes to apply:
  
  - Add `selectExpression()` method
  - Add two `elseif` checks in `select()` and `addSelect()`
  - Add a type assertion in the types file
  - Run existing tests

So just 5-10 minutes of work with the help of AI tooling! Merging individual PRs is inefficient - merging releases would be better. I can set up a Discord channel where new releases are automatically posted via webhooks. Maybe someone in your team can be responsible for monitoring that channel's notifications and merging updates ever week or 2? I'll only be 1-2 hours of work once the codebases are 1:1.

We should be diligent about staying on top of merging updates. Otherwise we'll end up in in the same as Hyperf - i.e. the codebase being completely out of date with the current Laravel API.

@albertcht albertcht added the breaking-change Breaking changes label Jan 27, 2026
@albertcht
Copy link
Member

Hi @binaryfire ,

Thank you for submitting this PR and for the detailed explanation of the refactor. After reading through it, I strongly agree that this is the best long-term direction for Hypervel.

Refactoring Hypervel into a standalone framework and striving for 1:1 parity with Laravel will indeed solve the current issues regarding deep coupling with Hyperf, maintenance difficulties, outdated versions, and inefficient AI assistance. While this is a difficult step, it is absolutely necessary for the future of the project.

Regarding this refactor and the planning for the v0.4 branch, I have a few thoughts to verify with you:

  • Scope of the v0.4 Refactor: We should clearly define the expected boundaries for the v0.4 branch. Is the plan to remove all Hyperf package dependencies within v0.4? I personally lean towards this approach—if we are refactoring, converting all Hyperf packages to native Hypervel packages would be the cleaner and more sustainable choice in the long run.

  • Database Stability Testing: The database packages are critical and logically complex components of the framework. Before the official v0.4 release, we need to ensure we allocate sufficient time for extensive testing on this part—including the transactions you mentioned and various edge cases—to guarantee data correctness and safety.

  • Documentation of Breaking Changes: Obviously, v0.4 will contain a significant number of breaking changes. Throughout the development process, we need to fully document these changes as we go so we can provide a detailed Upgrade Guide upon release to lower the migration barrier for users.

  • ConfigProvider Support: Just to confirm—based on your description, we will not be removing support for ConfigProvider in v0.4 yet, correct? (Keeping it during this transition phase seems reasonable until the Container and Config systems are fully refactored).

  • Core Component Performance: Regarding future refactors for components like Container, Events, Routes, and HTTP-Server—beyond the primary goal of coroutine safety, I also want to emphasize the importance of benchmark testing. These are the core components of Hypervel and are critical for performance. I hope that while modernizing the architecture, the new refactors will not lead to any performance regression.

Thank you again for dedicating so much effort to driving this forward; this is a massive undertaking. Let's move forward gradually on this branch with ongoing Code Reviews.

@binaryfire
Copy link
Contributor Author

binaryfire commented Jan 28, 2026

Hi @albertcht

Thanks for the detailed response! I'm glad we're aligned on the direction. Let me address each point:

  • Scope of v0.4: I agree - let's do a complete removal of all Hyperf dependencies in v0.4. If we're refactoring, doing it all at once is cleaner than maintaining two architectures in parallel. I'm working on this full-time so I can move quickly - I estimate 3-4 months for the complete port including Container, Config, Console, Router, HTTP Server, everything.

  • ConfigProvider: Actually, I now plan to remove ConfigProvider entirely in v0.4 as part of the complete port. Since we're going all-in on Laravel parity, moving fully to Service Providers makes sense now rather than later.

  • Database Stability: Completely agree - stability and code quality are my top priorities. This is one of the reasons I made that PR to increase PHPStan to level 5. For testing, I'm porting the full Laravel test suite for each package to tests/{PackageName}/Laravel. This gives us all of Laravel's test coverage, and by keeping them in a separate directory instead of mixing them with our own tests, it's easy to see what's missing when comparing against Laravel's test directory. I'm working through the database tests now.

  • Performance: Don't worry - I'm a bit obsessed with performance and optimisation 😄 Whenever I port a Laravel package, I always review Hyperf's implementation first to incorporate any performance optimisations they've made, as well as looking for new opportunities in the ported code (like the static caching I added to the database package). And yes, we should definitely run benchmarks before release to catch anything that may have been missed.

  • Breaking Changes: Since the end state is 1:1 Laravel API parity, I think the upgrade guide becomes simpler than documenting every individual change. It's essentially: "Hypervel now matches Laravel's API exactly, with these Swoole-specific exceptions." Documenting changes as I go would slow things down significantly given how massive the scope of this refactor is. I suggest we figure out the best way to communicate the breaking changes after the refactor is complete, once we have a clear picture of exactly what the exceptions are.

  • Review Process: Rather than leaving the review until the end, I'll ping you when each package is fully complete (src + tests) so you can review it. That way our work is progressive and spread out rather than one massive review at the end.

Let me know your thoughts!

@binaryfire binaryfire force-pushed the feature/hyperf-decouple branch from 8cec3bf to bfffa6f Compare January 30, 2026 06:48
Container aliases (Application.php):
- Add 'migrator' as alias for Migrator::class
- Add 'db.transactions' as alias for DatabaseTransactionsManager::class
- This ensures both string and class access return the same singleton

ConfigProvider:
- Remove incorrect dependency bindings (they created separate singletons)

Ported tests:
- MigrateWithRealpathTest
- MigrationServiceProviderTest (uses get() for Hypervel singleton semantics)
- Updated stub migrations to use Hypervel imports
Migrator now fetches the event dispatcher from the container each time
instead of caching it at construction. This ensures Event::fake() and
other runtime swaps are respected, since the Migrator may be constructed
during bootstrap before fakes are set up.

Also ported MigratorEventsTest from Laravel.
Test ported with namespace/import conversions and typed properties.
Two failures remain that require source code fixes:
- model:show command doesn't exist (ShowModelCommand not ported)
- Observer detection returns 'Closure' (getRawListeners returns ListenerData objects)
Remove Hyperf-style priority system and switch to Laravel-style raw
listener storage. This brings the event dispatcher API in line with
Laravel's conventions while maintaining compatibility with Hyperf
packages that use ListenerInterface.

Key changes:
- Remove priority parameter from listen() across all dispatcher classes
- Store raw listeners (strings/closures/arrays) instead of ListenerData
- Delete ListenerData class (no longer needed)
- Update ListenerProvider to return arrays instead of SplPriorityQueue
- Listeners now execute in registration order (Laravel behavior)
- Simplify ListenerProviderFactory to ignore priority from annotations
- Rewrite EventListCommand to format raw listeners

Hyperf compatibility preserved:
- ListenerProviderFactory still supports ListenerInterface
- Config-based and annotation-based listener registration still works
- Server events (OnWorkerStart, etc.) continue to function

Files changed:
- src/contracts/src/Event/Dispatcher.php
- src/event/src/EventDispatcher.php
- src/event/src/ListenerProvider.php
- src/event/src/ListenerProviderFactory.php
- src/event/src/NullDispatcher.php
- src/event/src/Contracts/ListenerProvider.php
- src/support/src/Testing/Fakes/EventFake.php
- src/devtool/src/Commands/EventListCommand.php
- Deleted: src/event/src/ListenerData.php
Add model:show command ported from Laravel, which displays information
about an Eloquent model including its attributes, relations, events,
and observers. Supports --json flag for JSON output.

Fix ModelInspectorTest by calling withoutMockingConsoleOutput() in
setUp() before parent::setUp(). This prevents DatabaseMigrations from
binding a mock OutputInterface during migrate:fresh, which would
otherwise intercept the real command output.

Add docblock to withoutMockingConsoleOutput() explaining that it must
be called before parent::setUp() when used with DatabaseMigrations.
- Add $fetchUsing property and fetchUsing() method to Query\Builder
- Add fetchUsing parameter to Connection::select() and cursor()
- Update ConnectionInterface to match
- Fix where() type hint to accept queryable types (self|EloquentBuilder|Relation)
- Add Testbench Assert class with assertArraySubset for test compatibility
- Port QueryBuilderTest from Laravel
- Update test mocks to use 4-parameter select() signature (WIP)
- Update porting guide with clearer instructions on handling failures
…ters

- Fix HasInDatabase::toString() to use Expression::getValue() instead of (string) cast
- Update test mocks for Connection::select() 4th fetchUsing parameter
- Port QueryBuilderUpdateTest to Hypervel namespaces
- Port QueryBuilderUpdateTest, QueryBuilderWhereLikeTest, QueryingWithEnumsTest,
  RefreshCommandTest, SchemaBuilderSchemaNameTest, SchemaBuilderTest
- Fix BlueprintState::$primaryKey type to accept Fluent (blueprint commands)
- Fix SQLiteBuilder::getTables() to cast $withSize to bool
- Fix SQLiteBuilder::getColumns() to handle null SQL for views
- Process RequiresDatabase in setUpDatabaseRequirements() BEFORE
  migrations run, allowing tests to skip early when wrong driver
- Port TimestampTypeTest to Hypervel namespaces
- Port MariaDb test directory: MariaDbTestCase, EloquentCastTest,
  EscapeTest, FulltextTest, and connection/schema tests
- Port MySqlTestCase, DatabaseEloquentMySqlIntegrationTest,
  DatabaseMySqlConnectionTest, DatabaseEmulatePreparesMySqlConnectionTest,
  DatabaseMySqlSchemaBuilderAlterTableWithEnumTest, DatabaseMySqlSchemaBuilderTest,
  EloquentCastTest, EscapeTest
- Port MariaDb/JsonLikeTest
- Fix MySqlGrammar::compileTables() - remove unused sprintf argument
- Fix EloquentCastTest mutator to use $this->attributes[] (avoid recursion)
- Update EscapeTest to expect TypeError for array input (strict typing)
- Move DB insert from setUp() to afterRefreshingDatabase() (coroutine context)
- Fix RequiresOperatingSystemFamily vs RequiresOperatingSystem attribute usage
- Convert PostgresTestCase, DatabaseEloquentPostgresIntegrationTest,
  DatabasePostgresConnectionTest, EscapeTest to Hypervel namespaces
- Add proper return types and model property types
The purge() method clears context and flushes the pool, but didn't clear
the $this->connections cache used by SimpleConnectionResolver (non-pooled
mode). This meant tests using runtime config changes wouldn't get fresh
connections with updated config.
- Add search_path and prefix_indexes to pgsql config
- Convert EscapeTest to expect TypeError for array input (strict typing)
- Convert FulltextTest namespace and move DB ops to afterRefreshingDatabase
- Convert JoinLateralTest namespace and fix RequiresOperatingSystem attribute
The DatabaseConnectionResolver caches connections statically, which wasn't
cleared when DB::purge() was called. This caused stale connections with
old config to be returned after config changes.

Fix:
- Add FlushableConnectionResolver interface for resolvers with caches
- DatabaseConnectionResolver implements it with flush() to clear static cache
- DatabaseManager::purge() calls flush() on resolver if it implements interface

Also:
- Port PostgresSchemaBuilderTest to Hypervel namespace
- Move dont_drop config tests to separate files (Swoole requires config
  in defineEnvironment(), not runtime Config::set())
- Port Queue fixtures and tests to Hypervel namespaces
- Add database queue connection to workbench config
- Tests require remote() function (not yet implemented)
Implements remote() to spawn subprocesses for testing scenarios requiring
process isolation (e.g., queue workers with job timeouts).

- Add testbench CLI binary that boots Hypervel and runs console commands
- Add Foundation/Process classes (RemoteCommand, ProcessDecorator, ProcessResult)
- Add helper functions: remote(), package_path(), defined_environment_variables()
- Register testbench binary in composer.json
Move testing utilities to dedicated hypervel/testing package to match
Laravel's structure where Illuminate\Testing is separate from
Illuminate\Foundation\Testing.

Moved classes:
- Constraints (CountInDatabase, HasInDatabase, NotSoftDeletedInDatabase,
  SeeInOrder, SoftDeletedInDatabase)
- PendingCommand
- TestResponse
- TestResponseAssert
…kage

These classes belong in the Testing package per Laravel's structure where
Illuminate\Testing contains Assert, Constraints\ArraySubset, and
Exceptions\InvalidArgumentException.
- Process DefineEnvironment attributes in defineEnvironment() method
  instead of setUpTheTestEnvironmentUsingTestCase(), allowing database
  config to be set before connections are pooled in Swoole

- Move testbench migrations from workbench/migrations/ to migrations/
  (parallel to workbench/, matching Laravel's laravel/migrations/ structure)

- Add workbench/database/{factories,migrations,seeders} structure for
  database_path() to work correctly

- Update default_migration_path() to use testbench package path

- Recombine PostgresSchemaBuilderDontDrop*Test files into main test
  using DefineEnvironment attribute with separate connection names

- Port ConnectorTest using DefineEnvironment for custom SQLite configs
- DatabaseSchemaBlueprintTest: Update namespaces, remove SqlServer tests
  (unsupported), add RefreshDatabase trait with foreign_key_constraints=false
- DatabaseSchemaBuilderTest: Update namespaces, add setUp cleanup for
  connections that call dropAllTables() (can't use transaction-based cleanup)
- DatabaseSqliteConnectionTest: Update namespaces, add return types
- DatabaseSqliteSchemaBuilderTest: Update namespaces, add return types
- EloquentModelConnectionsTest: Update namespaces, add test-specific
  namespace for model classes, add proper type hints, add table cleanup
- EscapeTest: Update namespaces, change testEscapeArray to expect
  TypeError (Hypervel has stricter type hints)
- SchemaBuilderSchemaNameTest: Update namespaces (tests skip on :memory:)
- SchemaStateTest: Update namespaces (tests skip on :memory:)
- Add InteractsWithPublishedFiles trait to testbench for file assertion helpers
Purge and reconnect in setUp to apply foreign_key_constraints config
before tests run. Remove RefreshDatabase trait since manual cleanup
via dropAllTables() is sufficient for these SQL generation tests.

class RollbackCommand extends BaseCommand
{
use ConfirmableTrait;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add Prohibitable trait here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@albertcht Done

@@ -6,9 +6,9 @@

use Hyperf\Command\Concerns\Prohibitable;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

change to Hypervel's Prohibitable here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@albertcht Done

- SeedCommand: switch from Hyperf's Prohibitable to Hypervel's
- RollbackCommand: add missing Prohibitable trait (matches Laravel)
@binaryfire binaryfire force-pushed the feature/hyperf-decouple branch from 80f3ef2 to 94c115e Compare February 6, 2026 07:25
Copy coordinator package (Constants, Coordinator, CoordinatorManager,
Timer, Functions) from hyperf, update namespaces to Hypervel, modernise
types, add method docblocks. Skip deprecated ResumeExitCoordinatorListener
(empty body, depends on unported packages).

Update consumers in foundation, object-pool to use Hypervel\Coordinator.
Rename and update porting guide docs.
Update Hyperf\Coordinator references to Hypervel\Coordinator in
pool, queue, testbench, object-pool (src + tests), and horizon test
worker. Fix phpstan: use self:: instead of static:: for private
static property in CoordinatorManager. Update porting guide to
include consumer update step covering both src/ and tests/.
- Port all 14 Hyperf coordinator tests (CoordinatorTest, FunctionTest, TimerTest)
- Add WORKER_EXIT coordinator cleanup in FunctionTest setUp to prevent
  stale state from RunTestsInCoroutine's post-test cleanup
- Update porting guide: absolute directory paths, drop :void on test methods
- cs-fixer: import ordering after coordinator namespace changes
- Delete unnecessary per-package base test cases (EngineTestCase,
  CoroutineTestCase, GuzzleTestCase) that only added RunTestsInCoroutine
  and redundant Mockery::close()
- Update all 23 test classes to extend Hypervel\Tests\TestCase directly
  with RunTestsInCoroutine trait
- Fix integration base test cases to extend Hypervel\Tests\TestCase and
  remove redundant Mockery::close()
- Remove : void from all test methods for consistency with existing tests
- Remove PHPUnit #[CoversNothing] attributes from Guzzle tests
The trait supports all test server types (HTTP, TCP, WebSocket, HTTP/2),
not just HTTP. Rename trait, properties, and methods to reflect this.
Typed class constants (const string) require PHP 8.3+, which breaks
php-cs-fixer linting on the PHP 8.2 CI runner.
- Fix ContextEnumTest base class to Hypervel\Tests\TestCase, remove :void
- Merge 5 Hyperf non-coroutine tests into ContextTest (override, getOrSet, destroy, request/response context)
- Create ContextCoroutineTest with 8 coroutine tests using RunTestsInCoroutine
- Create ApplicationContextTest adapted from Hyperf (mock Hypervel container contract)
- Create Traits/CoroutineProxyTest with updated namespace in exception message
Update porting doc to require 'use Mockery as m' convention and change
all Mockery:: calls to m:: in 32 test files. Remaining files will be
updated in a follow-up.
Complete the migration from `use Mockery;` / `Mockery::` to
`use Mockery as m;` / `m::` across the remaining test files in
ObjectPool, Queue, Redis, Router, Sanctum, Scout, and Sentry.
AfterEachTestExtension handles Mockery cleanup globally after every
test, making explicit m::close() calls in tearDown unnecessary.
Removed the calls and deleted tearDown methods that existed solely
for this purpose.
Copy and adapt all 4 test files and 6 stubs from hyperf/pool to
tests/Pool/. Key adaptations: Hyperf→Hypervel namespaces, Mockery
alias standardization, ClassInvoker replaced with ReflectionProperty,
container make() mocks removed (Hypervel instantiates Channel and
PoolOption directly), and WORKER_EXIT coordinator cleared in setUp
to prevent stale coordinator state from causing timer closures to
resolve immediately.
Add Hypervel\Support\ClassInvoker for accessing protected/private
members via reflection. Modernized with strict parameter and return
types. Refactor HeartbeatConnectionTest to use it instead of raw
ReflectionProperty calls.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

breaking-change Breaking changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants