samuel toh
samuel toh

Reputation: 7076

How to solve Fatal error: Cannot redeclare view() (previously declared? (phpunit laravel 5.3)

When I run ./vendor/bin/phpunit to check my event & listener, there exist error like this :

Fatal error: Cannot redeclare view() (previously declared in C:\xampp\htdocs\myshop\vendor\laravel\framework\src\Illuminate\Foundation\helpers.php:850) in C:\xampp\htdocs\myshop\app\Http\helpers.php on line 92 PHP Fatal error: Cannot redeclare view() (previously declared in C:\xampp\htdocs\myshop\vendor\laravel\framework\src\Illuminate\Foundation\helpers.php:850) in C:\xampp\htdocs\myshop\app\Http\helpers.php on line 92

How can I solve it?

Upvotes: 1

Views: 3798

Answers (1)

Shafiqul Islam
Shafiqul Islam

Reputation: 5690

you can use this code

 if (!function_exists('view')) {
    function view()
    {
        //your code here
    }
    }

or you can use

include_once() or require_once() // your file where you include , so change it and replace it hope it will work

Upvotes: 5

Related Questions