LaravelTests

From Doku
Revision as of 12:25, 18 September 2020 by Sebas (talk | contribs) (Created page with "<syntaxhighlight lang="php"> use RefreshDatabase; </syntaxhighlight> <syntaxhighlight lang="php"> $this->artisan('import:users') ->expectsQuestion('Please provide the...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
  use RefreshDatabase;
$this->artisan('import:users')
     ->expectsQuestion('Please provide the URL', $input_url)
     ->expectsOutput('Thank you, users have been imported')
     ->assertExitCode(0);
$this->assertCount(7, $countable);

$this->assertDatabaseHas( (new User())->getTable(),
    'gender' => 'male',
    'email' => 'me@myemail.com',
    'phone' => '55512341234',
    'nat' => 'DK',
)