Lint
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
This commit is contained in:
parent
4e43609619
commit
44e8da9a37
|
@ -204,18 +204,6 @@ class Form extends Model implements HasMedia
|
|||
|
||||
public function canRegister(): bool
|
||||
{
|
||||
if (!$this->is_active) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($this->registration_from && $this->registration_from->gt(now())) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($this->registration_until && $this->registration_until->lt(now())) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
return $this->is_active && $this->isInDates();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -183,6 +183,22 @@ it('testItDoesntReturnInactiveForms', function () {
|
|||
$this->callFilter('form.index', ['inactive' => false])->assertInertiaCount('data.data', 2);
|
||||
});
|
||||
|
||||
it('returns in dates', function () {
|
||||
$this->withoutExceptionHandling()->login()->loginNami();
|
||||
Form::factory()->create();
|
||||
|
||||
sleep(1);
|
||||
$this->callFilter('form.index', [])->assertInertiaPath('data.data.0.is_in_dates', true);
|
||||
});
|
||||
|
||||
it('returns not in dates', function () {
|
||||
$this->withoutExceptionHandling()->login()->loginNami();
|
||||
Form::factory()->registrationFrom(now()->addDay(2))->create();
|
||||
|
||||
sleep(1);
|
||||
$this->callFilter('form.index', [])->assertInertiaPath('data.data.0.is_in_dates', false);
|
||||
});
|
||||
|
||||
it('testItOrdersByStartDateDesc', function () {
|
||||
$this->withoutExceptionHandling()->login()->loginNami();
|
||||
$form1 = Form::factory()->from(now()->addDays(4))->to(now()->addYear())->create();
|
||||
|
|
Loading…
Reference in New Issue