Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"license": "MIT",
"require": {
"php": "^8.2",
"laravel/framework": "^8.0 || ^9.0 || ^10.0 || ^11.0"
"laravel/framework": "^8.0 || ^9.0 || ^10.0 || ^11.0 || ^12.0"
},
"autoload": {
"psr-4": {
Expand All @@ -24,6 +24,6 @@
"require-dev": {
"phpunit/phpunit": "^9.6.3",
"orchestra/testbench": "^7.22.0",
"laravel/pint": "^1.17"
"laravel/pint": "^1.22.0"
}
}
2,384 changes: 642 additions & 1,742 deletions composer.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion tests/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ protected function getEnvironmentSetUp($app)
]);
}

public function setUp(): void
protected function setUp(): void
{
parent::setUp();
$this->loadMigrationsFrom([
Expand Down
18 changes: 9 additions & 9 deletions tests/Unit/JsonApiExceptionHandlerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class JsonApiExceptionHandlerTest extends TestCase

private JsonApiExceptionHandler $handler;

public function setup(): void
protected function setup(): void
{
parent::setUp();
$this->container = Container::getInstance();
Expand All @@ -35,7 +35,7 @@ private function makeJsonRequest()
return Request::create('/', server: ['HTTP_ACCEPT' => 'application/json']);
}

public function testJsonApiHttpException()
public function test_json_api_http_exception()
{
$request = $this->makeJsonRequest();
$exception = new JsonApiHttpException(
Expand All @@ -53,7 +53,7 @@ public function testJsonApiHttpException()
$this->assertEquals('message', $errorContent->detail);
}

public function testJsonApiHttpExceptionImplementationWithDefaults()
public function test_json_api_http_exception_implementation_with_defaults()
{
$request = $this->makeJsonRequest();
$exception = new PaymentRequiredJsonApiException;
Expand All @@ -67,7 +67,7 @@ public function testJsonApiHttpExceptionImplementationWithDefaults()
$this->assertEquals('Payment required', $errorContent->title);
}

public function testJsonApiHttpExceptionImplementationWithTranslations()
public function test_json_api_http_exception_implementation_with_translations()
{
App::setLocale('nl');
$request = $this->makeJsonRequest();
Expand All @@ -85,7 +85,7 @@ public function testJsonApiHttpExceptionImplementationWithTranslations()
);
}

public function testModelNotFoundException()
public function test_model_not_found_exception()
{
$request = $this->makeJsonRequest();
$exception = (new ModelNotFoundException)->setModel('TestModel');
Expand All @@ -99,7 +99,7 @@ public function testModelNotFoundException()
$this->assertEquals('TestModel not found', $errorContent->title);
}

public function testGenericExceptionResultsInInternalServerError()
public function test_generic_exception_results_in_internal_server_error()
{
$request = $this->makeJsonRequest();
$exception = new \Exception('An error message');
Expand All @@ -113,7 +113,7 @@ public function testGenericExceptionResultsInInternalServerError()
$this->assertEquals('An error message', $errorContent->detail);
}

public function testValidationException()
public function test_validation_exception()
{
$request = $this->makeJsonRequest();
$fac = $this->container->make(Factory::class);
Expand All @@ -131,7 +131,7 @@ public function testValidationException()
$this->assertEquals($errorContent[0]->detail, 'isInvalidMessage');
}

public function testErrorResponseHasMetaFilledWithDebugTrue()
public function test_error_response_has_meta_filled_with_debug_true()
{
Config::set('app.debug', true);
$request = $this->makeJsonRequest();
Expand All @@ -145,7 +145,7 @@ public function testErrorResponseHasMetaFilledWithDebugTrue()
$this->assertNotNull($errorContent->meta->exception->file);
}

public function testErrorResponseHasMetaFilledWithDebugFalse()
public function test_error_response_has_meta_filled_with_debug_false()
{
Config::set('app.debug', false);
$request = $this->makeJsonRequest();
Expand Down
8 changes: 4 additions & 4 deletions tests/Unit/JsonApiResourceCollectionRegisterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

class JsonApiResourceCollectionRegisterTest extends TestCase
{
public function testBasicResourceCollectionResource()
public function test_basic_resource_collection_resource()
{
$accounts = Account::factory()->count(3)->create();

Expand All @@ -27,7 +27,7 @@ public function testBasicResourceCollectionResource()
]);
}

public function testCollectionResourceWithRelations()
public function test_collection_resource_with_relations()
{

$others = Account::factory()->count(3)->create();
Expand All @@ -47,7 +47,7 @@ public function testCollectionResourceWithRelations()
]);
}

public function testCollectionResourceEnlargeResourceDepth1()
public function test_collection_resource_enlarge_resource_depth1()
{
$someBloke = Account::factory()->create();

Expand Down Expand Up @@ -101,7 +101,7 @@ public function testCollectionResourceEnlargeResourceDepth1()
]);
}

public function testAddMetaToResources(): void
public function test_add_meta_to_resources(): void
{
$accounts = Account::factory()->count(3)->create();

Expand Down
8 changes: 4 additions & 4 deletions tests/Unit/JsonApiResourceCollectionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

class JsonApiResourceCollectionTest extends TestCase
{
public function testBasicResourceCollectionResource()
public function test_basic_resource_collection_resource()
{
$developers = Developer::factory()->count(3)->create();

Expand All @@ -25,7 +25,7 @@ public function testBasicResourceCollectionResource()
]);
}

public function testCollectionResourceWithRelations()
public function test_collection_resource_with_relations()
{
$others = Developer::factory(3)->create();
$developer = Developer::factory()
Expand All @@ -49,7 +49,7 @@ public function testCollectionResourceWithRelations()
]);
}

public function testCollectionResourceEnlargeResourceDepth1()
public function test_collection_resource_enlarge_resource_depth1()
{
$someBloke = Developer::factory()->create();

Expand Down Expand Up @@ -111,7 +111,7 @@ public function testCollectionResourceEnlargeResourceDepth1()
]);
}

public function testAddMetaToResources(): void
public function test_add_meta_to_resources(): void
{
$developers = Developer::factory(3)->create();

Expand Down
32 changes: 16 additions & 16 deletions tests/Unit/JsonApiResourceRegisterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

class JsonApiResourceRegisterTest extends TestCase
{
public function testBasicResource()
public function test_basic_resource()
{
$account = Account::factory()->create();

Expand All @@ -31,7 +31,7 @@ public function testBasicResource()
]);
}

public function testBasicResourceCollection()
public function test_basic_resource_collection()
{
$accounts = Account::factory()->count(3)->create();

Expand All @@ -43,7 +43,7 @@ public function testBasicResourceCollection()
]);
}

public function testResourceWithEmptyRelationLoaded()
public function test_resource_with_empty_relation_loaded()
{
$account = Account::factory()
->create();
Expand All @@ -58,7 +58,7 @@ public function testResourceWithEmptyRelationLoaded()
]);
}

public function testRelatedResource()
public function test_related_resource()
{
$post = Post::factory()->create();
$author = $post->author;
Expand All @@ -74,7 +74,7 @@ public function testRelatedResource()
]);
}

public function testRelatedResources()
public function test_related_resources()
{
$post = Post::factory()
->has(Comment::factory()->count(3))
Expand All @@ -92,7 +92,7 @@ public function testRelatedResources()
]);
}

public function testDuplicatedRelatedResources()
public function test_duplicated_related_resources()
{
$post = Post::factory()->create();
$author = $post->author;
Expand All @@ -116,7 +116,7 @@ public function testDuplicatedRelatedResources()
]);
}

public function testDeepRelatedResource()
public function test_deep_related_resource()
{
$account = Account::factory()->create();

Expand Down Expand Up @@ -148,7 +148,7 @@ public function testDeepRelatedResource()
]);
}

public function testTooDeepRelatedResource()
public function test_too_deep_related_resource()
{
$account = Account::factory()->create();

Expand Down Expand Up @@ -179,7 +179,7 @@ public function testTooDeepRelatedResource()
$response->assertJsonMissing(['id' => $commentAuthor->identifier]);
}

public function testResourceWithMetaData()
public function test_resource_with_meta_data()
{
$account = Account::factory()
->has(Post::factory()->count(10))
Expand All @@ -199,7 +199,7 @@ public function testResourceWithMetaData()
]);
}

public function testResourceWithLinkData()
public function test_resource_with_link_data()
{
$link = 'https://some-link-to-blog.com';
$post = Post::factory([
Expand All @@ -216,7 +216,7 @@ public function testResourceWithLinkData()
]);
}

public function testResourceSparseFieldset()
public function test_resource_sparse_fieldset()
{
$post = Post::factory()->create();

Expand All @@ -231,7 +231,7 @@ public function testResourceSparseFieldset()
$response->assertJsonMissing(['content' => $post->content]);
}

public function testResourceIncludedSparseFieldset()
public function test_resource_included_sparse_fieldset()
{
$account = Account::factory(['email' => 'bloke@example.org'])->create();

Expand All @@ -254,7 +254,7 @@ public function testResourceIncludedSparseFieldset()
]);
}

public function testResourceDoubleLoadedDoesNotOverwriteButMerge()
public function test_resource_double_loaded_does_not_overwrite_but_merge()
{
$posterAccount = Account::factory()->create(['email' => 'markie@example.org']);
$commenterAccount = Account::factory()->create(['email' => 'commenter@example.org']);
Expand Down Expand Up @@ -284,7 +284,7 @@ public function testResourceDoubleLoadedDoesNotOverwriteButMerge()
]);
}

public function testAddMetadataShowsInRepsonse()
public function test_add_metadata_shows_in_repsonse()
{
$author = Account::factory()->create();
$posts = Post::factory(10)->for($author, 'author')->create();
Expand All @@ -303,7 +303,7 @@ public function testAddMetadataShowsInRepsonse()
$response->assertJsonFragment(['experienced_author' => true]);
}

public function testAddMetadataMultipleTimesShowsAll()
public function test_add_metadata_multiple_times_shows_all()
{
Account::factory()->create();

Expand All @@ -320,7 +320,7 @@ public function testAddMetadataMultipleTimesShowsAll()
$response->assertJsonFragment(['extra_metadata' => true]);
}

public function testAddMetadataOverwritesExistingKeys()
public function test_add_metadata_overwrites_existing_keys()
{
$author = Account::factory()->create();
Post::factory(10)->for($author, 'author')->create();
Expand Down
Loading
Loading