Fixes for tests

This commit is contained in:
David Bomba 2024-05-29 23:09:45 +10:00
parent e47c875d19
commit 31610560a7
2 changed files with 3 additions and 15 deletions

View File

@ -27,7 +27,6 @@ class GenericReportRequest extends Request
public function authorize(): bool
{
return true;
// return $this->checkAuthority();
}
public function rules()
@ -83,22 +82,11 @@ class GenericReportRequest extends Request
private function checkAuthority()
{
$this->error_message = ctrans('texts.authorization_failure');
/** @var \App\Models\User $user */
$user = auth()->user();
if(Ninja::isHosted() && $user->account->isFreeHostedClient()){
$this->error_message = ctrans('texts.upgrade_to_view_reports');
return false;
}
return $user->isAdmin() || $user->hasPermission('view_reports');
}
protected function failedAuthorization()
{
throw new AuthorizationException($this->error_message);
}
}

View File

@ -28,8 +28,8 @@ $tests = \Illuminate\Support\Str::of($process->getOutput())
))
->filter(fn (string $test) => !empty($test)) // Make sure there are no empty lines
->unique() // We only need unique classes
->split((int) getenv('CI_NODE_TOTAL')) // Split it into equally sized chunks
->get((int) getenv('CI_NODE_INDEX')); // Get the index we need for this instance
->split((int) getenv('CI_NODE_TOTAL',1)) // Split it into equally sized chunks
->get((int) getenv('CI_NODE_INDEX',1)); // Get the index we need for this instance
/**
* Run phpunit with a filter: