Skip to content

Commit

Permalink
Test property Image::uploaded (#24)
Browse files Browse the repository at this point in the history
* Test property Image::uploaded

* Add nullable property

---------

Co-authored-by: Stephane MEAUDRE <smeaudre@kaliop.com>
  • Loading branch information
Astro-Otter-Space and Stephane MEAUDRE authored Oct 2, 2023
1 parent 7057fe2 commit 94f5c2b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/Response/DTO/Item/Image.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ final class Image extends AbstractResponse implements AstrobinResponse
public ?string $title = null;
public ?array $subjects;
public ?string $description = null;
public ?string $uploaded = null;
public string|null $uploaded = null;
public ?string $url_gallery = null;
public ?string $url_thumb = null;
public ?string $url_regular = null;
Expand Down
7 changes: 6 additions & 1 deletion tests/Services/GetImageTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,12 @@ public function testGetById(): void
$this->assertNotEmpty($response->url_thumb);
$this->assertIsInt($response->views);
$this->assertIsInt($response->likes);
$this->assertInstanceOf(\DateTime::class, $response->getUploaded());
if (is_null($response->uploaded)) {
$this->assertNull($response->getUploaded());
} else {
$this->assertInstanceOf(\DateTime::class, $response->getUploaded());
}

}

/**
Expand Down

0 comments on commit 94f5c2b

Please sign in to comment.