Display test's names while running PHPUnit

Submitted by nezarfadle - 1 month ago

Display test's names in the console

// File Tests/TestClass.php
// We are gonna use the setup method to spit out the test's names


namespace Tests;

use Illuminate\Foundation\Testing\TestCase as BaseTestCase;

abstract class TestCase extends BaseTestCase
    use CreatesApplication;

    public function setup()
    	$testName = str_replace(["test", "_"], ["", " "], $this->getName());
    	$testName = preg_replace_callback("/[a-zA-Z0-9]{3,}\b/", function($match){
    		return ucfirst($match[0]);
    	}, $testName);

    	dump(" ->" . $testName);

//run phpunit
comments powered by Disqus

Ads cover the costs of maintaining Laravel-tricks