Run single phpunit test

test

Run single phpunit test

Well, we all love php unit tests :). There are times we would like to run one/single test from test suite that has failed so that we can fix or look at it thoroughly. PHPUnit has a way to do it.
The problem, when you are your php unit suite as

phpunit -c /testFolder..

All you php tests would run.
The solution for this is:
Let’s assume you have this particular php unit test in one of your test files

public function testPhpIsAwesomeOrNot(){
}

All you have to do is to add the <b>group annotation</b> above the function of your php unit test

/**
 * @group awesome
 */
public function testPhpIsAwesomeOrNot(){}

and run your PHPUnit single test wiht –group annotation

phpunit -c /testfolder --group awesome

The above would run single PHPUnit test from the test suite.

Post to Facebook From app – Using PHP

connect to sftp from php

$_POST vs $HTTP_RAW_POST_DATA vs php://input and enctype

how to deploy symfony application to the production server

Deploying Symfony on Production Server

composer install-update killed on vagrant machine

Leave a Reply

Your email address will not be published. Required fields are marked *

*
*