jeudi 29 décembre 2016

Laravel 5.3 DatabaseMigrations are destructive

Laravel 5.3 with mysql, PHPUnit 5.7.4

When I create a test in PHPUnit with use DatabaseMigrations;, it destroys the data that it queries.

<?php

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

class ThingsTest extends TestCase
{
    use DatabaseMigrations;

    /** @test */
    public function there_are_more_than_1000_things()
    {
        $things = App\Thing::all();

        $this->assertGreaterThan(1000, count($things));
    }

Before I run phpunit, there are lots of things. After running it, mysql says ERROR 1146 (42S02): Table 'database.things' doesn't exist

Any ideas how to stop this?



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

Aucun commentaire:

Enregistrer un commentaire