phpunit

Eclipse PDT & PHPUnit ??

Is there any integration of PHPUnit with Eclipse PDT? If not, are there any plans to do so? ...

Is there any good tutorial (example) for unit testing kohana base project?

I am looking for the best practices with PHPUnit testing a project on KohanaPHP framework. ...

Phing, Xinc or phpUnderControl - which one will last?

I am still looking into which one of these tools I should use. When I was poking around I noticed none of them really have any new releases: Xinc Version 2.0.1 released 02/05/08 Phing Version 2.3.3 released 12/07/08 phpUnderControl Version 0.4.4 released 08/09/08 Should I choose phpUnderControl because it had the latest release and de...

Step by step tutorial for xinc?

I am trying to get into CI development for a php project, after I failed with phpUnderControl because Java seemed to explode at me I wanted to try xinc. I got xinc installed just fine (mainly because I am good at php and knew what the errors it gave out ment). Is there a step by step tutorial for a project? I have only found this: http:/...

Install PHPUnit and Pear correctly on OSX Leopard

Hey all, I've installed pear using this guide http://t-machine.org/index.php/2008/12/28/how-to-install-pear-on-os-x-105/ In /etc/php.ini my include_path = ".:/usr/local/PEAR" PHPUnit is installed under /usr/local/PEAR/PHPUnit using sudo pear install phpunit/PHPUnit(I get an error otherwise) Yet when I try execute phpunit I'm getting ...

How to refactor this constructor so it is testable?

I have a class that is a container for a bunch of module objects. Right now the container takes in an array of file paths, then includes the files and instantiates the modules class module { function execute(); } class container { public $Name; public $Modules; public __construct($Obj){ $this->Name = $Obj->Name;...

PHP Debugger with Unit Testing

Hello All, I have gotten the Zend debugger to work with PDT 2.1. On the project I'm working on, I do unit testing with PHPUnit but running the debugger won't catch any of the breakpoints until I make some instances of the test class and then run the tests manually. This is an issue, as I'd like to have the code base remain independent...

How do you Unit Test a Zend_Form that includes the CSRF form element?

I'm using the CSRF hidden hash element with Zend_Form and trying to Unit Test the login but don't know how to write a Unit Test to include that element. Looked in the docs and read as many tutorials as I could find. I even delicioused them all, but no one mentions this. ...

Equivalent of SimpleTest "partial mocks" in PHPUnit?

I'm trying to migrate a bunch of tests from SimpleTest to PHPUnit and I was wondering if there is an equivalent for SimpleTest's partial mocks. Update: I can't seem to find anything in the docs which suggests that this feature is available, but it occurred to me that I could just use a subclass. Is this a good or bad idea? class StuffD...

Selenium RC Tests + Unit Tests using PHPUnit throws a Seg Fault

So I have a set of unit/integration tests and a set of selenium rc tests as part of my suite. When I run them together using PHPUnit I get a Segmentation fault error message at the very end of the run when, during normal operation, it starts to generate log files. The interesting part is, if I run just the unit tests, or just the seleniu...

OSS PHP projects using PHPUnit for unit-testing ?

Hi, I know there are two main unit-testing frameworks in PHP : PHPUnit SimpleTest I am using PHPUnit, and was searching for PHP (Open source would be great ; but I'm also interested in non-OSS ones, if they are big / well-know / from big companies) projects, be it applications, libraries, frameworks, ... that would use PHPUnit as U...

test the return value of a method that triggers an error with PHPUnit

This question is specific to using PHPUnit. PHPUnit automatically converts php errors to exceptions. Is there a way to test the return value of a method that happens to trigger a php error (either built-in errors or user generated errors via *trigger_error*)? Example of code to test: function load_file ($file) { if (! file_exists(...

Which unit testing framework do you use for Symfony?

Which unit testing framework do you use for Symfony? Lime or PHPUnit? What are the pros and cons of using them? ...

Zend Framework: How to unit test a model using Zend_Service_Twitter

Hello, I have been getting into Unit Testing with Zend Framework. I am getting used to the other things it provide but I am having a hard time understanding Mock Objects. For this example, I am trying to use a Mock Object to test out my model. <?php class Twitter_Model_Twitter { private $_twitter; /** * Make the options...

PHPUnit getMock() with namespace

My quest of starting to use namespaces in PHP keeps continuing. This time PHPUnit gives me problems. My setup() method is like this: $test = new \MyNamespace\NonPersistentStorage(); // works $mock = $this->getMock('\\MyNamespace\\NonPersistentStorage'); // doesn't work The getMock() method only results in PHP looking for a NonPersiste...

Creating mock Objects in PHP unit

Hi, I've searched but can't quite find what I'm looking for and the manual isn't much help in this respect. I'm fairly new to unit testing, so not sure if I'm on the right track at all. Anyway, onto the question. I have a class: <?php class testClass { public function doSomething($array_of_stuff) { return Anothe...

TeamCity and PHP

We are considering TeamCity for continuous integration but have projects in both Rails (Rake tests) and PHP (PHPUnit tests). I'm a bit new to CI - Has anyone setup TeamCity for PHP projects? If so, is it straight-forward? Thanks, Chad ...

How do you use PHPUnit to test a function if that function is supposed to kill PHP?

Essentially I have a method of a class called killProgram, which is intended to send a hTTP redirect and then kill PHP. How am I supposed to test this? When I run phpunit it doesn't return anything for that test, and closes completely. Right now I'm considering having the killProgram function throw an exception which shouldn't get hand...

Can Selenium RC tests written in Python be integrated into PHPUnit?

I'm working on large project in PHP and I'm running phpundercontrol with PHPUnit for my unit tests. I would like to use Selenium RC for running acceptance tests. Unfortunately the only person I have left to write tests only knows Python. Can Selenium tests written in Python be integrated into PHPUnit? Thanks! ...

phpunit (install) error

i have tried installing phpunit the install itself seems fine. i can run "phpunit" but when i try to run a test "phpunit test.php" i get '""C:\Program' is not recognized as an internal or external command, operable program or batch file. PHPUnit 3.3.17 by Sebastian Bergmann. .. Time: 0 seconds OK (2 tests, 2 assertions) so as u c...