Skip to content

Commit

Permalink
Moved fixtures to test class
Browse files Browse the repository at this point in the history
  • Loading branch information
rennokki committed Dec 13, 2022
1 parent b2f7d92 commit 72f441d
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 59 deletions.
51 changes: 49 additions & 2 deletions tests/ActorPolicyTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,12 @@
namespace RenokiCo\Acl\Test;

use RenokiCo\Acl\Acl;
use RenokiCo\Acl\Concerns\HasArn;
use RenokiCo\Acl\Concerns\HasPolicies;
use RenokiCo\Acl\Contracts\Arnable;
use RenokiCo\Acl\Contracts\RuledByPolicies;
use RenokiCo\Acl\Exceptions\WildcardNotPermittedException;
use RenokiCo\Acl\Statement;
use RenokiCo\Acl\Test\Fixtures\User;
use RenokiCo\Acl\Test\Fixtures\Vps;

class ActorPolicyTest extends TestCase
{
Expand Down Expand Up @@ -297,3 +299,48 @@ public function add()
$user->loadPolicies([$policy]);
}
}

class User implements RuledByPolicies
{
use HasPolicies;

public function __construct(
public string $id,
public string $team = 'team-1',
public string $region = 'local',
) {
//
}

public function resolveArnAccountId()
{
return $this->team;
}

public function resolveArnRegion()
{
return $this->region;
}
}

class Vps implements Arnable
{
use HasArn;

public function __construct(
public string $id = 'vps-000',
public string $team = 'team-1',
) {
//
}

public function arnResourceAccountId()
{
return $this->team;
}

public function arnResourceId()
{
return $this->id;
}
}
29 changes: 0 additions & 29 deletions tests/fixtures/User.php

This file was deleted.

28 changes: 0 additions & 28 deletions tests/fixtures/Vps.php

This file was deleted.

0 comments on commit 72f441d

Please sign in to comment.