mercredi 1 juin 2016

Testing Laravel 5.2.x custom package using Laravel API

As Laravel documentation says, Laravel provides a very fluent API for making HTTP requests to your application, examining the output, and even filling out forms. See: http://ift.tt/1Pjm6dI

So, how could I test a custom Laravel package using Laravel API?

Por example, in a Laravel project, you can test HTTP requests using Laravel API like this:

<?php

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

class ExampleTest extends TestCase
{
    /**
     * A basic functional test example.
     *
     * @return void
     */
    public function testBasicExample()
    {
        $this->visit('/')
             ->see('Laravel 5')
             ->dontSee('Rails');
    }
}

As I read, many people use Laravel Package Unit Testing Helper to tests their packages but then you can't use Laravel methods like $this->visit('/') to make your test, or is this possible?

If it isn't possible with this package, how could I make Laravel API use testing in my package?

Thanks!



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/22xwrF0
via IFTTT

Aucun commentaire:

Enregistrer un commentaire