测试 Laravel 时查看 SQLite 数据

问题描述

Laravel 8 默认使用 SQLite 进行数据库测试,但我在哪里可以查看存储在 SQLite 中的数据?我找不到数据文件。

phpunit.xml

<server name="DB_CONNECTION" value="sqlite"/>
<server name="DB_DATABASE" value=":memory:"/>

测试后

class PostTest extends TestCase
{
    use RefreshDatabase;   

    public function test_a_post_can_be_created_through_the_form()
    {        
        $this->actingAs(User::factory()->create());
        $response = $this->post('/posts',[
            'title' => 'Test title','detail' => 'Test detail'
        ]);
        $this->assertCount(1,Post::all());
    }
}

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)