PHPUnit does not work after upgrade to 4.0.4 - php

This morning I updated my phpunit version from 3.7.x to 4.0.x.
I usually run PHPUnit with a bootstrap which contains
require('PHPUnit/Framework/Assert/Functions.php');
Since the update, when I try to run my phpunit tests, it fails because of the following error:
Fatal error: require(): Failed opening required 'PHPUnit/Framework/Assert/Functions.php' (include_path='.:/usr/local/lib/php/:/usr/local/share/pear/') on line 6
What can I do to resolve this?

That file changed location. It is now in src/Framework/Assert/Functions.php.

Related

Error tests Codeception PhpStorm and Docker

I'm new to testing and I'm doing the test setup with Codeception, PHP, Docker in PhpStorm.
I am having an error when I run my tests. It appears to be something in the phpstorm_helpers container that is created by the IDE at run time.
Follow the error below and my settings.
Fatal error: require_once(): Failed opening required '/usr/src/myapp/vendor/bin/autoload.php' (include_path='.:/usr/local/lib/php') in /opt/.phpstorm_helpers/codeception.php on line 30

Symfony2 deploy failure vendor/autoload.php

I have deployed a Symfony2 application to shared hosting server from local machine. I used a git pull followed by composer install and then i chmoded the app/cache and app/logs permissions to 777.
Each time I run the application I get the following error:
[2016-02-06 18:55:43] request.CRITICAL:
Uncaught PHP Exception Symfony\Component\Debug\Exception\FatalErrorException:
"Compile Error: require(): Failed opening required 'vendor/autoload.php'
(include_path='.:/opt/alt/php55/usr/share/pear:/opt/alt/php55/usr/share/php')" at
/home/tdarlic/public_html/magniblu/users/src/AppBundle/Controller/DefaultController.php line 5 {"exception":"[object]
(Symfony\Component\Debug\Exception\FatalErrorException(code: 0): Compile
Error: require(): Failed opening required 'vendor/autoload.php'
(include_path='.:/opt/alt/php55/usr/share/pear:/opt/alt/php55/usr/share/php') at /home/tdarlic/public_html/magniblu/users/src/AppBundle/Controller/DefaultControll
er.php:5)"} []
I managed to fix this by entering full path to autoload.php:
require '/home/tdarlic/public_html/magniblu/users/vendor/autoload.php';
I tried with
../../../vendor/autoload.php
and with
../../vendor/autoload.php
require __DIR__.'../../vendor.autoload.php';
and still cannot figure out how to keep the autoload file link loading correctly on development machine and on the server.
Any ideas how to solve this?
Similar issue can be found on:
Why my autoload.php of composer doesn't work?

Laravel: How to recover deleted folder from vendor directory

I used composer to get the laravelcollective/html dependency. But later on I did not need this and I accidentally deleted the folder myself without asking composer to do it for me. Now, whenever I try to run a local server or issue the update command with composer I get the following error:
[RuntimeException]
Error Output: PHP Warning: require(/media/adeel/643459A034597650/Projects/Laravel/vendor/laravelcollective/html/src/helpers.php): failed to open stream: No such file or directo
ry in /media/adeel/643459A034597650/Projects/Laravel/vendor/composer/autoload_real.php on line 55
PHP Fatal error: require(): Failed opening required '/media/adeel/643459A034597650/Projects/Laravel/vendor/laravelcollective/html/src/helpers.php' (include_path='.:/usr/share/p
hp:/usr/share/pear') in /media/adeel/643459A034597650/Projects/Laravel/vendor/composer/autoload_real.php on line 55
Even though the /laravelcollective directory does not exist anymore I still get this error. I have tried removing the whole vendor folder from my Laravel project and then issued a composer update command but I get this error:
[RuntimeException]
Error Output: PHP Warning: require(/media/adeel/643459A034597650/Projects/Laravel/bootstrap/../vendor/autoload.php): failed to open stream: No such file or directory in /media/
adeel/643459A034597650/Projects/Laravel/bootstrap/autoload.php on line 17
PHP Fatal error: require(): Failed opening required '/media/adeel/643459A034597650/Projects/Laravel/bootstrap/../vendor/autoload.php' (include_path='.:/usr/share/php:/usr/share
/pear') in /media/adeel/643459A034597650/Projects/Laravel/bootstrap/autoload.php on line 17
It seems the problem was fixed by issuing the install command instead of update. I also removed the composer.lock file from its directory, but I don't think that made a difference.

Laravel Setup: Can't install Monolog

I just tried to install a fresh instance of Laravel as described in the docs ( http://laravel.com/docs/quick#installation - "Via Composer"). Got this error from Composer:
...
Writing lock file
Generating autoload files
PHP Fatal error: Class 'Monolog\Logger' not found in ...\src\vendor\laravel\framework\src\Illuminate\Log\LogServiceProvider.php on line 23
{"error":{"type":"Symfony\\Component\\Debug\\Exception\\FatalErrorException","message":"Class 'Monolog\\Logger' not found","file":"...\\src\\vendor\\laravel\\framework\\src\\Illuminate\\Log\\LogServiceProvider.php","line":23}}Script php artisan clear-c
ompiled handling the post-install-cmd event returned with an error: PHP Fatal error: Class 'Monolog\Logger' not found in ...\src\Illuminate\Log\LogServiceProvider.php on line 23
PHP Fatal error: Class 'Monolog\Logger' not found in ...\src\Illuminate\Log\LogServiceProvider.php on line 23
{"error":{"type":"Symfony\\Component\\Debug\\Exception\\FatalErrorException","message":"Class 'Monolog\\Logger' not found","file":"...\\src\\vendor\\laravel\\framework\\src\\Illuminate\\Log\\LogServiceProvider.php","line":23}}Script php artisan optimiz
e handling the post-install-cmd event returned with an error: PHP Fatal error: Class 'Monolog\Logger' not found in ...\src\Illuminate\Log\LogServiceProvider.php on line 23
Uhm, what to do now? Tried to post it on the official forums but that wasn't possible due to an error there (forums are based on Laravel... yeah that's Karma!).
Solution: "composer dumpautoload -o"

PHPunit test not working

I'm trying to learn zend framework 2 with this phpunit added, but I cannot get it work. I've followed the steps in the official zf2 tutorial (http://framework.zend.com/manual/2.0/en/user-guide/unit-testing.html) and now I'm facing some kind of error message clueless
Warning: require_once(File/Iterator/Autoload.php): failed to open stream: No such file or directory in C:\xampp\php\pear\PHPUnit\Autoload.php on line 64
Fatal error: require_once(): Failed opening required 'File/Iterator/Autoload.php' (include_path='.;\php\zend_framework\library;\php\pear\PEAR') in C:\xampp\php\pear\PHPUnit\Autoload.php on line 64
PS C:\xampp\htdocs\new103\module\Application\test>
Needed to change the php.ini include_path to list of absolute paths, phpunit can be ran now.

Categories