mirror of
https://github.com/sp-tarkov/forge.git
synced 2025-02-12 20:20:41 -05:00
update scope and tests
to not include null published at fields
This commit is contained in:
parent
fe280faf36
commit
82a466eb58
@ -14,6 +14,7 @@ class PublishedScope implements Scope
|
|||||||
*/
|
*/
|
||||||
public function apply(Builder $builder, Model $model): void
|
public function apply(Builder $builder, Model $model): void
|
||||||
{
|
{
|
||||||
$builder->where($model->getTable().'.published_at', "<=", now());
|
$builder->whereNotNull($model->getTable().'.published_at')
|
||||||
|
->where($model->getTable().'.published_at', "<=", now());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -17,10 +17,10 @@ it('includes only published mod versions', function () {
|
|||||||
|
|
||||||
$mods = ModVersion::all();
|
$mods = ModVersion::all();
|
||||||
|
|
||||||
expect($mods)->toHaveCount(2);
|
expect($mods)->toHaveCount(1);
|
||||||
expect($mods->contains($publishedMod))->toBeTrue();
|
expect($mods->contains($publishedMod))->toBeTrue();
|
||||||
expect($mods->contains($unpublishedMod))->toBeFalse();
|
expect($mods->contains($unpublishedMod))->toBeFalse();
|
||||||
expect($mods->contains($noPublishedDateMod))->toBeTrue();
|
expect($mods->contains($noPublishedDateMod))->toBeFalse();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('handles null published_at as not published', function () {
|
it('handles null published_at as not published', function () {
|
||||||
@ -30,5 +30,5 @@ it('handles null published_at as not published', function () {
|
|||||||
|
|
||||||
$mods = ModVersion::all();
|
$mods = ModVersion::all();
|
||||||
|
|
||||||
expect($mods->contains($modWithNoPublishDate))->toBeTrue();
|
expect($mods->contains($modWithNoPublishDate))->toBeFalse();
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user