Skip to content

Commit

Permalink
Update dependencies and run pint
Browse files Browse the repository at this point in the history
  • Loading branch information
3m1n3nc3 committed Aug 28, 2024
1 parent 6a9de97 commit 85af20e
Show file tree
Hide file tree
Showing 14 changed files with 21 additions and 25 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"illuminate/contracts": "^11.0",
"illuminate/routing": "*",
"laravel/pint": "^1.15",
"orchestra/testbench": "^8.2",
"orchestra/testbench": "^9.4",
"pestphp/pest": "^2.34",
"pestphp/pest-plugin-laravel": "^2.4"
},
Expand Down
2 changes: 1 addition & 1 deletion config/config.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,5 +59,5 @@
'last' => 'last',
'prev' => 'prev',
'next' => 'next',
]
],
];
6 changes: 3 additions & 3 deletions src/Commands/ResourceMakeCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ protected function resolveStubPath($stub)
{
return file_exists($customPath = $this->laravel->basePath(trim($stub, '/')))
? $customPath
: __DIR__ . $stub;
: __DIR__.$stub;
}

/**
Expand All @@ -88,7 +88,7 @@ protected function resolveStubPath($stub)
*/
protected function getDefaultNamespace($rootNamespace)
{
return $rootNamespace . '\Http\Resources';
return $rootNamespace.'\Http\Resources';
}

/**
Expand All @@ -103,4 +103,4 @@ protected function getOptions()
['collection', 'c', InputOption::VALUE_NONE, 'Create a resource collection'],
];
}
}
}
5 changes: 2 additions & 3 deletions src/ResourceModifierServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,9 @@ public function boot()
{
if ($this->app->runningInConsole()) {
$this->publishes([
__DIR__ . '/../config/config.php' => config_path('resource-modifier.php'),
__DIR__.'/../config/config.php' => config_path('resource-modifier.php'),
], 'resource-modifier');


$this->commands([
ResourceMakeCommand::class,
]);
Expand All @@ -34,6 +33,6 @@ public function boot()
public function register()
{
// Automatically apply the package configuration
$this->mergeConfigFrom(__DIR__ . '/../config/config.php', 'resource-modifier');
$this->mergeConfigFrom(__DIR__.'/../config/config.php', 'resource-modifier');
}
}
3 changes: 1 addition & 2 deletions src/Services/Json/ResourceCollection.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

namespace ToneflixCode\ResourceModifier\Services\Json;

use ToneflixCode\ResourceModifier\Services\Json\PaginatedResourceResponse;
use Illuminate\Http\Resources\Json\ResourceCollection as JsonResourceCollection;

class ResourceCollection extends JsonResourceCollection
Expand All @@ -23,4 +22,4 @@ protected function preparePaginatedResponse($request)

return (new PaginatedResourceResponse($this))->toResponse($request);
}
}
}
4 changes: 2 additions & 2 deletions tests/Feature/CollectionsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
'last_page' => 'lastPage',
'current_page' => 'currentPage',
],
'resource-modifier.paginated_response_links' => []
'resource-modifier.paginated_response_links' => [],
]);

User::factory(10)->create();
Expand All @@ -59,7 +59,7 @@
'prev' => 'previousItem',
'next' => 'nextItem',
],
'resource-modifier.paginated_response_meta' => []
'resource-modifier.paginated_response_meta' => [],
]);

User::factory(10)->create();
Expand Down
2 changes: 1 addition & 1 deletion tests/Feature/ProviderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
test('can publish config', function () {
$this->artisan('vendor:publish --tag="resource-modifier"')
->assertExitCode(0);
});
});
5 changes: 2 additions & 3 deletions tests/Feature/ResourceMakeCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,19 @@

test('can assure that modified resource collection is valid', function () {

$outputPath = realpath(__DIR__ . '/../../vendor/orchestra/testbench-core/laravel/app/Http/Resources/XyzCollection.php');
$outputPath = realpath(__DIR__.'/../../vendor/orchestra/testbench-core/laravel/app/Http/Resources/XyzCollection.php');
if ($outputPath) {
unlink($outputPath);
}
$this->artisan('mod:resource XyzCollection')->assertExitCode(0);

User::factory(10)->create();


$content = '';

if ($outputPath) {
$content = str(File::get($outputPath));
}

expect($content->contains(ResourceCollection::class))->toBeTrue();
});
});
2 changes: 1 addition & 1 deletion tests/Models/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,4 @@ class User extends Authenticatable
'password',
'remember_token',
];
}
}
2 changes: 1 addition & 1 deletion tests/Pest.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,6 @@
function loadEnv()
{
// Load the .env file
$dotenv = \Dotenv\Dotenv::createImmutable(__DIR__ . '/..');
$dotenv = \Dotenv\Dotenv::createImmutable(__DIR__.'/..');
$dotenv->safeLoad();
}
6 changes: 3 additions & 3 deletions tests/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ protected function setUp(): void
parent::setUp();

Factory::guessFactoryNamesUsing(
fn(string $modelName) => 'ToneflixCode\\ResourceModifier\\Tests\\Database\\Factories\\' .
fn (string $modelName) => 'ToneflixCode\\ResourceModifier\\Tests\\Database\\Factories\\'.
class_basename(
$modelName
) . 'Factory'
).'Factory'
);
}

Expand All @@ -38,7 +38,7 @@ protected function defineEnvironment($app)

protected function defineDatabaseMigrations()
{
$this->loadMigrationsFrom(__DIR__ . '/database/migrations');
$this->loadMigrationsFrom(__DIR__.'/database/migrations');
}

protected function getPackageProviders($app)
Expand Down
3 changes: 1 addition & 2 deletions tests/app/Http/Resources/UserCollection.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@

class UserCollection extends ResourceCollection
{

/**
* Transform the resource collection into an array.
*
Expand All @@ -17,4 +16,4 @@ public function toArray(Request $request): array
{
return parent::toArray($request);
}
}
}
2 changes: 1 addition & 1 deletion tests/app/Http/Resources/UserResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ public function toArray(Request $request): array
'email' => $this->email,
];
}
}
}
2 changes: 1 addition & 1 deletion tests/database/migrations/create_users_tables.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class() extends Migration
return new class extends Migration
{
public function up(): void
{
Expand Down

0 comments on commit 85af20e

Please sign in to comment.