jeudi 13 décembre 2018

RefreshDatabase is extremly slow

I am using Laravel v5.6.26, PHPUnit 6.5.8, and PHP 7.2.9.

This is my full Test Class:

class ExampleTest extends TestCase
{

    use RefreshDatabase;

    /** @test */
    public function basicTest()
    {
        $this->assertTrue(true);
        $this->assertFalse(false);
    }
}

I call phpunit from homestead.

Without use RefreshDatabase this takes 513miliseconds. With use RefreshDatabase it takes 17.29 seconds. I currently have 72 tables.

enter image description here

I only want to test one model that is associated to one table. It seems that refreshing the empty 72 tables is taking so much time. I tried to remove all tables except the one that I need, but use RefreshDatabase will always remigrate all the other tables.

How can I speed this up?

I don't think that the hardware is the issue here. Thats my PC: Ram 32 GB, Intel® Core™ i7-7700K CPU @ 4.20GHz × 8, GeForce GTX 1070/PCIe/SSE2, I am running Ubuntu 18.04.1 LTS 64 Bit.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire