New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CTestCase PHPUnit 3.7.10 autoload fails #1907

Closed
Ragazzo opened this Issue Dec 31, 2012 · 61 comments

Comments

Projects
None yet
@Ragazzo

Ragazzo commented Dec 31, 2012

I know there are some issues about that (phpunit < 3.7.10) and looks like there were solved but, i got this problem, need to notice that problem occures when tests fails:
When i run unit tests, Yii::autoloader throws Exceptions on not found files, this files:

PHP_invoker.php, PHPUnit_Extensions_Database_TestCase.php, PHPUnit_Extensions_Story_TestCase.php

on
YiiBase::autoload() ...\php\pear\PHPUnit\Util\GlobalState.php:0
So i found that problem again in autoloader order, if i comment spl_autoload_register(array('YiiBase','autoload')); // put yii's autoloader at the end than no exceptions will be thrown by Yii::autoload() even if there is a fail test. But if i run WebTestCase tests Yii autoload throws errors again.
So is it my problem or its a Yii bug or phpunit bug? Btw. spl autoloaders list is correct (Yii autoload is the last one). Could it be because of in YiiBase at the end of the file there is already spl_autoload_register(array('YiiBase','autoload')); ?

@samdark

This comment has been minimized.

Show comment
Hide comment
@samdark

samdark Jan 1, 2013

Member

Which Yii version have you tried?

Member

samdark commented Jan 1, 2013

Which Yii version have you tried?

@Ragazzo

This comment has been minimized.

Show comment
Hide comment
@Ragazzo

Ragazzo Jan 1, 2013

@samdark 1.1.13 but does not matter now, i've discovered that it was my fault, not Yii, i forgot to install some packages, but anyway i found bug on pear installer with readlink function(does not work on XP dont know why). Will close this one.

Ragazzo commented Jan 1, 2013

@samdark 1.1.13 but does not matter now, i've discovered that it was my fault, not Yii, i forgot to install some packages, but anyway i found bug on pear installer with readlink function(does not work on XP dont know why). Will close this one.

@Ragazzo Ragazzo closed this Jan 1, 2013

@nezaboravi

This comment has been minimized.

Show comment
Hide comment
@nezaboravi

nezaboravi Jan 31, 2013

Actually this is not quite correct and should not be closed.
If you are on windows, you can not install PHP_Invoker, since it depends on php extension pcntl, which does not exists for Windows platform. But i think its not a Yii bug, its more likely phpunit bug, but since its a third party, phpunit will not fix it. So for now, looks like on windows platform this can not be solved?

nezaboravi commented Jan 31, 2013

Actually this is not quite correct and should not be closed.
If you are on windows, you can not install PHP_Invoker, since it depends on php extension pcntl, which does not exists for Windows platform. But i think its not a Yii bug, its more likely phpunit bug, but since its a third party, phpunit will not fix it. So for now, looks like on windows platform this can not be solved?

@Ragazzo

This comment has been minimized.

Show comment
Hide comment
@Ragazzo

Ragazzo Jan 31, 2013

@nezaboravi u can find PHP_Invoker package on phpunit.de site, not through pear, and install it manually, works for me. (pear.phpunit.de)

Ragazzo commented Jan 31, 2013

@nezaboravi u can find PHP_Invoker package on phpunit.de site, not through pear, and install it manually, works for me. (pear.phpunit.de)

@ahbowers

This comment has been minimized.

Show comment
Hide comment
@ahbowers

ahbowers Mar 6, 2013

I had the exact same problem but the solution ended up being pretty simple.

Here's how I solved the problem for each file:

PHP_Invoker.php

I suspect this would have worked:

pear install phpunit/PHP_Invoker

but instead I did this:

  • went to pear.phpunit.de
  • manually downloaded PHP_Invoker utility class
  • unzipped the file on my daughter's mac (I'm running Windows)
  • put the "Invoker" directory under C:\xampp\php\pear\PHP
  • put the "Invoker.php" file under C:\xampp\php\pear\PHP

PHPUnit_Extensions_Database_TestCase.php

pear install phpunit/dbUnit

PHPUnit_Extensions_Story_TestCase.php

pear install phpunit/PHPUnit_Story

ahbowers commented Mar 6, 2013

I had the exact same problem but the solution ended up being pretty simple.

Here's how I solved the problem for each file:

PHP_Invoker.php

I suspect this would have worked:

pear install phpunit/PHP_Invoker

but instead I did this:

  • went to pear.phpunit.de
  • manually downloaded PHP_Invoker utility class
  • unzipped the file on my daughter's mac (I'm running Windows)
  • put the "Invoker" directory under C:\xampp\php\pear\PHP
  • put the "Invoker.php" file under C:\xampp\php\pear\PHP

PHPUnit_Extensions_Database_TestCase.php

pear install phpunit/dbUnit

PHPUnit_Extensions_Story_TestCase.php

pear install phpunit/PHPUnit_Story
@wilwade

This comment has been minimized.

Show comment
Hide comment
@wilwade

wilwade Apr 5, 2013

Just an additional note that:

put the "Invoker" directory under C:\xampp\php\pear\PHP
put the "Invoker.php" file under C:\xampp\php\pear\PHP

Also works for those on OSX using MAMP and do not want to go through the mess of getting pcntl running. Although the directory is different. Usually something along the lines of:

$ pear config-get php_dir

Then the subdirectory PHP of the output.
(Mine: /Applications/MAMP/bin/php/php5.4.10/share/pear/PHP)

wilwade commented Apr 5, 2013

Just an additional note that:

put the "Invoker" directory under C:\xampp\php\pear\PHP
put the "Invoker.php" file under C:\xampp\php\pear\PHP

Also works for those on OSX using MAMP and do not want to go through the mess of getting pcntl running. Although the directory is different. Usually something along the lines of:

$ pear config-get php_dir

Then the subdirectory PHP of the output.
(Mine: /Applications/MAMP/bin/php/php5.4.10/share/pear/PHP)

@Sharom

This comment has been minimized.

Show comment
Hide comment
@Sharom

Sharom Jun 14, 2013

It is a bug in YiiBase::autoload(). Incorrect implementation of autoloader if you want.
This implementation breaks logic of class_exists() and should be fixed.

Sharom commented Jun 14, 2013

It is a bug in YiiBase::autoload(). Incorrect implementation of autoloader if you want.
This implementation breaks logic of class_exists() and should be fixed.

@cebe

This comment has been minimized.

Show comment
Hide comment
@cebe

cebe Jun 14, 2013

Member

Can you give a bit more details about what you are talking about? Code line and what is wrong exactly? :)

Member

cebe commented Jun 14, 2013

Can you give a bit more details about what you are talking about? Code line and what is wrong exactly? :)

@Sharom

This comment has been minimized.

Show comment
Hide comment
@Sharom

Sharom Jun 14, 2013

Existence of the file should be checked before include.
And if file does not exists, autoload() should return false.

But it triggers a warning. An you should to use require instead of include.

And what is it?:

return class_exists($className,false) || interface_exists($className,false);

If autoloader is asked it means, that class doesn't exist.
If in your autoloader realy loaded file with expected class — return true, else — false.

For example:

require_once __DIR__.'/../vendor/yiisoft/yii/framework/YiiBase.php';
class_exists('SomeMissingClass', true);
Warning: include(SomeMissingClass.php): failed to open stream: No such file or directory in /.../YiiBase.php on line 421

About problem with PHPUnit:

Configuration read from /Users/roman/Projects/swiftmailer-yii/phpunit.xml.dist

PHP Fatal error:  Uncaught exception 'PHPUnit_Framework_Error_Warning' with message 'include(PHPUnit_Extensions_Database_TestCase.php): failed to open stream: No such file or directory' in /Users/roman/Projects/swiftmailer-yii/vendor/yiisoft/yii/framework/YiiBase.php:421
Stack trace:
#0 /Users/roman/Projects/swiftmailer-yii/vendor/yiisoft/yii/framework/YiiBase.php(421): PHPUnit_Util_ErrorHandler::handleError(2, 'include(PHPUnit...', '/Users/roman/Pr...', 421, Array)
#1 /Users/roman/Projects/swiftmailer-yii/vendor/yiisoft/yii/framework/YiiBase.php(421): YiiBase::autoload()
#2 [internal function]: YiiBase::autoload('PHPUnit_Extensi...')
#3 [internal function]: spl_autoload_call('PHPUnit_Extensi...')
#4 /Users/roman/.local/phpunit37/vendor/phpunit/php-code-coverage/PHP/CodeCoverage/Filter.php(334): class_exists('PHPUnit_Extensi...')
#5 /Users/roman/.local/phpunit37/vendor/phpunit/php-code-coverage/PHP/CodeCoverage/Filter.php(317): PHP_CodeCoverage_Filter->addDirectoryContainingClassToBlacklist('PHPUnit_Extensi...', 2)
#6 /Users/r in /Users/roman/Projects/swiftmailer-yii/vendor/yiisoft/yii/framework/YiiBase.php on line 421

Look at :

#4 /Users/roman/.local/phpunit37/vendor/phpunit/php-code-coverage/PHP/CodeCoverage/Filter.php(334): 
class_exists('PHPUnit_Extensi...')

Calling of class_exists() triggers warning. PHPUnit handles it and convert to Exception. Test fails!

Sharom commented Jun 14, 2013

Existence of the file should be checked before include.
And if file does not exists, autoload() should return false.

But it triggers a warning. An you should to use require instead of include.

And what is it?:

return class_exists($className,false) || interface_exists($className,false);

If autoloader is asked it means, that class doesn't exist.
If in your autoloader realy loaded file with expected class — return true, else — false.

For example:

require_once __DIR__.'/../vendor/yiisoft/yii/framework/YiiBase.php';
class_exists('SomeMissingClass', true);
Warning: include(SomeMissingClass.php): failed to open stream: No such file or directory in /.../YiiBase.php on line 421

About problem with PHPUnit:

Configuration read from /Users/roman/Projects/swiftmailer-yii/phpunit.xml.dist

PHP Fatal error:  Uncaught exception 'PHPUnit_Framework_Error_Warning' with message 'include(PHPUnit_Extensions_Database_TestCase.php): failed to open stream: No such file or directory' in /Users/roman/Projects/swiftmailer-yii/vendor/yiisoft/yii/framework/YiiBase.php:421
Stack trace:
#0 /Users/roman/Projects/swiftmailer-yii/vendor/yiisoft/yii/framework/YiiBase.php(421): PHPUnit_Util_ErrorHandler::handleError(2, 'include(PHPUnit...', '/Users/roman/Pr...', 421, Array)
#1 /Users/roman/Projects/swiftmailer-yii/vendor/yiisoft/yii/framework/YiiBase.php(421): YiiBase::autoload()
#2 [internal function]: YiiBase::autoload('PHPUnit_Extensi...')
#3 [internal function]: spl_autoload_call('PHPUnit_Extensi...')
#4 /Users/roman/.local/phpunit37/vendor/phpunit/php-code-coverage/PHP/CodeCoverage/Filter.php(334): class_exists('PHPUnit_Extensi...')
#5 /Users/roman/.local/phpunit37/vendor/phpunit/php-code-coverage/PHP/CodeCoverage/Filter.php(317): PHP_CodeCoverage_Filter->addDirectoryContainingClassToBlacklist('PHPUnit_Extensi...', 2)
#6 /Users/r in /Users/roman/Projects/swiftmailer-yii/vendor/yiisoft/yii/framework/YiiBase.php on line 421

Look at :

#4 /Users/roman/.local/phpunit37/vendor/phpunit/php-code-coverage/PHP/CodeCoverage/Filter.php(334): 
class_exists('PHPUnit_Extensi...')

Calling of class_exists() triggers warning. PHPUnit handles it and convert to Exception. Test fails!

@Ragazzo

This comment has been minimized.

Show comment
Hide comment
@Ragazzo

Ragazzo Jun 14, 2013

Yes it is a bug, but fix can not be applied because of BC. You need to install all dep. packages to avoid this bug.

Ragazzo commented Jun 14, 2013

Yes it is a bug, but fix can not be applied because of BC. You need to install all dep. packages to avoid this bug.

@Ragazzo

This comment has been minimized.

Show comment
Hide comment
@Ragazzo

Ragazzo Jun 14, 2013

See this PR #2324

Ragazzo commented Jun 14, 2013

See this PR #2324

@Sharom

This comment has been minimized.

Show comment
Hide comment
@Sharom

Sharom Jun 14, 2013

What can I say. Yii...

Sharom commented Jun 14, 2013

What can I say. Yii...

@Ragazzo

This comment has been minimized.

Show comment
Hide comment
@Ragazzo

Ragazzo Jun 14, 2013

Use symfony, kohana, or even laravel, feel free to choose ;)

Ragazzo commented Jun 14, 2013

Use symfony, kohana, or even laravel, feel free to choose ;)

@Sharom

This comment has been minimized.

Show comment
Hide comment
@Sharom

Sharom Jun 14, 2013

My choise is Symfony 2. But now I work with existing project based on Yii.

Sharom commented Jun 14, 2013

My choise is Symfony 2. But now I work with existing project based on Yii.

@cebe

This comment has been minimized.

Show comment
Hide comment
@cebe

cebe Jun 14, 2013

Member

Yii 1.1 was created before there was PSR-0 and namespaces so autoloader was created to rely on include path. This works really nice when following the yii way but causes problems like this with external libraries.
You can easily prepend another autoloader before yii's to handle external library classes:
http://www.yiiframework.com/doc/api/1.1/YiiBase#registerAutoloader-detail

This case is special as PHPUnit tries to detect whether extension is loaded by trying to autoload the classes.
It is not a common case things like this happen so it was not considered when autoloader was created.
Yii 2 will of course follow PSR-0 and solve the problem.

A workaround for this could be to make a custom autoloader, tell him the classes loaded by PHPUnit that are not installed and return true for them without doing anything else. prepend that autoloader before yii autoloader with the function given above. Sounds a bit hacky but will help you in this special case.

Member

cebe commented Jun 14, 2013

Yii 1.1 was created before there was PSR-0 and namespaces so autoloader was created to rely on include path. This works really nice when following the yii way but causes problems like this with external libraries.
You can easily prepend another autoloader before yii's to handle external library classes:
http://www.yiiframework.com/doc/api/1.1/YiiBase#registerAutoloader-detail

This case is special as PHPUnit tries to detect whether extension is loaded by trying to autoload the classes.
It is not a common case things like this happen so it was not considered when autoloader was created.
Yii 2 will of course follow PSR-0 and solve the problem.

A workaround for this could be to make a custom autoloader, tell him the classes loaded by PHPUnit that are not installed and return true for them without doing anything else. prepend that autoloader before yii autoloader with the function given above. Sounds a bit hacky but will help you in this special case.

@Sharom

This comment has been minimized.

Show comment
Hide comment
@Sharom

Sharom Jun 17, 2013

@cebe, PEAR recommendation has been.

Sharom commented Jun 17, 2013

@cebe, PEAR recommendation has been.

@jorgebg

This comment has been minimized.

Show comment
Hide comment
@jorgebg

jorgebg Aug 8, 2013

I solved it installing the following packages:

pear install phpunit/PHPUnit
pear install phpunit/PHPUnit_Selenium
pear install phpunit/PHP_Invoker
pear install phpunit/PHPUnit_Story
pear install phpunit/DbUnit

jorgebg commented Aug 8, 2013

I solved it installing the following packages:

pear install phpunit/PHPUnit
pear install phpunit/PHPUnit_Selenium
pear install phpunit/PHP_Invoker
pear install phpunit/PHPUnit_Story
pear install phpunit/DbUnit
@Ragazzo

This comment has been minimized.

Show comment
Hide comment
@Ragazzo

Ragazzo Aug 8, 2013

yes, that because phpunit uses them internally and when calling class_exists() phpunit do not call it with second param true that forces php to include file and Yii autoload triggers error. so overall it is phpunit bug.

Ragazzo commented Aug 8, 2013

yes, that because phpunit uses them internally and when calling class_exists() phpunit do not call it with second param true that forces php to include file and Yii autoload triggers error. so overall it is phpunit bug.

@Sharom

This comment has been minimized.

Show comment
Hide comment
@Sharom

Sharom Aug 8, 2013

It is not phpunit bug. It is Yii bug. Yii brakes class_exists() logic.

Sharom commented Aug 8, 2013

It is not phpunit bug. It is Yii bug. Yii brakes class_exists() logic.

@Ragazzo

This comment has been minimized.

Show comment
Hide comment
@Ragazzo

Ragazzo commented Aug 8, 2013

@cebe

This comment has been minimized.

Show comment
Hide comment
@cebe

cebe Aug 8, 2013

Member

Calm down boys, yii autoloader is not perfect and PHPUnits usage of class_exists() is also not nice, but we can not change that right now. Workarounds have been described so please stop fighting here.

Member

cebe commented Aug 8, 2013

Calm down boys, yii autoloader is not perfect and PHPUnits usage of class_exists() is also not nice, but we can not change that right now. Workarounds have been described so please stop fighting here.

@Ragazzo

This comment has been minimized.

Show comment
Hide comment
@Ragazzo

Ragazzo Aug 8, 2013

lol, those symfony guys are so symfony) they can not have conversations in normal way, they always trying to say "Yii sucks, Kohana sucks, OtherPhpFw sucks" ))

Ragazzo commented Aug 8, 2013

lol, those symfony guys are so symfony) they can not have conversations in normal way, they always trying to say "Yii sucks, Kohana sucks, OtherPhpFw sucks" ))

@cebe

This comment has been minimized.

Show comment
Hide comment
@cebe

cebe Aug 8, 2013

Member

Nice method name "addDirectoryContainingClassToPHPUnitFilesList" :-D

Member

cebe commented Aug 8, 2013

Nice method name "addDirectoryContainingClassToPHPUnitFilesList" :-D

@Ragazzo

This comment has been minimized.

Show comment
Hide comment
@Ragazzo

Ragazzo commented Aug 8, 2013

@aditya-

This comment has been minimized.

Show comment
Hide comment
@aditya-

aditya- Oct 25, 2013

Hi Team,

I am running acceptance test cases using phpunit-selenium, and codeception ... while executing my phpunit i am getting [RuntimeException]
include(PHP_Invoker.php): failed to open stream: No such file or directory
error ..

even i followed this : #1907 (comment)

and also i re-installed invoker .. but still issue was not solve any suggestions to fix the problem

yii version : 1.1.13
os: Ubuntu 
selenium version : selenium-server-standalone-2.35.0.jar
codeception version: 1.7.1
PHPUnit 3.7.27 

output :


winzest@winzest-System-Product-Name:/usr/share/nginx/www/testprep/app/tests/acceptance/testprerp$ php codecept.phar run acceptance highCept.php --debug
Codeception PHP Testing Framework v1.7.1
Powered by PHPUnit 3.7.27 by Sebastian Bergmann.


Acceptance Tests (1) -----------------------
Running highCept.php                    
Scenario:
* I am on page "/user/login"
* I resize window 1224,768
* I fill field "#LoginForm_username","examsadda@gmail.com"
* I fill field "#LoginForm_password","apple@123"
* I click "input[type="submit"]"
* I click "Dashboard"
* I click "Practice"
 ERROR 

---------------------------------------------


Time: 23.72 seconds, Memory: 15.50Mb

There was 1 error:

---------
1) highCept.php
Sorry, I couldn't click "Practice":
RuntimeException: Call to undefined method WebGuy\hlprSteps::prctQuizAttmpt


  [RuntimeException]  


  [ErrorException]                                                            
  include(PHP_Invoker.php): failed to open stream: No such file or directory  


Exception trace:
 () at /usr/share/nginx/www/testprep/app/vendor/yiisoft/yii/framework/YiiBase.php:421
 Codeception\Subscriber\ErrorHandler->errorHandler() at /usr/share/nginx/www/testprep/app/vendor/yiisoft/yii/framework/YiiBase.php:421
 YiiBase::autoload() at /usr/share/nginx/www/testprep/app/vendor/yiisoft/yii/framework/YiiBase.php:421
 YiiBase::autoload() at n/a:n/a
 spl_autoload_call() at n/a:n/a
 class_exists() at phar:///usr/share/nginx/www/testprep/app/tests/acceptance/testprerp/codecept.phar/vendor/phpunit/phpunit/PHPUnit/Util/GlobalState.php:409
 PHPUnit_Util_GlobalState::addDirectoryContainingClassToPHPUnitFilesList() at phar:///usr/share/nginx/www/testprep/app/tests/acceptance/testprerp/codecept.phar/vendor/phpunit/phpunit/PHPUnit/Util/GlobalState.php:388
 PHPUnit_Util_GlobalState::phpunitFiles() at phar:///usr/share/nginx/www/testprep/app/tests/acceptance/testprerp/codecept.phar/vendor/phpunit/phpunit/PHPUnit/Util/Filter.php:76
 PHPUnit_Util_Filter::getFilteredStacktrace() at phar:///usr/share/nginx/www/testprep/app/tests/acceptance/testprerp/codecept.phar/src/Codeception/Subscriber/Console.php:231
 Codeception\Subscriber\Console->printException() at phar:///usr/share/nginx/www/testprep/app/tests/acceptance/testprerp/codecept.phar/src/Codeception/Subscriber/Console.php:216
 Codeception\Subscriber\Console->printScenarioFail() at phar:///usr/share/nginx/www/testprep/app/tests/acceptance/testprerp/codecept.phar/src/Codeception/Subscriber/Console.php:180
 Codeception\Subscriber\Console->printFail() at n/a:n/a
 call_user_func() at phar:///usr/share/nginx/www/testprep/app/tests/acceptance/testprerp/codecept.phar/vendor/symfony/event-dispatcher/Symfony/Component/EventDispatcher/EventDispatcher.php:164
 Symfony\Component\EventDispatcher\EventDispatcher->doDispatch() at phar:///usr/share/nginx/www/testprep/app/tests/acceptance/testprerp/codecept.phar/vendor/symfony/event-dispatcher/Symfony/Component/EventDispatcher/EventDispatcher.php:53
 Symfony\Component\EventDispatcher\EventDispatcher->dispatch() at phar:///usr/share/nginx/www/testprep/app/tests/acceptance/testprerp/codecept.phar/src/Codeception/PHPUnit/ResultPrinter/UI.php:21
 Codeception\PHPUnit\ResultPrinter\UI->printDefect() at phar:///usr/share/nginx/www/testprep/app/tests/acceptance/testprerp/codecept.phar/vendor/phpunit/phpunit/PHPUnit/TextUI/ResultPrinter.php:225
 PHPUnit_TextUI_ResultPrinter->printDefects() at phar:///usr/share/nginx/www/testprep/app/tests/acceptance/testprerp/codecept.phar/vendor/phpunit/phpunit/PHPUnit/TextUI/ResultPrinter.php:295
 PHPUnit_TextUI_ResultPrinter->printErrors() at phar:///usr/share/nginx/www/testprep/app/tests/acceptance/testprerp/codecept.phar/vendor/phpunit/phpunit/PHPUnit/TextUI/ResultPrinter.php:155
 PHPUnit_TextUI_ResultPrinter->printResult() at phar:///usr/share/nginx/www/testprep/app/tests/acceptance/testprerp/codecept.phar/src/Codeception/Codecept.php:144
 Codeception\Codecept->printResult() at phar:///usr/share/nginx/www/testprep/app/tests/acceptance/testprerp/codecept.phar/src/Codeception/Command/Run.php:103
 Codeception\Command\Run->execute() at phar:///usr/share/nginx/www/testprep/app/tests/acceptance/testprerp/codecept.phar/vendor/symfony/console/Symfony/Component/Console/Command/Command.php:244
 Symfony\Component\Console\Command\Command->run() at phar:///usr/share/nginx/www/testprep/app/tests/acceptance/testprerp/codecept.phar/vendor/symfony/console/Symfony/Component/Console/Application.php:897
 Symfony\Component\Console\Application->doRunCommand() at phar:///usr/share/nginx/www/testprep/app/tests/acceptance/testprerp/codecept.phar/vendor/symfony/console/Symfony/Component/Console/Application.php:191
 Symfony\Component\Console\Application->doRun() at phar:///usr/share/nginx/www/testprep/app/tests/acceptance/testprerp/codecept.phar/vendor/symfony/console/Symfony/Component/Console/Application.php:121
 Symfony\Component\Console\Application->run() at phar:///usr/share/nginx/www/testprep/app/tests/acceptance/testprerp/codecept.phar/codecept:29
 require_once() at /usr/share/nginx/www/testprep/app/tests/acceptance/testprerp/codecept.phar:7


run [-c|--config="..."] [--report] [--html] [--xml] [--tap] [--json] [--colors] [--no-colors] [--silent] [--steps] [-d|--debug] [--coverage] [--no-exit] [--defer-flush] [-g|--group="..."] [-s|--skip="..."] [--skip-group="..."] [suite] [test]


please suggest me something to fix the problem ..

@Ragazzo any ideas ? @yiisoft ... please look at here once

aditya- commented Oct 25, 2013

Hi Team,

I am running acceptance test cases using phpunit-selenium, and codeception ... while executing my phpunit i am getting [RuntimeException]
include(PHP_Invoker.php): failed to open stream: No such file or directory
error ..

even i followed this : #1907 (comment)

and also i re-installed invoker .. but still issue was not solve any suggestions to fix the problem

yii version : 1.1.13
os: Ubuntu 
selenium version : selenium-server-standalone-2.35.0.jar
codeception version: 1.7.1
PHPUnit 3.7.27 

output :


winzest@winzest-System-Product-Name:/usr/share/nginx/www/testprep/app/tests/acceptance/testprerp$ php codecept.phar run acceptance highCept.php --debug
Codeception PHP Testing Framework v1.7.1
Powered by PHPUnit 3.7.27 by Sebastian Bergmann.


Acceptance Tests (1) -----------------------
Running highCept.php                    
Scenario:
* I am on page "/user/login"
* I resize window 1224,768
* I fill field "#LoginForm_username","examsadda@gmail.com"
* I fill field "#LoginForm_password","apple@123"
* I click "input[type="submit"]"
* I click "Dashboard"
* I click "Practice"
 ERROR 

---------------------------------------------


Time: 23.72 seconds, Memory: 15.50Mb

There was 1 error:

---------
1) highCept.php
Sorry, I couldn't click "Practice":
RuntimeException: Call to undefined method WebGuy\hlprSteps::prctQuizAttmpt


  [RuntimeException]  


  [ErrorException]                                                            
  include(PHP_Invoker.php): failed to open stream: No such file or directory  


Exception trace:
 () at /usr/share/nginx/www/testprep/app/vendor/yiisoft/yii/framework/YiiBase.php:421
 Codeception\Subscriber\ErrorHandler->errorHandler() at /usr/share/nginx/www/testprep/app/vendor/yiisoft/yii/framework/YiiBase.php:421
 YiiBase::autoload() at /usr/share/nginx/www/testprep/app/vendor/yiisoft/yii/framework/YiiBase.php:421
 YiiBase::autoload() at n/a:n/a
 spl_autoload_call() at n/a:n/a
 class_exists() at phar:///usr/share/nginx/www/testprep/app/tests/acceptance/testprerp/codecept.phar/vendor/phpunit/phpunit/PHPUnit/Util/GlobalState.php:409
 PHPUnit_Util_GlobalState::addDirectoryContainingClassToPHPUnitFilesList() at phar:///usr/share/nginx/www/testprep/app/tests/acceptance/testprerp/codecept.phar/vendor/phpunit/phpunit/PHPUnit/Util/GlobalState.php:388
 PHPUnit_Util_GlobalState::phpunitFiles() at phar:///usr/share/nginx/www/testprep/app/tests/acceptance/testprerp/codecept.phar/vendor/phpunit/phpunit/PHPUnit/Util/Filter.php:76
 PHPUnit_Util_Filter::getFilteredStacktrace() at phar:///usr/share/nginx/www/testprep/app/tests/acceptance/testprerp/codecept.phar/src/Codeception/Subscriber/Console.php:231
 Codeception\Subscriber\Console->printException() at phar:///usr/share/nginx/www/testprep/app/tests/acceptance/testprerp/codecept.phar/src/Codeception/Subscriber/Console.php:216
 Codeception\Subscriber\Console->printScenarioFail() at phar:///usr/share/nginx/www/testprep/app/tests/acceptance/testprerp/codecept.phar/src/Codeception/Subscriber/Console.php:180
 Codeception\Subscriber\Console->printFail() at n/a:n/a
 call_user_func() at phar:///usr/share/nginx/www/testprep/app/tests/acceptance/testprerp/codecept.phar/vendor/symfony/event-dispatcher/Symfony/Component/EventDispatcher/EventDispatcher.php:164
 Symfony\Component\EventDispatcher\EventDispatcher->doDispatch() at phar:///usr/share/nginx/www/testprep/app/tests/acceptance/testprerp/codecept.phar/vendor/symfony/event-dispatcher/Symfony/Component/EventDispatcher/EventDispatcher.php:53
 Symfony\Component\EventDispatcher\EventDispatcher->dispatch() at phar:///usr/share/nginx/www/testprep/app/tests/acceptance/testprerp/codecept.phar/src/Codeception/PHPUnit/ResultPrinter/UI.php:21
 Codeception\PHPUnit\ResultPrinter\UI->printDefect() at phar:///usr/share/nginx/www/testprep/app/tests/acceptance/testprerp/codecept.phar/vendor/phpunit/phpunit/PHPUnit/TextUI/ResultPrinter.php:225
 PHPUnit_TextUI_ResultPrinter->printDefects() at phar:///usr/share/nginx/www/testprep/app/tests/acceptance/testprerp/codecept.phar/vendor/phpunit/phpunit/PHPUnit/TextUI/ResultPrinter.php:295
 PHPUnit_TextUI_ResultPrinter->printErrors() at phar:///usr/share/nginx/www/testprep/app/tests/acceptance/testprerp/codecept.phar/vendor/phpunit/phpunit/PHPUnit/TextUI/ResultPrinter.php:155
 PHPUnit_TextUI_ResultPrinter->printResult() at phar:///usr/share/nginx/www/testprep/app/tests/acceptance/testprerp/codecept.phar/src/Codeception/Codecept.php:144
 Codeception\Codecept->printResult() at phar:///usr/share/nginx/www/testprep/app/tests/acceptance/testprerp/codecept.phar/src/Codeception/Command/Run.php:103
 Codeception\Command\Run->execute() at phar:///usr/share/nginx/www/testprep/app/tests/acceptance/testprerp/codecept.phar/vendor/symfony/console/Symfony/Component/Console/Command/Command.php:244
 Symfony\Component\Console\Command\Command->run() at phar:///usr/share/nginx/www/testprep/app/tests/acceptance/testprerp/codecept.phar/vendor/symfony/console/Symfony/Component/Console/Application.php:897
 Symfony\Component\Console\Application->doRunCommand() at phar:///usr/share/nginx/www/testprep/app/tests/acceptance/testprerp/codecept.phar/vendor/symfony/console/Symfony/Component/Console/Application.php:191
 Symfony\Component\Console\Application->doRun() at phar:///usr/share/nginx/www/testprep/app/tests/acceptance/testprerp/codecept.phar/vendor/symfony/console/Symfony/Component/Console/Application.php:121
 Symfony\Component\Console\Application->run() at phar:///usr/share/nginx/www/testprep/app/tests/acceptance/testprerp/codecept.phar/codecept:29
 require_once() at /usr/share/nginx/www/testprep/app/tests/acceptance/testprerp/codecept.phar:7


run [-c|--config="..."] [--report] [--html] [--xml] [--tap] [--json] [--colors] [--no-colors] [--silent] [--steps] [-d|--debug] [--coverage] [--no-exit] [--defer-flush] [-g|--group="..."] [-s|--skip="..."] [--skip-group="..."] [suite] [test]


please suggest me something to fix the problem ..

@Ragazzo any ideas ? @yiisoft ... please look at here once

@samdark

This comment has been minimized.

Show comment
Hide comment
@samdark

samdark Oct 25, 2013

Member

Should be either your PHPUnit local issue or Codeception issue. These exact tests are runned constantly via Travis (that's PHPUnit w/o Codeception).

Member

samdark commented Oct 25, 2013

Should be either your PHPUnit local issue or Codeception issue. These exact tests are runned constantly via Travis (that's PHPUnit w/o Codeception).

@aditya-

This comment has been minimized.

Show comment
Hide comment
@aditya-

aditya- Oct 26, 2013

Hi @samdark

Thanks for your replay ... Any suggestions to fix

[RuntimeException]

[ErrorException]
include(PHP_Invoker.php): failed to open stream: No such file or directory

like adjusting yiibase.php or adding some packages anything ?

aditya- commented Oct 26, 2013

Hi @samdark

Thanks for your replay ... Any suggestions to fix

[RuntimeException]

[ErrorException]
include(PHP_Invoker.php): failed to open stream: No such file or directory

like adjusting yiibase.php or adding some packages anything ?

@aditya-

This comment has been minimized.

Show comment
Hide comment
@aditya-

aditya- Oct 26, 2013

@DavertMik please look here once

aditya- commented Oct 26, 2013

@DavertMik please look here once

@Ragazzo

This comment has been minimized.

Show comment
Hide comment
@Ragazzo

Ragazzo Oct 26, 2013

are you sure you have installed PHP_Invoker? go to your pear folder and check if it there, if no you can download package manually and put it under that folder.

Ragazzo commented Oct 26, 2013

are you sure you have installed PHP_Invoker? go to your pear folder and check if it there, if no you can download package manually and put it under that folder.

@samdark

This comment has been minimized.

Show comment
Hide comment
@samdark

samdark Oct 26, 2013

Member

@Sharom that's not relevant unless you're suggesting Yii2 :)

Member

samdark commented Oct 26, 2013

@Sharom that's not relevant unless you're suggesting Yii2 :)

@aditya-

This comment has been minimized.

Show comment
Hide comment
@aditya-

aditya- Oct 26, 2013

I tried both ways..

  1. directly installing via package
  2. Copy files to pear folder

but still its not working .. getting headache with this ..

Anyone please suggest ..

aditya- commented Oct 26, 2013

I tried both ways..

  1. directly installing via package
  2. Copy files to pear folder

but still its not working .. getting headache with this ..

Anyone please suggest ..

@samdark

This comment has been minimized.

Show comment
Hide comment
@samdark

samdark Oct 26, 2013

Member

@aditya- can you try PhpUnit w/o Codeception? i.e. from tests dir run phpunit framework.

Member

samdark commented Oct 26, 2013

@aditya- can you try PhpUnit w/o Codeception? i.e. from tests dir run phpunit framework.

@cebe

This comment has been minimized.

Show comment
Hide comment
@cebe

cebe Oct 26, 2013

Member

@aditya- make sure yii autoloader is the last one in the autoloader chain.

OR include PHP_Invoker.php explicitly in phpunit bootstrap file to work around it.

Member

cebe commented Oct 26, 2013

@aditya- make sure yii autoloader is the last one in the autoloader chain.

OR include PHP_Invoker.php explicitly in phpunit bootstrap file to work around it.

@aditya-

This comment has been minimized.

Show comment
Hide comment
@aditya-

aditya- Oct 26, 2013

Hi @samdark
yes i have some unit + functional test cases which are written in phpunit ... its there in tests folder .. after i run those functional tests ..after some scenarios i am getting same error ..

[ErrorException]

include(PHP_Invoker.php): failed to open stream: No such file or directory

aditya- commented Oct 26, 2013

Hi @samdark
yes i have some unit + functional test cases which are written in phpunit ... its there in tests folder .. after i run those functional tests ..after some scenarios i am getting same error ..

[ErrorException]

include(PHP_Invoker.php): failed to open stream: No such file or directory
@aditya-

This comment has been minimized.

Show comment
Hide comment
@aditya-

aditya- Oct 26, 2013

@cebe

Thanks for the idea ... i am just wondering still its throwing same error

aditya- commented Oct 26, 2013

@cebe

Thanks for the idea ... i am just wondering still its throwing same error

@samdark

This comment has been minimized.

Show comment
Hide comment
@aditya-

This comment has been minimized.

Show comment
Hide comment
@aditya-

aditya- Oct 26, 2013

yeah !!!

First of all Thanks @samdark .. For helping me to fix this issue ..

i tried this before i posted here.. i got this from Google.. i think so but ... this is also not fixed the issue .. after that i tried manually replacing invoker files in pear folder

aditya- commented Oct 26, 2013

yeah !!!

First of all Thanks @samdark .. For helping me to fix this issue ..

i tried this before i posted here.. i got this from Google.. i think so but ... this is also not fixed the issue .. after that i tried manually replacing invoker files in pear folder

@Sharom

This comment has been minimized.

Show comment
Hide comment
@Sharom

Sharom Oct 26, 2013

@samdark, на сколько я знаю, ты из России. Так вот, на чистом русском: Yii - дерьмо. Часть 1 и часть 2.

Sharom commented Oct 26, 2013

@samdark, на сколько я знаю, ты из России. Так вот, на чистом русском: Yii - дерьмо. Часть 1 и часть 2.

@samdark

This comment has been minimized.

Show comment
Hide comment
@samdark

samdark Oct 26, 2013

Member

@Sharom ну ок :)

Member

samdark commented Oct 26, 2013

@Sharom ну ок :)

@yvgorshkov

This comment has been minimized.

Show comment
Hide comment
@yvgorshkov

yvgorshkov Oct 26, 2013

@Sharom, не будь балаболом, приведи факты.

yvgorshkov commented Oct 26, 2013

@Sharom, не будь балаболом, приведи факты.

@Sharom

This comment has been minimized.

Show comment
Hide comment
@Sharom

Sharom Oct 26, 2013

В чем ОК? Вы делаете дерьмо.

Sharom commented Oct 26, 2013

В чем ОК? Вы делаете дерьмо.

@Sharom

This comment has been minimized.

Show comment
Hide comment
@Sharom

Sharom Oct 26, 2013

@yvgorshkov, станешь программистом, сам увидишь факты.

Sharom commented Oct 26, 2013

@yvgorshkov, станешь программистом, сам увидишь факты.

@yvgorshkov

This comment has been minimized.

Show comment
Hide comment
@yvgorshkov

yvgorshkov Oct 26, 2013

@samdark не обращай внимания, таких балаболов и хYесосоB дохера. Возможно он просто бухой.
@Sharom завались.

yvgorshkov commented Oct 26, 2013

@samdark не обращай внимания, таких балаболов и хYесосоB дохера. Возможно он просто бухой.
@Sharom завались.

@Sharom

This comment has been minimized.

Show comment
Hide comment
@Sharom

Sharom Oct 26, 2013

@yvgorshkov, я трезв. Я не переношу дерьмовые продукты. Вроде Yii.
Масса времени, потраченная в пустую.

Sharom commented Oct 26, 2013

@yvgorshkov, я трезв. Я не переношу дерьмовые продукты. Вроде Yii.
Масса времени, потраченная в пустую.

@samdark

This comment has been minimized.

Show comment
Hide comment
@samdark

samdark Oct 26, 2013

Member

For English-speaking people: sorry that we're using Russian. Don't spend time translating, it's just offtopic chat that doesn't have anything to do with the problem described in the ticket.

@yvgorshkov не стоит переходить на личности и материться.

@Sharom

  1. github, а тем более тикет по конкретной проблеме — ну лучшее место для подобных заявлений. Просто не в тему. Хотите поговорить об этом — пишите на форум http://yiiframework.ru/ или http://yiiframework.com/ в русскоязычный раздел. Ну или можно мне в почту: sam@rmcreative.ru.
  2. Каждый имеет право на своё мнение, но если хотите что-то доказать остальным, желательно всё-таки аргументировать.
Member

samdark commented Oct 26, 2013

For English-speaking people: sorry that we're using Russian. Don't spend time translating, it's just offtopic chat that doesn't have anything to do with the problem described in the ticket.

@yvgorshkov не стоит переходить на личности и материться.

@Sharom

  1. github, а тем более тикет по конкретной проблеме — ну лучшее место для подобных заявлений. Просто не в тему. Хотите поговорить об этом — пишите на форум http://yiiframework.ru/ или http://yiiframework.com/ в русскоязычный раздел. Ну или можно мне в почту: sam@rmcreative.ru.
  2. Каждый имеет право на своё мнение, но если хотите что-то доказать остальным, желательно всё-таки аргументировать.
@aditya-

This comment has been minimized.

Show comment
Hide comment
@aditya-

aditya- Oct 26, 2013

@samdark

lol .. Thanks for understanding our problem ;-) but yii is great framework ..

aditya- commented Oct 26, 2013

@samdark

lol .. Thanks for understanding our problem ;-) but yii is great framework ..

@aditya-

This comment has been minimized.

Show comment
Hide comment
@aditya-

aditya- Oct 26, 2013

@samdark
i am translating every bit till now .. for any luck ..finally you clarified .. 👍

aditya- commented Oct 26, 2013

@samdark
i am translating every bit till now .. for any luck ..finally you clarified .. 👍

@samdark

This comment has been minimized.

Show comment
Hide comment
@samdark

samdark Oct 26, 2013

Member

@aditya- so was your problem solved? If not, get to Yii IRC and ping me. That will be faster.

Member

samdark commented Oct 26, 2013

@aditya- so was your problem solved? If not, get to Yii IRC and ping me. That will be faster.

@aditya-

This comment has been minimized.

Show comment
Hide comment
@aditya-

aditya- Oct 26, 2013

No @samdark .. not yet fixed .. yes i will cum there .. Thank you ..

aditya- commented Oct 26, 2013

No @samdark .. not yet fixed .. yes i will cum there .. Thank you ..

@DavertMik

This comment has been minimized.

Show comment
Hide comment
@DavertMik

DavertMik Oct 27, 2013

@aditya- Please add this line

YiiBase::$enableIncludePath=false;

Somewhere in bootstrap file.
For the details you can look into my PR #2324

If this not helps: install the PHP_Invoker from PEAR channel.


@Sharom No one here is talking about new projects, right?

My choise is Symfony 2. But now I work with existing project based on Yii.

I understand your feelings. My choice is Rails and I suffered that hard when I had to use Symfony :)
If you really feel that terrible you just change your job and spam into issues on GitHub.

DavertMik commented Oct 27, 2013

@aditya- Please add this line

YiiBase::$enableIncludePath=false;

Somewhere in bootstrap file.
For the details you can look into my PR #2324

If this not helps: install the PHP_Invoker from PEAR channel.


@Sharom No one here is talking about new projects, right?

My choise is Symfony 2. But now I work with existing project based on Yii.

I understand your feelings. My choice is Rails and I suffered that hard when I had to use Symfony :)
If you really feel that terrible you just change your job and spam into issues on GitHub.

@Sharom

This comment has been minimized.

Show comment
Hide comment
@Sharom

Sharom Oct 28, 2013

This problem with Yii could be fixed.
We need just fix Yii autoloader as it described in PHP documentation.
But some people fear breaking code.

Yes it is a bug, but fix can not be applied because of BC. You need to install all dep. packages to avoid this bug.

This is a well-founded fear. But, on the other hand, the current behavior of the code breaks behavior of the class_exists(). And class_exists is the function of the SPL.

In my opinion it is a greater evil.

Sharom commented Oct 28, 2013

This problem with Yii could be fixed.
We need just fix Yii autoloader as it described in PHP documentation.
But some people fear breaking code.

Yes it is a bug, but fix can not be applied because of BC. You need to install all dep. packages to avoid this bug.

This is a well-founded fear. But, on the other hand, the current behavior of the code breaks behavior of the class_exists(). And class_exists is the function of the SPL.

In my opinion it is a greater evil.

@aditya-

This comment has been minimized.

Show comment
Hide comment
@aditya-

aditya- Nov 6, 2013

Sorry for no replay .. i was on vacation till now ..

@DavertMik

YiiBase::$enableIncludePath=false;

Really works great .. issue was fixed .. Thank you .. 👍

Thank you to all who helped me.. Specially to @samdark 👍

aditya- commented Nov 6, 2013

Sorry for no replay .. i was on vacation till now ..

@DavertMik

YiiBase::$enableIncludePath=false;

Really works great .. issue was fixed .. Thank you .. 👍

Thank you to all who helped me.. Specially to @samdark 👍

@arfeen

This comment has been minimized.

Show comment
Hide comment
@arfeen

arfeen Nov 7, 2013

@pennyp Thanks for your solution. I was experiencing the same problem and followed your instructions, then it worked smoothly.

arfeen commented Nov 7, 2013

@pennyp Thanks for your solution. I was experiencing the same problem and followed your instructions, then it worked smoothly.

@1nstinct

This comment has been minimized.

Show comment
Hide comment
@1nstinct

1nstinct Oct 8, 2014

I had tried to fix PHPUnit + Yii for a two days before found a "YiiBase::$enableIncludePath=false;" solution. I thought Yii is more better. It was my first disappointment about Yii ((

1nstinct commented Oct 8, 2014

I had tried to fix PHPUnit + Yii for a two days before found a "YiiBase::$enableIncludePath=false;" solution. I thought Yii is more better. It was my first disappointment about Yii ((

@marcovtwout

This comment has been minimized.

Show comment
Hide comment
@marcovtwout

marcovtwout Dec 17, 2014

Contributor

Shouldn't we place this line somewhere in the default test code? YiiBase::$enableIncludePath=false;

See also: Codeception/Codeception#234 (comment)

Contributor

marcovtwout commented Dec 17, 2014

Shouldn't we place this line somewhere in the default test code? YiiBase::$enableIncludePath=false;

See also: Codeception/Codeception#234 (comment)

@marcovtwout

This comment has been minimized.

Show comment
Hide comment
@marcovtwout

marcovtwout Apr 9, 2015

Contributor

Does PHPUnit 4.6 fix this issue?

https://github.com/sebastianbergmann/phpunit/blob/master/ChangeLog-4.6.md
"Fixed sebastianbergmann/phpunit#1599: The PHAR build of PHPUnit no longer uses an autoloader to load PHPUnit's own classes and instead statically loads all classes on startup"

Contributor

marcovtwout commented Apr 9, 2015

Does PHPUnit 4.6 fix this issue?

https://github.com/sebastianbergmann/phpunit/blob/master/ChangeLog-4.6.md
"Fixed sebastianbergmann/phpunit#1599: The PHAR build of PHPUnit no longer uses an autoloader to load PHPUnit's own classes and instead statically loads all classes on startup"

@marcovtwout

This comment has been minimized.

Show comment
Hide comment
@marcovtwout

marcovtwout Apr 9, 2015

Contributor

Unfortunately, no:

PHPUnit 4.6.2 by Sebastian Bergmann and contributors.

Configuration read from S:\www\xxx\application\tests\phpunit.xml

F
Warning: include(PHP_Invoker.php): failed to open stream: No such file or directory in S:\www\xxx\application\vendor\yiisoft\yii\framework\YiiBase.php on line 432
Contributor

marcovtwout commented Apr 9, 2015

Unfortunately, no:

PHPUnit 4.6.2 by Sebastian Bergmann and contributors.

Configuration read from S:\www\xxx\application\tests\phpunit.xml

F
Warning: include(PHP_Invoker.php): failed to open stream: No such file or directory in S:\www\xxx\application\vendor\yiisoft\yii\framework\YiiBase.php on line 432
@marcovtwout

This comment has been minimized.

Show comment
Hide comment
@marcovtwout

marcovtwout Dec 11, 2017

Contributor

(this issue still exists in PHPUnit 6 when running tests from NetBeans)

Contributor

marcovtwout commented Dec 11, 2017

(this issue still exists in PHPUnit 6 when running tests from NetBeans)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment