refactors Mvc directory and Middleware#257
Conversation
armanist
left a comment
There was a problem hiding this comment.
@Malnutreeto thanks for your contribution, it's a great support for us.
We have github actions on pull requests which runs unit tests. Your pull request isn't passed all the unit tests and the error I'm adding bellow.
You can run the unit tests on your local machine as well to make sure all tests are passed before creating pull request.
The command to run unit tests:
vendor/bin/phpunit --stderr
The error currently captured on this pull request by github actions
> vendor/bin/phpunit --stderr --testdox --coverage-clover coverage.xml
PHP Fatal error: Uncaught Error: Class 'Quantum\Mvc\QtController' not found in /home/runner/work/quantum-php-core/quantum-php-core/tests/Unit/Di/DiTest.php:10
Stack trace:
#0 /home/runner/work/quantum-php-core/quantum-php-core/vendor/phpunit/phpunit/src/Util/FileLoader.php(66): include_once()
#1 /home/runner/work/quantum-php-core/quantum-php-core/vendor/phpunit/phpunit/src/Util/FileLoader.php(4[9](https://github.com/softberg/quantum-php-core/actions/runs/14579401359/job/40920939807?pr=257#step:11:10)): PHPUnit\Util\FileLoader::load()
#2 /home/runner/work/quantum-php-core/quantum-php-core/vendor/phpunit/phpunit/src/Framework/TestSuite.php(398): PHPUnit\Util\FileLoader::checkAndLoad()
#3 /home/runner/work/quantum-php-core/quantum-php-core/vendor/phpunit/phpunit/src/Framework/TestSuite.php(537): PHPUnit\Framework\TestSuite->addTestFile()
#4 /home/runner/work/quantum-php-core/quantum-php-core/vendor/phpunit/phpunit/src/TextUI/TestSuiteMapper.php(67): PHPUnit\Framework\TestSuite->addTestFiles()
#5 /home/runner/work/quantum-php-core/quantum-php-core/vendor/phpunit/phpunit/src/TextUI/Command.php(393): PHPUnit\TextUI\TestSuiteMapper->map( in /home/runner/work/quantum-php-core/quantum-php-core/vendor/phpunit/phpunit/src/TextUI/Command.php on line [10](https://github.com/softberg/quantum-php-core/actions/runs/14579401359/job/40920939807?pr=257#step:11:11)1
Script vendor/bin/phpunit --stderr --testdox --coverage-clover coverage.xml handling the test event returned with error code 255
Error: Process completed with exit code 255.
armanist
left a comment
There was a problem hiding this comment.
Please correct the above issues so we can merge your pull request
|
I tried to resolve test errors but I'm afraid that anything went wrong on my machine, please let me know |
armanist
left a comment
There was a problem hiding this comment.
The unit tests are still failing, I've invited you to repo so you can see the github actions log
| use Quantum\App\App; | ||
| use Exception; | ||
| use Mockery; | ||
| use Quantum\Mvc\RouteDispatcher; |
There was a problem hiding this comment.
Move RouteDispatcher to its right place so all the namespaces are correctly ordered.
Update: see the other change requests, as RouteDispatcher probably shouldn't be used here.
|
Hi Arno, I don't know why those 3 tests fail even with composer dump-autoload command executed. The issue called for streamlining the QtController by implementing a route dispatcher, but I'm currently struggling to find a viable solution. Could you offer some assistance? |
Hello, sure, I'm happy to help you. I checked your code and identified the problems. You have 3 errors in the unit test: 2 ViewCacheHandler not found errors, and one QtController not found error. ViewCacheHandler error: QtController error: I hope I explained it clearly. If you have any questions or need some help, feel free to ask. |
|
Thank you! I'll fix asap! |
|
Hello, I just pushed fix commit but I haven't found VIewCacheHandler.php file (with uppercase I). I also replace QtController where not properly required |
Looks like most of the issues are resolved now, only one error is left: |
|
Got it! Thank you! |
|
Closes #256 |

Hi, i'm glad to contribute to your project! i tried to refactor as issue #253 requires. I refactored the MvcManager class (renamed to RouteDispatcher) by extracting middleware and view cache logic into separate classes — MiddlewareExecutor and ViewCacheHandler. Additionally, i merged the QtController functionality into RouteController, eliminating unnecessary inheritance and simplifying the controller structure.