Skip to content

Commit

Permalink
Add secure for unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
DyanGalih committed Jun 7, 2020
1 parent 46ce463 commit 0a514ce
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions src/Traits/TestCaseTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,4 +65,30 @@ public function __construct($name = null, array $data = [], $dataName = '')
$this->container = new Container();
parent::__construct($name, $data, $dataName);
}

protected function secure()
{
$user = new User;
$user = $user->find('1');
if ($user != null) {
$this->be($user);
} else {
dd('please add user with id 1 to run this unit test');
}
return $user;
}

protected function sendToLog(string $serviceName, string $endpoint, array $data)
{
error_log('==========================================================');
error_log('Service Name : ' . $serviceName);
error_log('Endpoint : ' . $endpoint);
error_log('Payload : ' . json_encode($data));
}

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

0 comments on commit 0a514ce

Please sign in to comment.