Firefox.php faild to include in YiiBase

Hi,

I’m trying to conduct a functional testing in Yii using Selenium. Hwoever, when I run command

phpunit functional\SiteTest.php

it display PHP warning include(SiteTest: Firefox.php); faild to open stream

I captured a screen shot with details

I Googled for hours but cannot find any solution. any help would be appreciated,

Binh Le

Did you ever get this working ? I’m struggling with exactly same problem

Same problem here , it’s passing all tests in this example but i’ curious why i get this PHP Warnings. i’m using CentOS 6.2 with php 5.3.3, with newest version of phpunit and selenium + yii 1.1.10

trying to pass through first test example in Yii Agile book

after i enter:# phpunit functional/SiteTest.php




PHPUnit 3.6.10 by Sebastian Bergmann.


Configuration read from /var/www/html/bg/demo/protected/tests/phpunit.xml


PHP Warning:  include(SiteTest: firefox.php): failed to open stream: No such file or directory in /var/www/html/bg/yii/framework/YiiBase.php on line 418

PHP Stack trace:

PHP   1. {main}() /usr/bin/phpunit:0

PHP   2. PHPUnit_TextUI_Command::main() /usr/bin/phpunit:46

PHP   3. PHPUnit_TextUI_Command->run() /usr/share/pear/PHPUnit/TextUI/Command.php:130

PHP   4. PHPUnit_TextUI_TestRunner->doRun() /usr/share/pear/PHPUnit/TextUI/Command.php:192

PHP   5. PHPUnit_Framework_TestSuite->run() /usr/share/pear/PHPUnit/TextUI/TestRunner.php:325

PHP   6. PHPUnit_Framework_TestSuite->run() /usr/share/pear/PHPUnit/Framework/TestSuite.php:705

PHP   7. method_exists() /usr/share/pear/PHPUnit/Framework/TestSuite.php:654

PHP   8. YiiBase::autoload() /usr/share/pear/PHPUnit/Framework/TestSuite.php:0

PHP Warning:  include(): Failed opening 'SiteTest: firefox.php' for inclusion (include_path='.:/var/www/html/bg/demo/protected/components:/var/www/html/bg/demo/protected/models:/usr/share/pear:/usr/share/php') in /var/www/html/bg/yii/framework/YiiBase.php on line 418

PHP Stack trace:

PHP   1. {main}() /usr/bin/phpunit:0

PHP   2. PHPUnit_TextUI_Command::main() /usr/bin/phpunit:46

PHP   3. PHPUnit_TextUI_Command->run() /usr/share/pear/PHPUnit/TextUI/Command.php:130

PHP   4. PHPUnit_TextUI_TestRunner->doRun() /usr/share/pear/PHPUnit/TextUI/Command.php:192

PHP   5. PHPUnit_Framework_TestSuite->run() /usr/share/pear/PHPUnit/TextUI/TestRunner.php:325

PHP   6. PHPUnit_Framework_TestSuite->run() /usr/share/pear/PHPUnit/Framework/TestSuite.php:705

PHP   7. method_exists() /usr/share/pear/PHPUnit/Framework/TestSuite.php:654

PHP   8. YiiBase::autoload() /usr/share/pear/PHPUnit/Framework/TestSuite.php:0

...PHP Warning:  include(SiteTest: firefox.php): failed to open stream: No such file or directory in /var/www/html/bg/yii/framework/YiiBase.php on line 418

PHP Stack trace:

PHP   1. {main}() /usr/bin/phpunit:0

PHP   2. PHPUnit_TextUI_Command::main() /usr/bin/phpunit:46

PHP   3. PHPUnit_TextUI_Command->run() /usr/share/pear/PHPUnit/TextUI/Command.php:130

PHP   4. PHPUnit_TextUI_TestRunner->doRun() /usr/share/pear/PHPUnit/TextUI/Command.php:192

PHP   5. PHPUnit_Framework_TestSuite->run() /usr/share/pear/PHPUnit/TextUI/TestRunner.php:325

PHP   6. PHPUnit_Framework_TestSuite->run() /usr/share/pear/PHPUnit/Framework/TestSuite.php:705

PHP   7. method_exists() /usr/share/pear/PHPUnit/Framework/TestSuite.php:752

PHP   8. YiiBase::autoload() /usr/share/pear/PHPUnit/Framework/TestSuite.php:0

PHP Warning:  include(): Failed opening 'SiteTest: firefox.php' for inclusion (include_path='.:/var/www/html/bg/demo/protected/components:/var/www/html/bg/demo/protected/models:/usr/share/pear:/usr/share/php') in /var/www/html/bg/yii/framework/YiiBase.php on line 418

PHP Stack trace:

PHP   1. {main}() /usr/bin/phpunit:0

PHP   2. PHPUnit_TextUI_Command::main() /usr/bin/phpunit:46

PHP   3. PHPUnit_TextUI_Command->run() /usr/share/pear/PHPUnit/TextUI/Command.php:130

PHP   4. PHPUnit_TextUI_TestRunner->doRun() /usr/share/pear/PHPUnit/TextUI/Command.php:192

PHP   5. PHPUnit_Framework_TestSuite->run() /usr/share/pear/PHPUnit/TextUI/TestRunner.php:325

PHP   6. PHPUnit_Framework_TestSuite->run() /usr/share/pear/PHPUnit/Framework/TestSuite.php:705

PHP   7. method_exists() /usr/share/pear/PHPUnit/Framework/TestSuite.php:752

PHP   8. YiiBase::autoload() /usr/share/pear/PHPUnit/Framework/TestSuite.php:0




Time: 26 seconds, Memory: 5.50Mb


OK (3 tests, 12 assertions)



I’m also doing the exercise in the book, but my setup is slight different I’m using Netbeans 7.1.1 IDE, PHPUnit 3.6.10, Yii Framework 1.1.10, Wamp 2.2, PHP 5.3.8, and Windows 8… Netbeans returns: all OK, but skipped some tests. (Actually it skipped all tests 3 / 3)…

Netbeans returns this for me:




PHPUnit 3.6.10 by Sebastian Bergmann.


Configuration read from C:\wamp\www\aapelikoti\protected\tests\phpunit.xml




Warning: include(SiteTest: Firefox.php): failed to open stream: No such file or directory in C:\wamp\yii\framework\YiiBase.php on line 418


Call Stack:

    0.0002     632504   1. {main}() C:\wamp\bin\php\php5.3.8\phpunit:0

    0.0073    1226776   2. PHPUnit_TextUI_Command::main() C:\wamp\bin\php\php5.3.8\phpunit:46

    0.0074    1227464   3. PHPUnit_TextUI_Command->run() C:\wamp\bin\php\php5.3.8\pear\PHPUnit\TextUI\Command.php:130

    0.1717    7850368   4. PHPUnit_TextUI_TestRunner->doRun() C:\wamp\bin\php\php5.3.8\pear\PHPUnit\TextUI\Command.php:192

    0.1778    8478984   5. PHPUnit_Framework_TestSuite->run() C:\wamp\bin\php\php5.3.8\pear\PHPUnit\TextUI\TestRunner.php:325

    0.1779    8482360   6. PHPUnit_Framework_TestSuite->run() C:\wamp\bin\php\php5.3.8\pear\PHPUnit\Framework\TestSuite.php:705

    0.1784    8483736   7. PHPUnit_Framework_TestSuite->run() C:\wamp\bin\php\php5.3.8\pear\PHPUnit\Framework\TestSuite.php:705

    0.1785    8484960   8. method_exists() C:\wamp\bin\php\php5.3.8\pear\PHPUnit\Framework\TestSuite.php:654

    0.1786    8485312   9. YiiBase::autoload() C:\wamp\bin\php\php5.3.8\pear\PHPUnit\Framework\TestSuite.php:0




Warning: include(): Failed opening 'SiteTest: Firefox.php' for inclusion (include_path='.;C:\wamp\www\aapelikoti\protected\components;C:\wamp\www\aapelikoti\protected\models;C:\wamp\bin\php\php5.3.8\pear') in C:\wamp\yii\framework\YiiBase.php on line 418


Call Stack:

    0.0002     632504   1. {main}() C:\wamp\bin\php\php5.3.8\phpunit:0

    0.0073    1226776   2. PHPUnit_TextUI_Command::main() C:\wamp\bin\php\php5.3.8\phpunit:46

    0.0074    1227464   3. PHPUnit_TextUI_Command->run() C:\wamp\bin\php\php5.3.8\pear\PHPUnit\TextUI\Command.php:130

    0.1717    7850368   4. PHPUnit_TextUI_TestRunner->doRun() C:\wamp\bin\php\php5.3.8\pear\PHPUnit\TextUI\Command.php:192

    0.1778    8478984   5. PHPUnit_Framework_TestSuite->run() C:\wamp\bin\php\php5.3.8\pear\PHPUnit\TextUI\TestRunner.php:325

    0.1779    8482360   6. PHPUnit_Framework_TestSuite->run() C:\wamp\bin\php\php5.3.8\pear\PHPUnit\Framework\TestSuite.php:705

    0.1784    8483736   7. PHPUnit_Framework_TestSuite->run() C:\wamp\bin\php\php5.3.8\pear\PHPUnit\Framework\TestSuite.php:705

    0.1785    8484960   8. method_exists() C:\wamp\bin\php\php5.3.8\pear\PHPUnit\Framework\TestSuite.php:654

    0.1786    8485312   9. YiiBase::autoload() C:\wamp\bin\php\php5.3.8\pear\PHPUnit\Framework\TestSuite.php:0


SSPHP Warning:  include(SiteTest: Firefox.php): failed to open stream: No such file or directory in C:\wamp\yii\framework\YiiBase.php on line 418

PHP Stack trace:

PHP   1. {main}() C:\wamp\bin\php\php5.3.8\phpunit:0

PHP   2. PHPUnit_TextUI_Command::main() C:\wamp\bin\php\php5.3.8\phpunit:46

PHP   3. PHPUnit_TextUI_Command->run() C:\wamp\bin\php\php5.3.8\pear\PHPUnit\TextUI\Command.php:130

PHP   4. PHPUnit_TextUI_TestRunner->doRun() C:\wamp\bin\php\php5.3.8\pear\PHPUnit\TextUI\Command.php:192

PHP   5. PHPUnit_Framework_TestSuite->run() C:\wamp\bin\php\php5.3.8\pear\PHPUnit\TextUI\TestRunner.php:325

PHP   6. PHPUnit_Framework_TestSuite->run() C:\wamp\bin\php\php5.3.8\pear\PHPUnit\Framework\TestSuite.php:705

PHP   7. PHPUnit_Framework_TestSuite->run() C:\wamp\bin\php\php5.3.8\pear\PHPUnit\Framework\TestSuite.php:705

PHP   8. method_exists() C:\wamp\bin\php\php5.3.8\pear\PHPUnit\Framework\TestSuite.php:654

PHP   9. YiiBase::autoload() C:\wamp\bin\php\php5.3.8\pear\PHPUnit\Framework\TestSuite.php:0

PHP Warning:  include(): Failed opening 'SiteTest: Firefox.php' for inclusion (include_path='.;C:\wamp\www\aapelikoti\protected\components;C:\wamp\www\aapelikoti\protected\models;C:\wamp\bin\php\php5.3.8\pear') in C:\wamp\yii\framework\YiiBase.php on line 418

PHP Stack trace:

PHP   1. {main}() C:\wamp\bin\php\php5.3.8\phpunit:0

PHP   2. PHPUnit_TextUI_Command::main() C:\wamp\bin\php\php5.3.8\phpunit:46

PHP   3. PHPUnit_TextUI_Command->run() C:\wamp\bin\php\php5.3.8\pear\PHPUnit\TextUI\Command.php:130

PHP   4. PHPUnit_TextUI_TestRunner->doRun() C:\wamp\bin\php\php5.3.8\pear\PHPUnit\TextUI\Command.php:192

PHP   5. PHPUnit_Framework_TestSuite->run() C:\wamp\bin\php\php5.3.8\pear\PHPUnit\TextUI\TestRunner.php:325

PHP   6. PHPUnit_Framework_TestSuite->run() C:\wamp\bin\php\php5.3.8\pear\PHPUnit\Framework\TestSuite.php:705

PHP   7. PHPUnit_Framework_TestSuite->run() C:\wamp\bin\php\php5.3.8\pear\PHPUnit\Framework\TestSuite.php:705

PHP   8. method_exists() C:\wamp\bin\php\php5.3.8\pear\PHPUnit\Framework\TestSuite.php:654

PHP   9. YiiBase::autoload() C:\wamp\bin\php\php5.3.8\pear\PHPUnit\Framework\TestSuite.php:0

PHP Warning:  include(SiteTest: Firefox.php): failed to open stream: No such file or directory in C:\wamp\yii\framework\YiiBase.php on line 418

PHP Stack trace:

PHP   1. {main}() C:\wamp\bin\php\php5.3.8\phpunit:0

PHP   2. PHPUnit_TextUI_Command::main() C:\wamp\bin\php\php5.3.8\phpunit:46

PHP   3. PHPUnit_TextUI_Command->run() C:\wamp\bin\php\php5.3.8\pear\PHPUnit\TextUI\Command.php:130

PHP   4. PHPUnit_TextUI_TestRunner->doRun() C:\wamp\bin\php\php5.3.8\pear\PHPUnit\TextUI\Command.php:192

PHP   5. PHPUnit_Framework_TestSuite->run() C:\wamp\bin\php\php5.3.8\pear\PHPUnit\TextUI\TestRunner.php:325

PHP   6. PHPUnit_Framework_TestSuite->run() C:\wamp\bin\php\php5.3.8\pear\PHPUnit\Framework\TestSuite.php:705

PHP   7. PHPUnit_Framework_TestSuite->run() C:\wamp\bin\php\php5.3.8\pear\PHPUnit\Framework\TestSuite.php:705

PHP   8. method_exists() C:\wamp\bin\php\php5.3.8\pear\PHPUnit\Framework\TestSuite.php:752

PHP   9. YiiBase::autoload() C:\wamp\bin\php\php5.3.8\pear\PHPUnit\Framework\TestSuite.php:0

PHP Warning:  include(): Failed opening 'SiteTest: Firefox.php' for inclusion (include_path='.;C:\wamp\www\aapelikoti\protected\components;C:\wamp\www\aapelikoti\protected\models;C:\wamp\bin\php\php5.3.8\pear') in C:\wamp\yii\framework\YiiBase.php on line 418

PHP Stack trace:

PHP   1. {main}() C:\wamp\bin\php\php5.3.8\phpunit:0

PHP   2. PHPUnit_TextUI_Command::main() C:\wamp\bin\php\php5.3.8\phpunit:46

PHP   3. PHPUnit_TextUI_Command->run() C:\wamp\bin\php\php5.3.8\pear\PHPUnit\TextUI\Command.php:130

PHP   4. PHPUnit_TextUI_TestRunner->doRun() C:\wamp\bin\php\php5.3.8\pear\PHPUnit\TextUI\Command.php:192

PHP   5. PHPUnit_Framework_TestSuite->run() C:\wamp\bin\php\php5.3.8\pear\PHPUnit\TextUI\TestRunner.php:325

PHP   6. PHPUnit_Framework_TestSuite->run() C:\wamp\bin\php\php5.3.8\pear\PHPUnit\Framework\TestSuite.php:705

PHP   7. PHPUnit_Framework_TestSuite->run() C:\wamp\bin\php\php5.3.8\pear\PHPUnit\Framework\TestSuite.php:705

PHP   8. method_exists() C:\wamp\bin\php\php5.3.8\pear\PHPUnit\Framework\TestSuite.php:752

PHP   9. YiiBase::autoload() C:\wamp\bin\php\php5.3.8\pear\PHPUnit\Framework\TestSuite.php:0

S

Warning: include(SiteTest: Firefox.php): failed to open stream: No such file or directory in C:\wamp\yii\framework\YiiBase.php on line 418


Call Stack:

    0.0002     632504   1. {main}() C:\wamp\bin\php\php5.3.8\phpunit:0

    0.0073    1226776   2. PHPUnit_TextUI_Command::main() C:\wamp\bin\php\php5.3.8\phpunit:46

    0.0074    1227464   3. PHPUnit_TextUI_Command->run() C:\wamp\bin\php\php5.3.8\pear\PHPUnit\TextUI\Command.php:130

    0.1717    7850368   4. PHPUnit_TextUI_TestRunner->doRun() C:\wamp\bin\php\php5.3.8\pear\PHPUnit\TextUI\Command.php:192

    0.1778    8478984   5. PHPUnit_Framework_TestSuite->run() C:\wamp\bin\php\php5.3.8\pear\PHPUnit\TextUI\TestRunner.php:325

    0.1779    8482360   6. PHPUnit_Framework_TestSuite->run() C:\wamp\bin\php\php5.3.8\pear\PHPUnit\Framework\TestSuite.php:705

    0.1784    8483736   7. PHPUnit_Framework_TestSuite->run() C:\wamp\bin\php\php5.3.8\pear\PHPUnit\Framework\TestSuite.php:705

    6.2150    8872336   8. method_exists() C:\wamp\bin\php\php5.3.8\pear\PHPUnit\Framework\TestSuite.php:752

    6.2151    8872688   9. YiiBase::autoload() C:\wamp\bin\php\php5.3.8\pear\PHPUnit\Framework\TestSuite.php:0




Warning: include(): Failed opening 'SiteTest: Firefox.php' for inclusion (include_path='.;C:\wamp\www\aapelikoti\protected\components;C:\wamp\www\aapelikoti\protected\models;C:\wamp\bin\php\php5.3.8\pear') in C:\wamp\yii\framework\YiiBase.php on line 418


Call Stack:

    0.0002     632504   1. {main}() C:\wamp\bin\php\php5.3.8\phpunit:0

    0.0073    1226776   2. PHPUnit_TextUI_Command::main() C:\wamp\bin\php\php5.3.8\phpunit:46

    0.0074    1227464   3. PHPUnit_TextUI_Command->run() C:\wamp\bin\php\php5.3.8\pear\PHPUnit\TextUI\Command.php:130

    0.1717    7850368   4. PHPUnit_TextUI_TestRunner->doRun() C:\wamp\bin\php\php5.3.8\pear\PHPUnit\TextUI\Command.php:192

    0.1778    8478984   5. PHPUnit_Framework_TestSuite->run() C:\wamp\bin\php\php5.3.8\pear\PHPUnit\TextUI\TestRunner.php:325

    0.1779    8482360   6. PHPUnit_Framework_TestSuite->run() C:\wamp\bin\php\php5.3.8\pear\PHPUnit\Framework\TestSuite.php:705

    0.1784    8483736   7. PHPUnit_Framework_TestSuite->run() C:\wamp\bin\php\php5.3.8\pear\PHPUnit\Framework\TestSuite.php:705

    6.2150    8872336   8. method_exists() C:\wamp\bin\php\php5.3.8\pear\PHPUnit\Framework\TestSuite.php:752

    6.2151    8872688   9. YiiBase::autoload() C:\wamp\bin\php\php5.3.8\pear\PHPUnit\Framework\TestSuite.php:0





Time: 6 seconds, Memory: 8.75Mb


OK, but incomplete or skipped tests!

Tests: 3, Assertions: 0, Skipped: 3.




I solved this problem simply by uninstalling all java programs through control panel and reinstalled java SDK, then redownloaded selenium RC server moved it to Java SDK installation folder / bin and started server from cmd: java -jar selenium.jar

code was throwing error because selenium wasn’t working correctly (couldn’t start browser)

Here’s what I did,

  • Uninstall all java programs. Reinstall Java SE Development Kit 7

  • Then put it in C:\Program Files\Java\jdk1.7.0_03\bin

  • Then I run cmd: java -jar selenium-server-standalone-2.20.0.jar

  • But I still have the same error.

Just wondering if it’s exactly what you did,

You can also try to update phpunit and selenium to recent versions, because last selenium server doesn’t work with phpunit 3.5.x

Hi,

I currently have PHPUnit 3.6.10 (latest update) and Selenium Server 2.20.

Have anyone found the solution to this one? I have the same, but with ‘Google Chrome.php’ instead of ‘Firefox.php’

Hey everyone! I’ve fixed this issue.

Just find the TestSuite.php file (it usually is in PEAR_DIRECTORY\PHPUnit\Framework - for my xampp server it is C:\xampp\php\PEAR\PHPUnit\Framework) and replace (for me it’s on line 653)


method_exists($this->name, 'setUpBeforeClass'))

with


@method_exists($this->name, 'setUpBeforeClass'))

P.S. Tests been working before, just gave this unneeded warning information

Update:

If you get any other errors, just find, on which line in TestSuite.php the error is (usually it is method_exists function) and just add the @ sign before - of course if it is only visual issue

Well Done, that fixed the warnings on my screen.

Thanks Dmitriy,

It works for me as well.

@ in php is an error suppression. I’d prefer to replace it with is_callable($this->name, ‘setUpBeforeClass’)

I had the same problem.

As I found it appears as of brouser configuration in phpunit.xml file.

I’ve commented




	<selenium>

<!--        <browser name="Internet Explorer" browser="*iexplore" />-->

<!--        <browser name="Firefox" browser="*firefox" />-->

	</selenium>



and wrote in script:




        parent::setUp();

        $this->setBrowser('*iexplore');

        $this->setBrowserUrl(TEST_BASE_URL);



and warning do not appear now.

This worked for me with the latest version of Netbeans, thank you!

Unfortunately, this did not solve the issue for me. I edited the TestSuite.php and also put some comments aroud the test to verify it is called:


echo "before test method exists\n";


                if ($this->testCase &&

                    @method_exists($this->name, 'setUpBeforeClass')) {

                    call_user_func(array($this->name, 'setUpBeforeClass'));

                }

echo "after test method exists\n";



And as the output shows, these statements are called but the error still shows up:


klaas@mint-desktop /var/www/websites/demo/protected/tests $ phpunit functional/SiteTest.php D

PHPUnit 3.6.10 by Sebastian Bergmann.


Configuration read from /var/www/websites/demo/protected/tests/phpunit.xml


before test method exists

after test method exists

before test method exists

after test method exists

SSSPHP Warning:  include(SiteTest: Firefox.php): failed to open stream: No such file or directory in /var/www/websites/yii-1.1.10.r3566/framework/YiiBase.php on line 418

PHP Warning:  include(): Failed opening 'SiteTest: Firefox.php' for inclusion (include_path='.:/var/www/websites/demo/protected/components:/var/www/websites/demo/protected/models:/usr/share/php:/usr/share/pear') in /var/www/websites/yii-1.1.10.r3566/framework/YiiBase.php on line 418




Time: 0 seconds, Memory: 5.00Mb


OK, but incomplete or skipped tests!

Tests: 3, Assertions: 0, Skipped: 3.






Furthermore, I do not get the stacktrace message and do not see how to enable them. Is this an option of the phpunit command?

And is there another soulution to get rid of the warning messages?

Greetings, Klaus

Worked for me. However, I needed to add the @method_exists in TWO places instead of one. Lines 654 and 752.

setUpBeforeClass and tearDownAfterClass

Hey, guys, read the post #14 It’s work excelent and IMHO it’s more rightly

Displaying of those warnings depends on php.ini settings:

  • error_reporting

  • display errors

if you don`t want to display this warnings you must set


error_reporting(E_ALL & ~E_WARNING | E_STRICT)

or


ini_set('display_errors','off');

directives in WebTestCase.php

and don`t switch off error logging to file to save && check errors

Post #14 sounds more correct for me. It solved my problem.

Just to complete, after changing the file phpunit.xml, change the file WebTestCase.php placing the following lines in the setUp method:




parent::setUp();

$this->setBrowser('*firefox');

$this->setBrowserUrl(TEST_BASE_URL); 



All warnings disappeared for me.