Skip to content

Commit

Permalink
Add resources for tests
Browse files Browse the repository at this point in the history
  • Loading branch information
luilliarcec committed Oct 8, 2023
1 parent 131cea9 commit 971e5ca
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ public function up(): void
$table->string('name');
$table->string('email', 254);
$table->unsignedTinyInteger('order')->default(0);
$table->unsignedTinyInteger('type')->nullable();
$table->timestamps();
});
}
Expand Down
10 changes: 10 additions & 0 deletions tests/Mocks/Enums/AuthorTypeEnum.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?php

namespace Tests\Mocks\Enums;

enum AuthorTypeEnum: int
{
case VIP = 1;
case Public = 2;
case Private = 3;
}
5 changes: 5 additions & 0 deletions tests/Mocks/Models/Author.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,18 @@
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Tests\Mocks\Database\Factories\AuthorFactory;
use Tests\Mocks\Enums\AuthorTypeEnum;

class Author extends Model
{
use HasFactory;

protected static $unguarded = true;

protected $casts = [
'type' => AuthorTypeEnum::class,
];

protected static function newFactory(): AuthorFactory
{
return AuthorFactory::new();
Expand Down

0 comments on commit 971e5ca

Please sign in to comment.