mercredi 3 février 2016

How to check routes with unit testing on Laravel5

I tried using unit testing, but it doesn't work. Somehow, Received status code is 404. Then, terminal stated the reason is an exception 'Symfony\Component\HttpKernel\Exception\NotFoundHttpException'.

Routes.php

Route::get('/', function() {
    return view('toppage')->with('contents', "");
});

ExampleTest.php

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

class ExampleTest extends TestCase
{
    /**
     * A basic test example.
     *
     * @return void
     */
    public function testExample()
    {
        $this->visit('/')
             ->see('Where lane');
    }
}

nignx.conf (excerpt a part from the file)

location / {
        index            index.html index.php;
    }

    location ~* /MAMP(.*)$ {
        root             /Applications/MAMP/bin;
        index            index.php;

        location ~ \.php$ {
            try_files        $uri =404;
            fastcgi_pass     unix:/Applications/MAMP/Library/logs/fastcgi/nginxFastCGI.sock;
            fastcgi_param    SCRIPT_FILENAME $document_root$fastcgi_script_name;
            include          fastcgi_params;
        }
    }



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire