Skip to content

Commit

Permalink
Update api_token if the data is null
Browse files Browse the repository at this point in the history
  • Loading branch information
DyanGalih committed Jun 14, 2020
1 parent f884ba9 commit 4e1fab0
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/Traits/TestCaseTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,15 @@ protected function getFaker()
return $this->faker->create('id_ID');
}

public function tearDown():void
public function tearDown(): void
{
Artisan::call('migrate:reset');
parent::tearDown();
}

protected function getEnvironmentSetUp($app)
{
$app['config']->set('auth.providers.users.model', User::class );
$app['config']->set('auth.providers.users.model', User::class);
$app['config']->set('app.key', 'AckfSECXIvnK5r28GVIWUAxmbBSjTsmF');
$app['config']->set('database.default', 'sqlite');
$app['config']->set('database.connections.sqlite', [
Expand Down Expand Up @@ -72,6 +72,9 @@ protected function secure()
$user = new User;
$user = $user->find('1');
if ($user != null) {
if ($user->api_token == null) {
$user->api_token = $this->getFaker()->uuid;
}
$this->be($user);
} else {
dd('please add user with id 1 to run this unit test');
Expand All @@ -87,7 +90,8 @@ protected function sendToLog(string $serviceName, string $endpoint, array $data)
error_log('Payload : ' . json_encode($data));
}

protected function resultLog(string $result){
protected function resultLog(string $result)
{
error_log('==========================================================');
error_log('Sample Result : ' . $result);
error_log('==========================================================');
Expand Down

0 comments on commit 4e1fab0

Please sign in to comment.