Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/heroku/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
PHPUnit测试未使用Laravel6.0和SQLite数据库运行_Php_Laravel_Sqlite_Pdo - Fatal编程技术网

PHPUnit测试未使用Laravel6.0和SQLite数据库运行

PHPUnit测试未使用Laravel6.0和SQLite数据库运行,php,laravel,sqlite,pdo,Php,Laravel,Sqlite,Pdo,这是我的配置/数据库,如果我能得到及时回复 'connections' => [ 'sqlite' => [ 'driver' => 'sqlite', 'url' => env('DATABASE_URL'), 'database' => env('DB_DATABASE', database_path('database.sqlite')), 'prefix' => '',

这是我的配置/数据库,如果我能得到及时回复

'connections' => [

    'sqlite' => [
        'driver' => 'sqlite',
        'url' => env('DATABASE_URL'),
        'database' => env('DB_DATABASE', database_path('database.sqlite')),
        'prefix' => '',
        'foreign_key_constraints' => env('DB_FOREIGN_KEYS', true),
    ]
…这是phpunit.ml

 <testsuite name="Feature">
        <directory suffix="Test.php">./tests/Feature</directory>
    </testsuite>
</testsuites>
<filter>
    <whitelist processUncoveredFilesFromWhitelist="true">
        <directory suffix=".php">./app</directory>
    </whitelist>
</filter>
<php>
    <server name="APP_ENV" value="testing"/>
    <server name="DB_CONNECTION" value="sqlite"/>
     <server name="DB_DATABASE" value=":memory:"/>
    <server name="BCRYPT_ROUNDS" value="4"/>
    <server name="CACHE_DRIVER" value="array"/>
    <server name="MAIL_DRIVER" value="array"/>
    <server name="QUEUE_CONNECTION" value="sync"/>
    <server name="SESSION_DRIVER" value="array"/>
</php>
你浏览过这个吗

这些测试是名为test*的公共方法

尝试使用以下方法:

public function testUserCanBrowseThreads() // <-- note the camelCase
{
    $thread = factory(\App\Thread::class)->create();

    $response = $this->get('/threads');

    $response->assertStatus(200); // <-- did you view the thread?

    $response->assertSee($value); //<-- whatever you want to look for 
}
你浏览过这个吗

这些测试是名为test*的公共方法

尝试使用以下方法:

public function testUserCanBrowseThreads() // <-- note the camelCase
{
    $thread = factory(\App\Thread::class)->create();

    $response = $this->get('/threads');

    $response->assertStatus(200); // <-- did you view the thread?

    $response->assertSee($value); //<-- whatever you want to look for 
}

您需要以
test
开始测试方法的名称,或在docblock中为方法添加
@test
注释:

public function test_a_user_can_browse_threads()
{
    // Starting the tests name with 'test'
}

public function testUserCanBrowseThreads()
{
    // Starting the tests name with 'test' in another format
}

/**
 * @test
 */
public function a_user_can_browse_threads()
{
    // Using the @test annotation
}

您需要以
test
开始测试方法的名称,或者在docblock中为方法添加
@test
注释:

public function test_a_user_can_browse_threads()
{
    // Starting the tests name with 'test'
}

public function testUserCanBrowseThreads()
{
    // Starting the tests name with 'test' in another format
}

/**
 * @test
 */
public function a_user_can_browse_threads()
{
    // Using the @test annotation
}
我们已经解决了这个问题

/vendor/bin/phpunit成功了。。对于最新的laravel版本,调用phpunit direct不起作用。您已经解决了这个问题


/vendor/bin/phpunit成功了。。调用phpunit direct对最新的laravel版本不起作用

它不知道方法最有可能是一种测试方法PLS你可以更详细一点它不知道方法最有可能是一种测试方法PLS你可以更详细一点我可能弄错了,但测试名称不应该是camelCase吗?也许只是一件优先的事情?每天学习新的东西+1作为提示。在camelCase中可能看起来更好:)“这不起作用”。。。谢谢,但是是的“它确实有效”,这里的try againI可能会出错,但是测试名称不应该是camelCase吗?也许只是一件优先的事情?每天学习新的东西+1作为提示。在camelCase中可能看起来更好:)“这不起作用”。。。谢谢,但“它确实有效”,请再试一次