-
-
Notifications
You must be signed in to change notification settings - Fork 1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support re-enabling actions if they have been disabled.
- Loading branch information
1 parent
e937da8
commit 97d1650
Showing
3 changed files
with
44 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<?php | ||
|
||
namespace EasyCorp\Bundle\EasyAdminBundle\Tests\Dto; | ||
|
||
use EasyCorp\Bundle\EasyAdminBundle\Dto\ActionConfigDto; | ||
use PHPUnit\Framework\TestCase; | ||
|
||
final class ActionConfigDtoTest extends TestCase | ||
{ | ||
public static function provideLabels(): \Generator | ||
{ | ||
yield 'nothing to enable' => [[], ['foo', 'bar', 'baz', 'qux']]; | ||
yield 'enable action not disabled' => [['not-disabled'], ['foo', 'bar', 'baz', 'qux']]; | ||
yield 'enable 1 action' => [['bar'], ['foo', 'baz', 'qux']]; | ||
yield 'enable multiple action' => [['foo', 'baz'], ['bar', 'qux']]; | ||
yield 'enable all' => [['foo', 'bar', 'baz', 'qux'], []]; | ||
} | ||
|
||
/** | ||
* @dataProvider provideLabels | ||
*/ | ||
public function testEnableActions(array $actionsToEnable, array $expectedDisabledActions): void | ||
{ | ||
$actionConfigDto = new ActionConfigDto(); | ||
$actionConfigDto->disableActions(['foo', 'bar', 'baz', 'qux']); | ||
|
||
$this->assertSame(['foo', 'bar', 'baz', 'qux'], $actionConfigDto->getDisabledActions()); | ||
|
||
$actionConfigDto->enableActions($actionsToEnable); | ||
$this->assertSame($expectedDisabledActions, $actionConfigDto->getDisabledActions()); | ||
} | ||
} |