Skip to content

Commit

Permalink
Move test to ReportedIssuesTest
Browse files Browse the repository at this point in the history
  • Loading branch information
JosephSilber committed May 19, 2022
1 parent 4f060fb commit c1eb580
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 17 deletions.
17 changes: 0 additions & 17 deletions tests/ForbidTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -186,23 +186,6 @@ function forbid_an_ability_on_everything($provider)
$this->assertTrue($bouncer->cannot('delete', $user));
}

/**
* @test
* @dataProvider bouncerProvider
*/
function forbid_an_ability_on_everything_with_zero_id($provider)
{
list($bouncer, $user1, $user2, $user3) = $provider(3);

$user2->setAttribute($user2->getKeyName(), 0);

$bouncer->allow($user1)->everything();
$bouncer->forbid($user1)->to('edit', $user2);

$this->assertTrue($bouncer->cannot('edit', $user2));
$this->assertTrue($bouncer->can('edit', $user3));
}

/**
* @test
* @dataProvider bouncerProvider
Expand Down
29 changes: 29 additions & 0 deletions tests/ReportedIssuesTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?php

namespace Silber\Bouncer\Tests;

use Silber\Bouncer\Database\Role;
use Silber\Bouncer\Database\Ability;

class ReportedIssuesTest extends BaseTestCase
{
use Concerns\TestsClipboards;

/**
* @test
* @dataProvider bouncerProvider
* @see https://github.com/JosephSilber/bouncer/pull/589
*/
function forbid_an_ability_on_everything_with_zero_id($provider)
{
list($bouncer, $user1, $user2, $user3) = $provider(3);

$user2->setAttribute($user2->getKeyName(), 0);

$bouncer->allow($user1)->everything();
$bouncer->forbid($user1)->to('edit', $user2);

$this->assertTrue($bouncer->cannot('edit', $user2));
$this->assertTrue($bouncer->can('edit', $user3));
}
}

0 comments on commit c1eb580

Please sign in to comment.