Level 102
Any chance you have set $connection on the User model?
This is my setup so far:
.env
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=payforu
DB_USERNAME=root
DB_PASSWORD=
phpunit.xml
<php>
<server name="APP_ENV" value="testing"/>
<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"/>
<server name="DB_CONNECTION" value="sqlite"/>
<server name="DB_DATABASE" value=":memory:"/>
</php>
Console sqlite3 version
C:\xampp\htdocs\payforu>sqlite3 --version
3.31.1 2020-01-27 19:55:54 3bfa9cc97da10598521b342961df8f5f68c7388fa117345eeb516
eaa837bb4d6
PassportTest.php
<?php
namespace Tests\Feature;
use Tests\TestCase;
use App\Models\User;
use Laravel\Passport\Passport;
use Illuminate\Foundation\Testing\WithFaker;
use Illuminate\Foundation\Testing\RefreshDatabase;
class PassportTest extends TestCase
{
use WithFaker, RefreshDatabase;
/** @test */
public function it_return_token_after_signup()
{
$this->withoutExceptionHandling();
$this->postJson(
'/api/signup',
[
'name' => $this->faker->name,
'email' => $this->faker->email,
'password' => '12345678',
'password_confirmation' => '12345678',
'platform' => $this->faker->company,
'country' => $this->faker->country,
]
)->assertJsonStructure([
'access_token',
'token_type',
'expires_at'
])->assertStatus(200);
}
}
After all of this, the user is created in my mysql database and i want use sqlite for my tests
Any help would be appreciated.
Please or to participate in this conversation.