phpunit

XDebugging PHPUnit testcases in Eclipse PDT

Until now, I was debugging my PHP scripts and testcases using vim and the appropiate script with python backing it. However, me and my colleagues need to move forward and vim/gvim is not an option for them. So I've tried to integrate debugging PHPUnit in Eclipse on my setup as an external tool, which again, works with vim. However, it s...

PHPunit command line variable on windows giving trouble

I installed PHPunit via the commandline and added it to my path variables.I then tried to see if it will run, but I got a weird error. Must be something in some file that I didn't configure correctly, but there are over 800 lines in all the PHPUnit folder that reference to that folder, so I'm at a loss as to which one it is. Most will ...

phpunit xml file (phpunit.xml)

i am picking up phpunit. i am at the phpunit.xml file. i want to understand what does each element do. <testsuite name="application"> <directory>application</directory> </testsuite> the directory refers to the dir containing all the *Test.php files? <filter> <whitelist> <directory suffix=".php">../application</dir...

PHPUnit Exception testing, error message messes up results output

Hi, my question regarding phpunit for testing exceptions using the command line tool. I can't seem to correctly do this, the error message of the exception just prints out, making the command line window harder to read. Below is how my code is structured and the test code. public function availableFruits($fruit) { switch($fruit) { ...

phpUnit config options

what do the following options mean or whats it for <log type="coverage-html" target="./log/report" charset="UTF-8" yui="true" highlight="true" lowUpperBound="50" highLowerBound="80"/> yui: i guess it means use stuff from yahoo ui to make it look good? highlight: maybe have some colors? lowUpperBound, highLowerbound: whats these? ...

PHPUnit - test MVC controller with $_POST variable

I'm starting work with PHPUnit with Kohana. My application have many controllers which simply takes data from some form, validates and inserts/updates/deletes into/-/from database. How should I write a test cases for that. I know that if I want to test a function I write data provider function and just compare returned value with the ex...

How to test Webservices with PHPUnit?

I neet to test a couple of SOAP webservices. What types of tests can I run? ...

Zend Studio 7.1 PHPUnit Test Case wizard does not populate "Element to Test"

When I follow the instructions in ZS documentation to create a phpunit test case, the wizard returns no objects to select on the "Element to Test" line. Selecting "browse" provides an empty dialog box. The PHPUnit path in my preferences shows "/Applications/zend/zs710/plugins/com.zend.php.phpunit_7.1.0.v20091120-0900/resources/library/"....

test php functions (not classes) with netbeans and PHPUnit

I'd like to run unit test for a functions library file... that is, I don't have a class, it's just a file with helper functions in it... for example, I've created a php project at ~/www/test and a file ~/www/test/lib/format.php <?php function toUpper( $text ) { return strtoupper( $text ); } function toLower( $text ) { return st...

Not run some tests in PHPUnit?

Hi, I don't want to run all the tests sometimes to save time. I know I can comment the tests. But this method isn't elegant. I'm wondering whether there is some simple way to do that. All advice is appreciated. Thanks for your time and best regards, Box He ...

PHP and unit testing assertions with decimals

I have a method that returns a float like 1.234567890.I want to test that it really does so. However, it seems that this returned float has different precision on different platforms so how do I assert that the returned value is 1.23456789? If I just do: $this->assertEqual(1.23456789, $float); Then that might fail on some platforms wh...

How do I implement / use PHPUnit with struts4php framework

I have done integration of PHPUnit with Zend framework earlier. I am trying to use PHPUnit with Struts4PHP right now. But I am not getting connected with system somwhow.... If anyone has worked on this part and can give me some advice will be appreciated... Thanks in advance ...

"pause" being ignored

I read that I must be able to run all unit tests in my site with a single command, so I created a bat file to do it. Even with pause before the end, after the phpunit command, the result of the unit tests flashes in the screen. @echo off cd c:\ cd xampp cd htdocs cd light cd myworks echo on set /p site=The site: set /p version=The vers...

Testing multiple classes with PHPUnit

This might be a stupid question, but I can't seem to make it to work. I'm using PHPUnit to test. Currently I have two classes in a file called Tests.php: class XTest extends PHPUnit_Framework_TestCase {...} class YTest extends PHPUnit_Framework_TestCase {...} However, I'm unable to run both classes. I'm running the following command ...

Zend Framework, phpUnit and Doctrine cause problems

Hello everyone. First some basic info: Ubuntu latest version Zend Framewrok 1.9.6 Doctrine 1.2.1 Php unit latest version I have been following this and thistutorial to set up my zend envrionment with doctrine and phpUnit. My environment is not an emtpy project since I had done some developments before I configured doctrine and php...

Unit Test in Zend Studio succeeds but fails via CLI

The following UnitTest fails, when executed via Command Line and succeeds when run through Zend Studio. This should not be the case, because assertArrayHasKey expects the second argument to be an array and the method signature contains a type hint to ensure this (which is why it fails via CLI). This is the test case: class AssertArrayH...

Installing PHPUnit via PEAR

I have problems installing PHPUnit 3.4.6 via PEAR 1.9.0. After I discover channel pear.phpunit.de and try to use one of following commands: pear install phpunit/PHPUnit pear install --alldeps phpunit/PHPUnit pear install --onlyreqdeps phpunit/PHPUnit it fails, giving me following error: No releases available for packa...

PHPUnit: stub methods undefined

I must be missing something. I'm trying to stub methods on a class in PHPUnit, but when I invoke the method on the mock object, it tells me that method is undefined. Example class to stub: namespace MyApp; class MyStubClass { public function mrMethod() { // doing stuff } } To stub it, I write: // specifying all ge...

Passing parameters to PHPUnit

I'm starting to write PHPUnit tests and I'd like the tests to be run from developers machines as well as from our servers. Developers machines are set up differently than the servers and even differently from each other. To run in these different places it seems to be the person that runs the test is going to have to indicate where it'...

Selenium-RC Browser Launching Error

Hi there. I have just started using Selenium-RC with PHPUnit in order to perform some web-based tests. Initially I set it up on Windows 7 using this guide - http://jodyt.com/2009/03/selenium-rc-and-php/ - and it worked fine. I could create a .php file test and run it with phpunit. However, I have been asked to get this running locall...