when I have more than one test in a testfile with laravel, and I execute them I get:
Fatal error: Cannot redeclare nameSort() (previously declared in C:\wamp\www\project\app\start\global.php:110) in C:\wamp\www\project\app\start\global.php on line 112
This is even when this is my testfile:
class DealControllerTest extends TestCase {
public function testIndex()
{
$this->assertTrue(true);
}
public function testApiKey()
{
$this->assertTrue(true);
}
}
I was able to solve the issue by replacing require
with require_once
for includes in the global.php file.
For example,
require app_path().'/helpers.php';
should be
require_once app_path().'/helpers.php';
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With