Laravel-在laravel中运行测试时出现错误

时间:2019-08-07 09:54:08

标签: laravel testing phpunit

在laravel中运行测试时出现错误:

  

Illuminate \ Database \ QueryException:找不到驱动程序(SQL:PRAGMA foreign_keys = ON;)

这是测试代码:

namespace Tests\Feature;

use Tests\TestCase;
use Illuminate\Foundation\Testing\RefreshDatabase;
use App\Book;

class BookReservationTest extends TestCase
{
    use RefreshDatabase;

    /** @test */
    public function a_book_can_be_added_to_the_library()
    {
        $this->withoutExceptionHandling();

        $response = $this->post('/books', [
            'title' => 'cool book title',
            'author' => 'victor'
        ]);
        $response->assertOk();
        $this->assertCount(11, Book::all());
    }
}

0 个答案:

没有答案