Chapter 3 - functional test does not work

Hi!

I am not quite familiar with Yii and that’s why I am just trying to work through this book. But right now, I really cannot find any solution for my issue.

So, I installed PHPUnit correctly. Then I started the Selenium Server.


C:\>java -jar selenium.jar

09.03.2012 10:23:01 org.openqa.grid.selenium.GridLauncher main

INFO: Launching a standalone server

10:23:03.288 INFO - Java: Sun Microsystems Inc. 20.6-b01

10:23:03.314 INFO - OS: Windows 7 6.1 x86

10:23:03.408 INFO - v2.19.0, with Core v2.19.0. Built from revision 15849

10:23:04.048 INFO - RemoteWebDriver instances should connect to: wd/hub

10:23:04.050 INFO - Version Jetty/5.1.x

10:23:04.063 INFO - Started HttpContext[/selenium-server/driver,/selenium-server

/driver]

10:23:04.065 INFO - Started HttpContext[/selenium-server,/selenium-server]

10:23:04.065 INFO - Started HttpContext[/,/]

10:23:04.195 INFO - Started org.openqa.jetty.jetty.servlet.ServletHandler@471e30


10:23:04.195 INFO - Started HttpContext[/wd,/wd]

10:23:04.200 INFO - Started SocketListener on 0.0.0.0:4444

10:23:04.200 INFO - Started org.openqa.jetty.jetty.Server@1ed2ae8

It also seems to work properly. However, when I tried to invoke the test, it gives me this error message back:


C:\wamp\www\test1\protected\tests>phpunit functional/SiteTest.php


Warning: require_once(PHPUnit/Extensions/SeleniumTestCase.php): failed to open s

tream: No such file or directory in C:\wamp\www\yii\framework\test\CWebTestCase.

php on line 11


Fatal error: require_once(): Failed opening required 'PHPUnit/Extensions/Seleniu

mTestCase.php' (include_path='.;C:\xampplite\php\PEAR') in C:\wamp\www\yii\frame

work\test\CWebTestCase.php on line 11


C:\wamp\www\test1\protected\tests>

I really do not know, what to do now and I did “ask” google for advice. I would really appreciate your help! Thanks in advance! :)

In this post they discussed the same issue like you.

Be sure that the SeleniumTestCase.php file exists in the correct folder -> if not try reinstalling PHPUnit/Selenium.

Also some information about your operating system would be useful.

Thanks for your quick reply! :)

I’m working on a Windows 7 64bit system and I’m using xampplite. Is that enough information? :)

Okay, so here is what I was trying to do. First of all, I uninstalled PHPUnit. However, it’s still in my directory even though I uninstalled it correctly. Is that alright? So then I wanted to reinstall PHPUnit by using PEAR. But now it says:


No releases available for package "pear.phpunit.de/PHPUnit_Selenium"

install failed

Sorry, but I’ve never really used PEAR. So what am I doing wrong?

Maybe you haven’t registered the channel.

Follow the instruction on the pear.phpunit.de page.

I definately did that. So that’s what I’ve done so far:


C:\>pear channel-discover pear.phpunit.de

Channel "pear.phpunit.de" is already initialized


C:\>pear uninstall phpunit/PHPUnit

phpunit/PHPUnit not installed


C:\>pear install phpunit/PHPUnit

No releases available for package "pear.phpunit.de/PHPUnit"

install failed


C:\>pear install phpunit/PHPUnit-3.6.9

No releases available for package "pear.phpunit.de/PHPUnit"

install failed

Well, I finally managed it to install PHPUnit Selenium. I just typed in:


pear install --alldeps phpunit/PHPUnit_Selenium



However, now there are several other issues. So when I now try to run the Test, the following Warning appears:


C:\xampplite\htdocs\test1\protected\tests>phpunit functional/SiteTest.php

PHP Warning:  PHP Startup: Unable to load dynamic library ';C:\xampplite\php\ext

\php_bz2.dll' - Das angegebene Modul wurde nicht gefunden.

 in Unknown on line 0


Warning: PHP Startup: Unable to load dynamic library ';C:\xampplite\php\ext\php_

bz2.dll' - Das angegebene Modul wurde nicht gefunden.

 in Unknown on line 0

PHP Warning:  PHP Startup: Unable to load dynamic library ';C:\xampplite\php\ext

\php_curl.dll' - Das angegebene Modul wurde nicht gefunden.

 in Unknown on line 0


Warning: PHP Startup: Unable to load dynamic library ';C:\xampplite\php\ext\php_

curl.dll' - Das angegebene Modul wurde nicht gefunden.

 in Unknown on line 0

PHP Warning:  PHP Startup: Unable to load dynamic library ';C:\xampplite\php\ext

\php_mbstring.dll' - Das angegebene Modul wurde nicht gefunden.

 in Unknown on line 0

Could somebody please help me? Thanks in advance! ;)

EDIT:

The extensions are in the right directory.

I solved this:

I use WAMP SERVER,so modify php.ini in WAMP_PATH/bin/php/php.ini and make sure ‘extension=php_curl.dll’ (maybe you have opened curl in wamp panel or bin/apache/php.ini,it’s unuseful).

If failed yet,reinstall phpunit and selenium.

Good luck.

I solved this on Windows7 by

  1. open cmd.exe as administator. go to c:\windows\system32. right click on cmd.exe, choose run as administrator.

  2. cd c:\wamp\bin\php\php5.4.3

  3. pear clear-cache

  4. pear install -f --alldeps phpunit/PHPUnit_Selenium

Hope this helps someone

JMan