Skip to content

Commit

Permalink
fix: Add test
Browse files Browse the repository at this point in the history
  • Loading branch information
gchtr committed Aug 27, 2024
1 parent fa59ded commit d8e471b
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions tests/test-svg.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,25 @@ public function test_get_timber_image_full_with_svg() {
$this->assertEquals( $image, $result );
}

/**
* Tests whether we still get the image src without an error, even if the
* SVG file is missing.
*
* @since 2.1.0
*/
public function test_get_timber_image_full_with_svg_inexistent() {
$attachment = $this->create_image( [ 'file' => 'sveegee.svg' ] );

if (file_exists($attachment->file_loc())) {
unlink($attachment->file_loc());
}

$result = get_timber_image( $attachment, 'full' );
$image = ' src="' . $this->get_upload_url() . '/sveegee.svg" alt=""';

$this->assertEquals( $image, $result );
}

/**
* Tests whether we get the full src of an SVG with size large.
*
Expand Down

0 comments on commit d8e471b

Please sign in to comment.