Top "Phpunit" questions

PHPUnit is a programmer-oriented testing framework for PHP.

PHPUnit assert that an exception was thrown?

Does anyone know whether there is an assert or something like that which can test whether an exception was thrown …

php exception phpunit assert
How to run single test method with phpunit?

I am struggling to run a single test method named testSaveAndDrop in the file escalation/EscalationGroupTest.php with phpunit. I …

php phpunit
Best practices to test protected methods with PHPUnit

I found the discussion on Do you test private method informative. I have decided, that in some classes, I want …

php unit-testing phpunit
How to output in CLI during execution of PHP Unit tests?

When running a PHPUnit test, I would like to be able to dump output so I can debug one or …

php unit-testing phpunit
PHPUnit: assert two arrays are equal, but order of elements not important

What is a good way to assert that two arrays of objects are equal, when the order of the elements …

php unit-testing phpunit assert
How do I get HTTP Request body content in Laravel?

I am making an API with Laravel 5 and I'm testing it with PHPUnit. I need to test legacy functionality for …

php xml laravel phpunit
phpunit mock method multiple calls with different arguments

Is there any way to define different mock-expects for different input arguments? For example, I have database layer class called …

php mocking phpunit
How can I get PHPUnit MockObjects to return different values based on a parameter?

I've got a PHPUnit mock object that returns 'return value' no matter what its arguments: // From inside a test... $mock = $…

php unit-testing mocking phpunit
Mock private method with PHPUnit

I have a question about using PHPUnit to mock a private method inside a class. Let me introduce with an …

php mocking phpunit
PHPUnit Mock Objects and Static Methods

I am looking for the best way to go about testing the following static method (specifically using a Doctrine Model): …

php unit-testing mocking doctrine phpunit