G
G
GrimJack2017-07-28 15:53:39
Laravel
GrimJack, 2017-07-28 15:53:39

How to create tests in laravel?

I decided to write tests for API on Laravel. Got into the documentation https://laravel.com/docs/5.4/http-tests.
I did a test I
cleared Artisan's cache I run
tests php vendor/bin/phpunit
And nothing..

/var/www # php vendor/bin/phpunit                        
PHPUnit 5.7.21 by Sebastian Bergmann and contributors.

Time: 62 ms, Memory: 4.00MB

No tests executed!

I assume that it needs to be connected somewhere.
However, I did not find any information on this
. Automatically, the test was created in tests / future / test name.php
UPD
Test
<?php
namespace Tests\Feature;

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

class APITest extends TestCase
{
    /**
     * A basic test example.
     *
     * @return void
     */
    public function testBasicTest()
    {
        ////
    }
}

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander Melikhov, 2017-07-28
@GrimJack

Check the following
- the test file must end with Test
- the name of the test method must start with test or have the annotation /** @test */

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question