Skip to content

Commit

Permalink
Unit test for captions that are arrays
Browse files Browse the repository at this point in the history
  • Loading branch information
oakesjosh committed Nov 21, 2024
1 parent e74b6b4 commit 66435fa
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion tests/wpunit/Blocks/AdvancedGalleryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,23 @@ protected function setUp(): void {
$this->block = new Kadence_Blocks_Advancedgallery_Block();
}


// Make sure captions that are arrays do not throw an error.
public function test_render_gallery_images_with_array_caption()
{
$image = [
'url' => 'http://example.com/image.jpg',
'lightUrl' => 'http://example.com/image.jpg',
'caption' => [ 'should', 'not', 'fail']
];
$attributes = [
'linkTo' => 'media',
'lightbox' => 'magnific',
'lightboxCaption' => true,
];

$response = $this->block->render_gallery_images( $image, $attributes );

$this->assertIsString( $response );
$this->assertNotEmpty( $response );
}
}

0 comments on commit 66435fa

Please sign in to comment.