Skip to content

Commit

Permalink
fix tests on older laravel versions
Browse files Browse the repository at this point in the history
  • Loading branch information
olivernybroe committed Nov 11, 2024
1 parent b8599b1 commit e00a124
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 13 deletions.
21 changes: 14 additions & 7 deletions tests/Strategies/Responses/UseApiResourceTagsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace Knuckles\Scribe\Tests\Strategies\Responses;

use Illuminate\Database\Schema\Blueprint;
use Illuminate\Foundation\Application;
use Illuminate\Routing\Route;
use Illuminate\Support\Facades\Schema;
use Knuckles\Camel\Extraction\ExtractedEndpointData;
Expand Down Expand Up @@ -804,7 +805,7 @@ public function can_parse_apiresourcecollection_tags_with_collection_class_pagin
}

/** @test */
public function can_parse_apiresourcecollection_tags_with_collection_class_and_curosr_pagination()
public function can_parse_apiresourcecollection_tags_with_collection_class_and_cursor_pagination()
{
$config = new DocumentationConfig([]);

Expand Down Expand Up @@ -836,12 +837,18 @@ public function can_parse_apiresourcecollection_tags_with_collection_class_and_c
"prev" => null,
"next" => "/?cursor={$nextCursor}",
],
"meta" => [
"path" => '/',
'per_page' => 1,
'next_cursor' => $nextCursor,
'prev_cursor' => null,
],
"meta" => match (version_compare(Application::VERSION, '9.0', '>=')) {
false => [
"path" => '/',
'per_page' => "1",
],
true => [
"path" => '/',
'per_page' => 1,
'next_cursor' => $nextCursor,
'prev_cursor' => null,
]
},
]),
],
], $results);
Expand Down
19 changes: 13 additions & 6 deletions tests/Strategies/Responses/UseResponseAttributesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace Knuckles\Scribe\Tests\Strategies\Responses;

use Illuminate\Foundation\Application;
use Illuminate\Routing\Route;
use Knuckles\Camel\Extraction\ExtractedEndpointData;
use Knuckles\Scribe\Attributes\Response;
Expand Down Expand Up @@ -266,12 +267,18 @@ public function can_parse_apiresource_attributes_with_cursor_pagination()
"prev" => null,
"next" => "/?cursor={$nextCursor}",
],
"meta" => [
"path" => '/',
"per_page" => 1,
'next_cursor' => $nextCursor,
'prev_cursor' => null,
],
"meta" => match (version_compare(Application::VERSION, '9.0', '>=')) {
false => [
"path" => '/',
'per_page' => "1",
],
true => [
"path" => '/',
'per_page' => 1,
'next_cursor' => $nextCursor,
'prev_cursor' => null,
]
},
]),
],
], $results);
Expand Down

0 comments on commit e00a124

Please sign in to comment.