4

I've got a problem getting my PHPUnit working.. I had many issues, but now I've got this one...

So I'm in my application folder protected/tests... and in my console I write:

phpunit unit/DbTest.php

And as reply get (Sorry for lots of letters): P.S. Using Wamp and Win8

PHP Warning:  require_once(PHPUnit/Extensions/SeleniumTestCase.php): failed to o
pen stream: No such file or directory in C:\wamp\www\framework\test\CWebTestCase
.php on line 12
PHP Stack trace:
PHP   1. {main}() C:\wamp\bin\php\php5.3.13\phpunit:0
PHP   2. PHPUnit_TextUI_Command::main() C:\wamp\bin\php\php5.3.13\phpunit:46
PHP   3. PHPUnit_TextUI_Command->run() C:\wamp\bin\php\php5.3.13\pear\PHPUnit\Te
xtUI\Command.php:129
PHP   4. PHPUnit_TextUI_Command->handleArguments() C:\wamp\bin\php\php5.3.13\pea
r\PHPUnit\TextUI\Command.php:138
PHP   5. PHPUnit_TextUI_Command->handleBootstrap() C:\wamp\bin\php\php5.3.13\pea
r\PHPUnit\TextUI\Command.php:606
PHP   6. PHPUnit_Util_Fileloader::checkAndLoad() C:\wamp\bin\php\php5.3.13\pear\
PHPUnit\TextUI\Command.php:778
PHP   7. PHPUnit_Util_Fileloader::load() C:\wamp\bin\php\php5.3.13\pear\PHPUnit\
Util\Fileloader.php:76
PHP   8. include_once() C:\wamp\bin\php\php5.3.13\pear\PHPUnit\Util\Fileloader.p
hp:92
PHP   9. require_once() C:\wamp\www\test\protected\tests\bootstrap.php:8
PHP  10. YiiBase::autoload() C:\wamp\www\test\protected\tests\bootstrap.php:0

PHP  11. include() C:\wamp\www\framework\YiiBase.php:397

Warning: require_once(PHPUnit/Extensions/SeleniumTestCase.php): failed to open s
tream: No such file or directory in C:\wamp\www\framework\test\CWebTestCase.php
on line 12

Call Stack:
    0.0003     325320   1. {main}() C:\wamp\bin\php\php5.3.13\phpunit:0
    0.0081     684192   2. PHPUnit_TextUI_Command::main() C:\wamp\bin\php\php5.3
.13\phpunit:46
    0.0081     684608   3. PHPUnit_TextUI_Command->run() C:\wamp\bin\php\php5.3.
13\pear\PHPUnit\TextUI\Command.php:129
    0.0081     684608   4. PHPUnit_TextUI_Command->handleArguments() C:\wamp\bin
\php\php5.3.13\pear\PHPUnit\TextUI\Command.php:138
    0.0152    1197056   5. PHPUnit_TextUI_Command->handleBootstrap() C:\wamp\bin
\php\php5.3.13\pear\PHPUnit\TextUI\Command.php:606
    0.0157    1209440   6. PHPUnit_Util_Fileloader::checkAndLoad() C:\wamp\bin\p
hp\php5.3.13\pear\PHPUnit\TextUI\Command.php:778
    0.0164    1209536   7. PHPUnit_Util_Fileloader::load() C:\wamp\bin\php\php5.
3.13\pear\PHPUnit\Util\Fileloader.php:76
    0.0167    1214200   8. include_once('C:\wamp\www\test\protected\tests\boo
tstrap.php') C:\wamp\bin\php\php5.3.13\pear\PHPUnit\Util\Fileloader.php:92
    0.0212    1495872   9. require_once('C:\wamp\www\test\protected\tests\Web
TestCase.php') C:\wamp\www\test\protected\tests\bootstrap.php:8
    0.0213    1496136  10. YiiBase::autoload() C:\wamp\www\test\protected\tes
ts\bootstrap.php:0
    0.0220    1519520  11. include('C:\wamp\www\framework\test\CWebTestCase.php'
) C:\wamp\www\framework\YiiBase.php:397

PHP Fatal error:  require_once(): Failed opening required 'PHPUnit/Extensions/Se
leniumTestCase.php' (include_path='.;C:\wamp\bin\php\php5.3.13\pear') in C:\wamp
\www\framework\test\CWebTestCase.php on line 12
PHP Stack trace:
PHP   1. {main}() C:\wamp\bin\php\php5.3.13\phpunit:0
PHP   2. PHPUnit_TextUI_Command::main() C:\wamp\bin\php\php5.3.13\phpunit:46
PHP   3. PHPUnit_TextUI_Command->run() C:\wamp\bin\php\php5.3.13\pear\PHPUnit\Te
xtUI\Command.php:129
PHP   4. PHPUnit_TextUI_Command->handleArguments() C:\wamp\bin\php\php5.3.13\pea
r\PHPUnit\TextUI\Command.php:138
PHP   5. PHPUnit_TextUI_Command->handleBootstrap() C:\wamp\bin\php\php5.3.13\pea
r\PHPUnit\TextUI\Command.php:606
PHP   6. PHPUnit_Util_Fileloader::checkAndLoad() C:\wamp\bin\php\php5.3.13\pear\
PHPUnit\TextUI\Command.php:778
PHP   7. PHPUnit_Util_Fileloader::load() C:\wamp\bin\php\php5.3.13\pear\PHPUnit\
Util\Fileloader.php:76
PHP   8. include_once() C:\wamp\bin\php\php5.3.13\pear\PHPUnit\Util\Fileloader.p
hp:92
PHP   9. require_once() C:\wamp\www\test\protected\tests\bootstrap.php:8
PHP  10. YiiBase::autoload() C:\wamp\www\test\protected\tests\bootstrap.php:0

PHP  11. include() C:\wamp\www\framework\YiiBase.php:397

Fatal error: require_once(): Failed opening required 'PHPUnit/Extensions/Seleniu
mTestCase.php' (include_path='.;C:\wamp\bin\php\php5.3.13\pear') in C:\wamp\www\
framework\test\CWebTestCase.php on line 12

Call Stack:
    0.0003     325320   1. {main}() C:\wamp\bin\php\php5.3.13\phpunit:0
    0.0081     684192   2. PHPUnit_TextUI_Command::main() C:\wamp\bin\php\php5.3
.13\phpunit:46
    0.0081     684608   3. PHPUnit_TextUI_Command->run() C:\wamp\bin\php\php5.3.
13\pear\PHPUnit\TextUI\Command.php:129
    0.0081     684608   4. PHPUnit_TextUI_Command->handleArguments() C:\wamp\bin
\php\php5.3.13\pear\PHPUnit\TextUI\Command.php:138
    0.0152    1197056   5. PHPUnit_TextUI_Command->handleBootstrap() C:\wamp\bin
\php\php5.3.13\pear\PHPUnit\TextUI\Command.php:606
    0.0157    1209440   6. PHPUnit_Util_Fileloader::checkAndLoad() C:\wamp\bin\p
hp\php5.3.13\pear\PHPUnit\TextUI\Command.php:778
    0.0164    1209536   7. PHPUnit_Util_Fileloader::load() C:\wamp\bin\php\php5.
3.13\pear\PHPUnit\Util\Fileloader.php:76
    0.0167    1214200   8. include_once('C:\wamp\www\test\protected\tests\boo
tstrap.php') C:\wamp\bin\php\php5.3.13\pear\PHPUnit\Util\Fileloader.php:92
    0.0212    1495872   9. require_once('C:\wamp\www\test\protected\tests\Web
TestCase.php') C:\wamp\www\test\protected\tests\bootstrap.php:8
    0.0213    1496136  10. YiiBase::autoload() C:\wamp\www\test\protected\tes
ts\bootstrap.php:0
    0.0220    1519520  11. include('C:\wamp\www\framework\test\CWebTestCase.php'
) C:\wamp\www\framework\YiiBase.php:397
2
  • Did you read the error? Looks like you'll either need to update your path variable or modify the script to look in a specified path . . . Commented Oct 26, 2012 at 16:23
  • i get the same error, did you find a solution? Commented Nov 29, 2012 at 9:27

1 Answer 1

3

First you need to install Selenium

pear install phpunit/PHPUnit_Selenium

Then you need to change lines 11-14 in

/framework/test/CTestCase.php

as below

require_once('PHPUnit/Runner/Version.php');
require_once('PHPUnit/Util/Filesystem.php'); // workaround for PHPUnit <= 3.6.11
require_once('PHPUnit/Autoload.php');
if (in_array('phpunit_autoload', spl_autoload_functions())) { // PHPUnit >= 3.7    'phpunit_alutoload' was obsoleted
    spl_autoload_unregister('phpunit_autoload');
    Yii::registerAutoloader('phpunit_autoload');
}
Sign up to request clarification or add additional context in comments.

1 Comment

pear install phpunit/PHPUnit_Selenium gives message that No release available for package install failed.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.