Skip to content

Commit

Permalink
Fix styling
Browse files Browse the repository at this point in the history
  • Loading branch information
bajramemini authored and github-actions[bot] committed Jan 7, 2025
1 parent 486fc0e commit c401265
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 12 deletions.
20 changes: 10 additions & 10 deletions tests/Feature/Aura/CreateResourcePermissionsCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
'restore' => 'Restore',
'delete' => 'Delete',
'forceDelete' => 'Force Delete',
'scope' => 'Scope'
'scope' => 'Scope',
];

foreach ($permissionTypes as $type => $displayName) {
Expand All @@ -50,7 +50,7 @@
])->first();

expect($permission)->not->toBeNull()
->and($permission->name)->toBe($displayName . ' ' . $r->pluralName())
->and($permission->name)->toBe($displayName.' '.$r->pluralName())
->and($permission->group)->toBe($r->pluralName());
}
}
Expand All @@ -63,27 +63,27 @@
// Create a permission manually first
$resource = app(User::class);
Permission::create([
'name' => 'View ' . $resource->pluralName(),
'slug' => 'view-' . $resource::$slug,
'name' => 'View '.$resource->pluralName(),
'slug' => 'view-'.$resource::$slug,
'group' => $resource->pluralName(),
]);

// Get initial count
$initialCount = Permission::where('slug', 'view-' . $resource::$slug)->count();
$initialCount = Permission::where('slug', 'view-'.$resource::$slug)->count();
expect($initialCount)->toBe(1);

// Run the command
$this->artisan('aura:create-resource-permissions')->assertSuccessful();

// Verify no duplicates were created
$finalCount = Permission::where('slug', 'view-' . $resource::$slug)->count();
$finalCount = Permission::where('slug', 'view-'.$resource::$slug)->count();
expect($finalCount)->toBe(1);
});

test('it authenticates as user ID 1', function () {
// Create a user for authentication
$user = User::factory()->create(['id' => 1]);

// Run the command
$this->artisan('aura:create-resource-permissions')->assertSuccessful();

Expand All @@ -100,11 +100,11 @@

// Test specific permission naming
$resource = app(User::class);
$permission = Permission::where('slug', 'view-' . $resource::$slug)->first();
$permission = Permission::where('slug', 'view-'.$resource::$slug)->first();

expect($permission)
->name->toBe('View ' . $resource->pluralName())
->slug->toBe('view-' . $resource::$slug)
->name->toBe('View '.$resource->pluralName())
->slug->toBe('view-'.$resource::$slug)
->group->toBe($resource->pluralName());
});

Expand Down
7 changes: 5 additions & 2 deletions tests/Feature/Aura/DatabaseToResourcesCommandTest.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
<?php

use Illuminate\Support\Facades\Schema;
use Aura\Base\Commands\DatabaseToResources;
use Illuminate\Support\Facades\Artisan;
use Illuminate\Support\Facades\Schema;

beforeEach(function () {
// Set up default column mocks that all tests will need
Expand Down Expand Up @@ -34,6 +33,7 @@

Artisan::command('aura:transform-table-to-resource {table}', function ($table) use (&$commandLog) {
$commandLog[] = $table;

return 0;
});

Expand All @@ -54,6 +54,7 @@

Artisan::command('aura:transform-table-to-resource {table}', function ($table) use (&$commandLog) {
$commandLog[] = $table;

return 0;
});

Expand Down Expand Up @@ -87,6 +88,7 @@

Artisan::command('aura:transform-table-to-resource {table}', function ($table) use (&$commandLog) {
$commandLog[] = $table;

return 0;
});

Expand All @@ -106,6 +108,7 @@

Artisan::command('aura:transform-table-to-resource {table}', function ($table) use (&$processedTables) {
$processedTables[] = $table;

return 0;
});

Expand Down

0 comments on commit c401265

Please sign in to comment.