My test class is very simple
<?php
use Illuminate\Foundation\Testing\WithoutMiddleware;
use Illuminate\Foundation\Testing\DatabaseMigrations;
use Illuminate\Foundation\Testing\DatabaseTransactions;
class ExampleTest extends TestCase
{
/**
* A basic functional test example.
*
* @return void
*/
public function testBasicExample()
{
$this->visit('/');
}
// when I add this, I get an error
public function testAnotherExample()
{
$this->visit('profile');
}
}
When I only have the "testBasicExample" method, the test runs fine. However, as soon as I add "testAnotherExample", the test fails with following error message.
Fatal error: Cannot redeclare formatBytes() (previously declared in C:\xampp\htdocs\laravellab\helpers\functions.php:3) in C:\xampp\htdocs\laravellab\helpers\functions.php on line 7
Fatal error: Uncaught exception 'Illuminate\Contracts\Container\BindingResolutionException' with message 'Target [Illuminate\Contracts\Debug\ExceptionHandler] is not instantiable.' in C:\xampp\htdocs\laravellab\vendor\laravel\framework\src\Illuminate\Container\Container.php:749
Stack trace:
#0 C:\xampp\htdocs\laravellab\vendor\laravel\framework\src\Illuminate\Container\Container.php(631): Illuminate\Container\Container->build('Illuminate\\Cont...', Array)
#1 C:\xampp\htdocs\laravellab\vendor\laravel\framework\src\Illuminate\Foundation\Application.php(674): Illuminate\Container\Container->make('Illuminate\\Cont...', Array)
#2 C:\xampp\htdocs\laravellab\vendor\laravel\framework\src\Illuminate\Foundation\Bootstrap\HandleExceptions.php(154): Illuminate\Foundation\Application->make('Illuminate\\Cont...')
#3 C:\xampp\htdocs\laravellab\vendor\laravel\framework\src\Illuminate\Foundation\Bootstrap\HandleExceptions.php(79): Illuminate\Foundation\Bootstrap\HandleExceptions->getExceptionHandler()
#4 C:\xampp\htdocs\laravellab\vendor\laravel\framework\src\Illuminate\Container\Container.php on line 749
The same test if I comment out the "testBasicExample", then the other test works just fine.
Thank you for your help.