Skip to content

Commit

Permalink
[11.x] Fix build failures due to enum collide After adding BackedEnum…
Browse files Browse the repository at this point in the history
… support to Gate (#52683)

* Fix build failures due to enum collide

* Fix lint
  • Loading branch information
diaafares authored Sep 6, 2024
1 parent caec234 commit 455598c
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 11 deletions.
8 changes: 2 additions & 6 deletions tests/Auth/AuthAccessGateTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
use PHPUnit\Framework\TestCase;
use stdClass;

include_once 'Enums.php';

class AuthAccessGateTest extends TestCase
{
public function testBasicClosuresCanBeDefined()
Expand Down Expand Up @@ -1541,9 +1543,3 @@ public function create()
throw new AuthorizationException('Not allowed.', 'some_code');
}
}

enum AbilitiesEnum: string
{
case VIEW_DASHBOARD = 'view-dashboard';
case UPDATE = 'update';
}
7 changes: 2 additions & 5 deletions tests/Auth/AuthorizeMiddlewareTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
use PHPUnit\Framework\TestCase;
use stdClass;

include_once 'Enums.php';

class AuthorizeMiddlewareTest extends TestCase
{
protected $container;
Expand Down Expand Up @@ -351,8 +353,3 @@ protected function gate()
return $this->container->make(GateContract::class);
}
}

enum AbilitiesEnum: string
{
case VIEW_DASHBOARD = 'view-dashboard';
}
9 changes: 9 additions & 0 deletions tests/Auth/Enums.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?php

namespace Illuminate\Tests\Auth;

enum AbilitiesEnum: string
{
case VIEW_DASHBOARD = 'view-dashboard';
case UPDATE = 'update';
}

0 comments on commit 455598c

Please sign in to comment.