Display test's names while running PHPUnit

Submitted by nezarfadle - 7 years 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

<?php

namespace Tests;

use Illuminate\Foundation\Testing\TestCase as BaseTestCase;

abstract class TestCase extends BaseTestCase
{
    use CreatesApplication;

    public function setup()
    {
    	parent::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