1+ <?php
2+
3+ use Filament \Panel ;
4+ use Filament \PanelRegistry ;
5+ use Redberry \PageBuilderPlugin \Tests \SecondAdminPanelProvider ;
6+
7+ use function Pest \Laravel \artisan ;
8+
9+ describe ('one admin panel ' , function () {
10+ it ('can create block category ' , function () {
11+ expect (file_exists (app_path ('Filament/Admin/BlockCategories/Buttons.php ' )))->toBeFalse ();
12+
13+ artisan ('page-builder-plugin:make-block-category ' )
14+ ->expectsQuestion ('What is the category name? ' , 'Buttons ' );
15+
16+ expect (file_exists (app_path ('Filament/Admin/BlockCategories/Buttons.php ' )))->toBeTrue ();
17+ });
18+
19+ it ('will accept category name as argument ' , function () {
20+ expect (file_exists (app_path ('Filament/Admin/BlockCategories/Buttons.php ' )))->toBeFalse ();
21+
22+ artisan ('page-builder-plugin:make-block-category Buttons ' );
23+
24+ expect (file_exists (app_path ('Filament/Admin/BlockCategories/Buttons.php ' )))->toBeTrue ();
25+ });
26+ });
27+
28+ describe ('multiple admin panels ' , function () {
29+ beforeEach (function () {
30+ app (PanelRegistry::class)->register (
31+ (new SecondAdminPanelProvider (app ()))->panel (Panel::make ())
32+ );
33+ });
34+
35+ it ('will ask for admin panel id ' , function () {
36+ expect (file_exists (app_path ('Filament/SecondAdmin/BlockCategories/Buttons.php ' )))->toBeFalse ();
37+
38+ artisan ('page-builder-plugin:make-block-category Buttons ' )
39+ ->expectsQuestion ('Which panel would you like to create this in? ' , 'second-admin ' );
40+
41+ expect (file_exists (app_path ('Filament/SecondAdmin/BlockCategories/Buttons.php ' )))->toBeTrue ();
42+ });
43+
44+ it ('will accept admin panel id as option ' , function () {
45+ expect (file_exists (app_path ('Filament/SecondAdmin/BlockCategories/Buttons.php ' )))->toBeFalse ();
46+
47+ artisan ('page-builder-plugin:make-block-category Buttons --panel=second-admin ' );
48+
49+ expect (file_exists (app_path ('Filament/SecondAdmin/BlockCategories/Buttons.php ' )))->toBeTrue ();
50+ });
51+ });
0 commit comments