From 0a514cef19da0bf4b6eae26e31a9589550752b80 Mon Sep 17 00:00:00 2001 From: Dyan Galih Date: Sun, 7 Jun 2020 10:40:36 +0700 Subject: [PATCH] Add secure for unit test --- src/Traits/TestCaseTrait.php | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/src/Traits/TestCaseTrait.php b/src/Traits/TestCaseTrait.php index b3b6e7e..cffc432 100644 --- a/src/Traits/TestCaseTrait.php +++ b/src/Traits/TestCaseTrait.php @@ -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('=========================================================='); + } } \ No newline at end of file