php unit not working #950

Closed
opened 2026-02-04 23:08:44 +03:00 by OVERLORD · 2 comments
Owner

Originally created by @ezzra on GitHub (Dec 11, 2018).

The Readme states to use command phpunit for testing. But it looks like this usually does not work for Laravel tools because of the Error no tests executed and one should use ./vendor/bin/phpunit.

But this also runs into errors:

$ ./vendor/bin/phpunit
PHP Fatal error:  Cannot redeclare redirect() (previously declared in /home/user/bookstack/vendor/laravel/framework/src/Illuminate/Foundation/helpers.php:658) in /home/user/bookstack/app/helpers.php on line 136
PHP Stack trace:
PHP   1. {main}() /home/user/bookstack/vendor/phpunit/phpunit/phpunit:0
PHP   2. PHPUnit\TextUI\Command::main() /home/user/bookstack/vendor/phpunit/phpunit/phpunit:53
PHP   3. PHPUnit\TextUI\Command->run() /home/user/bookstack/vendor/phpunit/phpunit/src/TextUI/Command.php:148
PHP   4. PHPUnit\TextUI\Command->handleArguments() /home/user/bookstack/vendor/phpunit/phpunit/src/TextUI/Command.php:159
PHP   5. PHPUnit\TextUI\Command->handleBootstrap() /home/user/bookstack/vendor/phpunit/phpunit/src/TextUI/Command.php:788
PHP   6. PHPUnit\Util\Fileloader::checkAndLoad() /home/user/bookstack/vendor/phpunit/phpunit/src/TextUI/Command.php:991
PHP   7. PHPUnit\Util\Fileloader::load() /home/user/bookstack/vendor/phpunit/phpunit/src/Util/Fileloader.php:48
PHP   8. include_once() /home/user/bookstack/vendor/phpunit/phpunit/src/Util/Fileloader.php:64

I don't know if this is a problem with my setup, but it looks like its a problem in bookstack?

Originally created by @ezzra on GitHub (Dec 11, 2018). The Readme states to use command `phpunit` for testing. But it looks like this usually does not work for Laravel tools because of the Error `no tests executed` and one should use` ./vendor/bin/phpunit`. But this also runs into errors: ``` $ ./vendor/bin/phpunit PHP Fatal error: Cannot redeclare redirect() (previously declared in /home/user/bookstack/vendor/laravel/framework/src/Illuminate/Foundation/helpers.php:658) in /home/user/bookstack/app/helpers.php on line 136 PHP Stack trace: PHP 1. {main}() /home/user/bookstack/vendor/phpunit/phpunit/phpunit:0 PHP 2. PHPUnit\TextUI\Command::main() /home/user/bookstack/vendor/phpunit/phpunit/phpunit:53 PHP 3. PHPUnit\TextUI\Command->run() /home/user/bookstack/vendor/phpunit/phpunit/src/TextUI/Command.php:148 PHP 4. PHPUnit\TextUI\Command->handleArguments() /home/user/bookstack/vendor/phpunit/phpunit/src/TextUI/Command.php:159 PHP 5. PHPUnit\TextUI\Command->handleBootstrap() /home/user/bookstack/vendor/phpunit/phpunit/src/TextUI/Command.php:788 PHP 6. PHPUnit\Util\Fileloader::checkAndLoad() /home/user/bookstack/vendor/phpunit/phpunit/src/TextUI/Command.php:991 PHP 7. PHPUnit\Util\Fileloader::load() /home/user/bookstack/vendor/phpunit/phpunit/src/Util/Fileloader.php:48 PHP 8. include_once() /home/user/bookstack/vendor/phpunit/phpunit/src/Util/Fileloader.php:64 ``` I don't know if this is a problem with my setup, but it looks like its a problem in bookstack?
Author
Owner

@ssddanbrown commented on GitHub (Dec 11, 2018):

From what I can remember, ./vendor/bin/phpunit will load phpunit via composer's autoloader which then causes conflicts since the application will also use the autoloader, and the load-order gets awkward and causes conflicts.

What version of phpunit did you download? I think BookStack requires version 6. That could be the issue here.

@ssddanbrown commented on GitHub (Dec 11, 2018): From what I can remember, ` ./vendor/bin/phpunit` will load phpunit via composer's autoloader which then causes conflicts since the application will also use the autoloader, and the load-order gets awkward and causes conflicts. What version of phpunit did you download? I think BookStack requires version 6. That could be the issue here.
Author
Owner

@ezzra commented on GitHub (Dec 11, 2018):

ok yes its been phpunit 5, I should upgrade to a new LTS... works with phpunit 6

@ezzra commented on GitHub (Dec 11, 2018): ok yes its been phpunit 5, I should upgrade to a new LTS... works with phpunit 6
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/BookStack#950