Skip to content

Commit

Permalink
fixed flags in the URL
Browse files Browse the repository at this point in the history
  • Loading branch information
pushrbx committed May 31, 2024
1 parent 473b22f commit 24ce30c
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
2 changes: 1 addition & 1 deletion app/Dto/Concerns/PreparesData.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public static function prepareForPipeline(Collection $properties): Collection
}
}
// if the property is optional and the value is an empty string, we want to ignore it.
if ($property->type->isOptional && $propertyVal === "") {
if ($property->type->isOptional && $propertyVal === "" && !$property->type->acceptsType("bool")) {
$propertyVal = null;
}

Expand Down
16 changes: 14 additions & 2 deletions tests/Integration/SeasonControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,14 @@ class SeasonControllerTest extends TestCase
use SyntheticMongoDbTransaction;
use ScoutFlush;

private function continuingUrlProvider(): array
{
return [
"?continuing=true" => ["/v4/seasons/2024/winter?continuing=true"],
"?continuing" => ["/v4/seasons/2024/winter?continuing"],
];
}

public function testShouldFilterOutAnimeWithGarbledAiredString()
{
Carbon::setTestNow(Carbon::parse("2024-01-11"));
Expand Down Expand Up @@ -95,7 +103,11 @@ public function testShouldNotFilterOutFutureAiringDates()
$this->assertCount(2, $content["data"]);
}

public function testShouldNotFilterOutContinuingItemsFromPreviousSeasons()
/**
* @return void
* @dataProvider continuingUrlProvider
*/
public function testShouldNotFilterOutContinuingItemsFromPreviousSeasons($requestUrl)
{
Carbon::setTestNow(Carbon::parse("2024-01-11"));
// an item in the future airing
Expand Down Expand Up @@ -131,7 +143,7 @@ public function testShouldNotFilterOutContinuingItemsFromPreviousSeasons()
$state["airing"] = true;
$f->create($state);

$content = $this->getJsonResponse([], "/v4/seasons/2024/winter?continuing=true");
$content = $this->getJsonResponse([], $requestUrl);
$this->seeStatusCode(200);
$this->assertIsArray($content["data"]);
$this->assertCount(3, $content["data"]);
Expand Down

0 comments on commit 24ce30c

Please sign in to comment.