phpunit

Debug some PhpUnit tests in Eclipse

Hello, I use Eclipse PDT for PHP. I can run my PhpUnit tests : works fine. But I can not debug my unit tests. Has someby already done this ? Can somebody help doing this ? Thanx, Messaoud ...

How can I stop Zend_Db_Table_Abstract fetchrow returning garbage data when running tests?

Hi, I'm fairly new to Zend and am having some difficulties with creating my unit tests. I've stripped it down to a minimal test class that still replicates the problem in the hope that it is something daft that I'm doing: class UserRegistrationsTest extends PHPUnit_Framework_TestCase { protected $db; public function __construct($na...

PHPUnit, Testing "Behaves Like A..."

I have a series of PHPUnit tests to validate a class, "Class A". I have another class, "Class B" which extends Class A. Is there a good way to test that "Class B passes Class A's tests", or in other words "Class B behaves like Class A" without duplicating the test code? I could test for the extends (using instanceof), but that seems li...

Dealing with path issues with PHPUnit

I've just started to use PHPUnit, but I've run into a bit of a snag. My code uses $_SERVER['DOCUMENT_ROOT'] to compute paths for includes, which works when my apache server is the one running PHP, but DOCUMENT_ROOT is not set when I run phpunit from the command line with "phpunit Tests", so these includes don't work. Am I missing somet...

how to CREATE only 1 session with rc server when running PHPUnit selense html files?

My website has a Login page, so it needs to login first to run each html selense test file. The way PHPUnit framework works is creating independent test cases by running each test independently, which means it calls the Setup() function on each test case --> then calls Selenium RC Server--> then creates session id. My Code is below: req...

Cruisecontrol, build failed exec returned: 255 after compiled phpunit tests?

here is my build.xml code: <target name="checkout"> <exec executable="svn" dir="${basedir}/source"> <arg line="up" /> </exec> </target> <target name="php-documentor"> <exec executable="phpdoc" dir="${basedir}/source" logerror="on"> <arg line="-ct type -ue on -t ${basedir}/build/api -tb...

How does one configure PHPUnit to log to the test database?

Hi All I am trying to work out how to configure PHPUnit to use the "test database" that is described on this wiki page: http://www.phpunit.de/wiki/TestDatabase However I can't find any documentation on how to enable and configure it. Has Anyone got any ideas? Thanks ...

PHPUnit: Testing if a protected method was called

I´m trying to test if a protected method is called in a public interface. <?php abstract class SomeClassAbstract { abstract public foo(); public function doStuff() { $this->_protectedMethod(); } protected function _protectedMethod(); { // implementation is irrelevant } } <?php class M...

Write test results data to a Test Database in PHPUnit 3.4 release

I understand that the database log feature is supported in 3.3 version and not released in 3.4 is there any way I can use the database feature in 3.4 ...

Running unit tests on both windows and linux

Is there a way, a method, to be able to effectively run unit tests (phpunit) on both linux and windows? I need to do this because some parts of the system is only available under linux, but i do want to be able to run certain parts of the test suite in my IDE, which is netbeans by the way. The problems i run into have to do with paths ...

Configuring multiple methods in PHPUnit mock objects

I am trying to create a mock object in PHP and PHPUnit. So far, I have this: $object = $this->getMock('object', array('set_properties', 'get_events'), array(), 'object_test', null); $object ->expects($t...

unit test a method that creates an object

I'm trying to get my head round Unit Testing and there's one more piece of the jigsaw I need to find. What I'm trying to do is write tests for the following code. In this case, I've got a really simple Front Controller (written in PHP). class frontController { public function routeRequest($oRequest) { $sClassname = $oReques...

Testing static classes with PHPUnit

Hi, I've got a set of classes I'm trying to test. Class A depends on Class X. Class X contains functions which do random things and things with databases. I've created a mock version of Class X which returns exactly what I want it to in order to test Class A without dependencies. So, my question is, how do I now test Class X as I've a...

How to test my forms in Zend Framework 1.8+?

So I've set up testing in my ZF 1.9.5 application thanks to this tutorial, I am able to test my controllers, now I want to create a test for a form. However, I'm having the problem that PHPUnit can't find my form. Fatal error: Class 'Default_Form_AccountProfile' not found I'm extending PHPUnit_Framework_TestCase instead of Zend_Test_...

determine the http status that will be sent in php

I am trying to write a test case for a class that is managing headers for my application. Among the headers it sends are http status headers. I am using headers_list() to see which headers would be send, were I to send headers now. The problem with headers_list() is that it does not include the http status header (although this seems to ...

Unit Testing (PHPUnit): how to login?

hi there, I'm writing tests for my current project, made with Zend Framework. Everything fine, but I have a problem testing the logged users actions/controllers: I need to be logged in to be able to perform the action/controller. So my question is: How can I be logged in in PHPUnit? thans for reading :) ...

PHP Unit testing

Is there any EASY php testing Framework and may be simpler than simpletest and not command line based like PHPUnit ? ...

Dynamically create PHPUnit tests from data-file

I have a data file with input and expected outputs. An example could be: input: output: 2 3 3 5 4 Exception 5 8 ... ... Currently I have a custom solution to read from the data file and perform a test for each {input,output} pair. I would like to convert this into a PHPUnit based solution and I would...

Windows Netbeans with PHPunit, not working

I ran into this question: http://stackoverflow.com/questions/1552130 But applying the fix mentioned there does not work. Netbeans keeps saying the version of PHPUnit is too old and that I need at least 3.3.0, while I am using 3.3.9. Screenschots: I haven't editted anything about the files, I just downloaded the tgz, unzipped it all ...

unit tests for screen-scraping?

I'm new to unit testing so I'd like to get the opinion of some who are a little more clued-in. I need to write some screen-scraping code shortly. The target system is a web ui where there'll be copious HTML parsing and similar volatile goodness involved. I'll never be notified of any changes by the target system (e.g. they put a redes...