I’m following the Surge screencasts. In the 3rd episode of “A basic form with validation” Caleb says that using the RefreshDatabase
trait will mean that the tests are run in an ephemeral version of the database which won’t affect the actual database. This sounds like a great way to run tests, but unfortunately it doesn’t seem to be working this way.
As a very basic example, I can run:
artisan migrate:fresh --seed
…and I get my [email protected]
user to log in with. I then create this test:
class RegistrationTest extends TestCase
{
use RefreshDatabase;
/** @test */
public function registration_pafe_contains_livewire_component()
{
$this->get('/register')->assertSeeLivewire('auth.register');
}
}
…and just by running phpunit
with that single test my actual database is completely erased, so use RefreshDatabase;
clearly isn’t causing the tests to be done in an ephemeral database without affecting the real one is it?
I’ve had a look over Caleb’s code in the Surge Github repo and I can’t see anything that I’ve missed, and running the same tests seems to be preserving the original database for him in the screencasts.
Any tips would be very much appreciated.