add tests batch 20

This commit is contained in:
root
2026-06-09 01:03:53 -04:00
parent 95efb9652e
commit 6be4875c5e
1502 changed files with 13797 additions and 11313 deletions
+9 -12
View File
@@ -2,6 +2,7 @@
namespace App\Models;
use App\Models\BaseModel;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Schema;
@@ -30,12 +31,12 @@ class CalendarEvent extends BaseModel
protected $casts = [
// If your column is DATE use 'date', if it's DATETIME use 'datetime'
'date' => 'date',
'notify_parent' => 'boolean',
'notify_admin' => 'boolean',
'date' => 'date',
'notify_parent' => 'boolean',
'notify_admin' => 'boolean',
'notify_teacher' => 'boolean',
'no_school' => 'integer',
'event_type' => 'string',
'no_school' => 'integer',
'event_type' => 'string',
];
private static ?bool $hasEventTypeColumn = null;
@@ -47,21 +48,18 @@ class CalendarEvent extends BaseModel
public static function getEvents()
{
$events = static::query()->get()->toArray();
return static::withNoSchoolFlag($events);
}
public static function getEventByDate(string $date): array
{
$events = static::query()->where('date', $date)->get()->toArray();
return static::withNoSchoolFlag($events);
}
public static function addEvent(array $data): int
{
$row = static::create($data);
return (int) $row->id;
}
@@ -94,7 +92,6 @@ class CalendarEvent extends BaseModel
if (static::$hasEventTypeColumn === null) {
static::$hasEventTypeColumn = static::columnExists((new static)->getTable(), 'event_type');
}
return (bool) static::$hasEventTypeColumn;
}
@@ -126,9 +123,9 @@ class CalendarEvent extends BaseModel
*/
protected static function isNoSchoolEvent(array $event): bool
{
$title = strtolower((string) ($event['title'] ?? ''));
$desc = strtolower((string) ($event['description'] ?? ''));
$text = $title.' '.$desc;
$title = strtolower((string)($event['title'] ?? ''));
$desc = strtolower((string)($event['description'] ?? ''));
$text = $title . ' ' . $desc;
$keywords = ['no school', 'no-school', 'cancel', 'vacation', 'holiday', 'break'];