Skip to content

Commit

Permalink
Merge pull request #77 from musimana/chore/MoveBlockTypeEnum
Browse files Browse the repository at this point in the history
chore: Move BlockType Enum
  • Loading branch information
musimana authored May 28, 2024
2 parents f8fc113 + 28467f4 commit be38a9e
Show file tree
Hide file tree
Showing 12 changed files with 23 additions and 18 deletions.
9 changes: 0 additions & 9 deletions app/Enums/BlockType.php

This file was deleted.

10 changes: 10 additions & 0 deletions app/Enums/Blocks/BlockType.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?php

namespace App\Enums\Blocks;

enum BlockType: string
{
/* List of the content blocks available to the application. */
case STACK = 'stack';
case TABS = 'tabs';
}
2 changes: 1 addition & 1 deletion app/Http/Resources/Views/Blocks/BlocksResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace App\Http\Resources\Views\Blocks;

use App\Enums\BlockType;
use App\Enums\Blocks\BlockType;
use App\Interfaces\Resources\Indexes\CollectionIndexInterface;
use App\Models\Block;
use Illuminate\Support\Collection;
Expand Down
2 changes: 1 addition & 1 deletion app/Http/Resources/Views/Blocks/StackBlockResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace App\Http\Resources\Views\Blocks;

use App\Enums\BlockType;
use App\Enums\Blocks\BlockType;
use App\Http\Resources\Formatters\LaravelVersionFormatterResource;
use App\Http\Resources\Formatters\PhpVersionFormatterResource;
use App\Interfaces\Resources\Items\ConstantItemInterface;
Expand Down
2 changes: 1 addition & 1 deletion app/Models/Block.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace App\Models;

use App\Enums\BlockType;
use App\Enums\Blocks\BlockType;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
Expand Down
2 changes: 1 addition & 1 deletion database/factories/BlockFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace Database\Factories;

use App\Enums\BlockType;
use App\Enums\Blocks\BlockType;
use App\Models\Block;
use App\Models\Page;
use Illuminate\Database\Eloquent\Factories\Factory;
Expand Down
2 changes: 1 addition & 1 deletion storage/app/seeds/pages.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

use App\Enums\BlockType;
use App\Enums\Blocks\BlockType;
use App\Enums\Webpages\WebpageTemplate;

/*
Expand Down
2 changes: 1 addition & 1 deletion tests/Datasets/BlockTypes.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?php

use App\Enums\BlockType;
use App\Enums\Blocks\BlockType;

dataset('block-types', fn () => BlockType::cases());
2 changes: 1 addition & 1 deletion tests/Datasets/Blocks.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

use App\Enums\BlockType;
use App\Enums\Blocks\BlockType;
use App\Http\Resources\Formatters\LaravelVersionFormatterResource;
use App\Http\Resources\Formatters\PhpVersionFormatterResource;
use App\Models\Block;
Expand Down
4 changes: 4 additions & 0 deletions tests/Unit/App/Enums/EnumsArchitectureTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@
->not->toHaveSuffix('Enum')
->toBeUsedIn('App');

test('app/Enums/Blocks has valid architecture')
->expect('App\Enums\Blocks')
->toHavePrefix('Block');

test('app/Enums/Webpages has valid architecture')
->expect('App\Enums\Webpages')
->toHavePrefix('Webpage');
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

use App\Enums\BlockType;
use App\Enums\Blocks\BlockType;
use App\Http\Resources\Views\Blocks\StackBlockResource;
use App\Interfaces\Resources\Items\ConstantItemInterface;

Expand Down
2 changes: 1 addition & 1 deletion tests/Unit/Database/Factories/BlockFactoryTest.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

use App\Enums\BlockType;
use App\Enums\Blocks\BlockType;
use App\Models\Block;
use Illuminate\Foundation\Testing\RefreshDatabase;

Expand Down

0 comments on commit be38a9e

Please sign in to comment.