Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I turn off the colors in Laravel's PHPUnit task?

I'm testing under Windows and the command prompt doesn't do so well with the ANSI color codes that appear by default. How can I turn off the color display when I'm using Laravel?

like image 335
J.T. Grimes Avatar asked Jun 03 '12 23:06

J.T. Grimes


People also ask

How to run a PHPUnit test in Laravel?

Laravel will create a basic test class that looks like this: It is good to find out the default Laravel phpunit.xml file before running your test suite. PHPUnit will itself locate for the file naming phpunit.xml or phpunit.xml.dist in its current execution directory. Within this file, you can configure specific operations for your tests.

What is the purpose of this Laravel test tutorial?

The purpose of this tutorial is to introduce you to the basics of PHPUnit testing, using both the default PHPUnit assertions and the Laravel test helpers. The aim is for you to be confident in writing basic tests for your applications by the end of the tutorial.

How do I use Laravel facades in tests?

This allows us to use Laravel facades in tests and provides the framework for the testing helpers, which we will look at shortly. To create a new test class, we can either create a new file manually or run the helpful Artisan make:test command provided by Laravel.

Where do I find Laravel unit testing files?

Earlier in this Laravel unit testing example, we saw the default files within the /tests/ directory and left the ./tests/ExampleTest.php file to review at the later stage. So open it now, it should look like this:


1 Answers

The file \laravel\cli\tasks\test\stub.xml is used to generate the PhpUnit configuration file for tests. (A new configuration file is generated and deleted every time you run an artisan test task.) To turn off colors, change the first line of stub.xml from <phpunit colors="true" to <phpunit colors="false" (for Laravel 3)

Update: For Laravel 4, the file is phpunit.xml and is found in the root folder. The change is still to set colors="false".

like image 115
J.T. Grimes Avatar answered Oct 02 '22 21:10

J.T. Grimes