withoutMiddleware( ThrottleRequests::class ); $this->withoutExceptionHandling(); } public function testBackupJsonRead() { $backup_json_file = base_path().'/tests/Feature/Import/backup.json'; $this->assertTrue(is_array(json_decode(file_get_contents($backup_json_file),1))); } public function testImportUsers() { $backup_json_file = base_path().'/tests/Feature/Import/backup.json'; $backup_json_file = json_decode(file_get_contents($backup_json_file)); $this->assertTrue(property_exists($backup_json_file, 'app_version')); $this->assertTrue(property_exists($backup_json_file, 'users')); User::unguard(); foreach ($backup_json_file->users as $user) { $new_user = User::firstOrNew( ['email' => $user->email], (array)$user, ); $new_user->account_id = $this->account->id; $new_user->save(['timestamps' => false]); nlog($new_user->toArray()); $this->ids['users']["{$user->id}"] = $new_user->id; nlog($this->ids); } User::reguard(); } }