mardi 11 juillet 2017

Unit testing - return view() on Laravel 5.4

I'm on Laravel 5.4 and I try to create a test for my controller. But when my method returns a view(), the tests run and freeze when method call is called in my test. I have no error on my Laravel.log

HomeController :

public function index() {
     return view('test'); // If not a return, no problem ...
}

HomeControllerTest :

<?php

use Illuminate\Foundation\Testing\WithoutMiddleware;
use Illuminate\Foundation\Testing\DatabaseMigrations;
use Illuminate\Foundation\Testing\DatabaseTransactions;

class AdControllerTest extends TestCase
{
    /**
     * A basic test example.
     *
     * @return void
     */
    public function testExample()
    {
        $this->assertTrue(true); // it's ok
    }

    public function testIndex()
    {
        $response = $this->call('GET', '/test'); // Freeze ...
        $view = $response;
    }
}

Thanks for your help

Aucun commentaire:

Enregistrer un commentaire