From 8cab5cf4af501252f6b510af7257f605de550c84 Mon Sep 17 00:00:00 2001 From: Christoph Herr Date: Tue, 17 Jul 2018 14:05:45 -0400 Subject: [PATCH 1/5] Fixed regression in image fields, adjusted and added tests. --- lib/api/fields/types/views/image.php | 2 +- .../api/fields/types/beansFieldImage.php | 88 ++++++++++++++++- .../unit/api/fields/types/beansFieldImage.php | 98 +++++++++++++++++-- 3 files changed, 174 insertions(+), 14 deletions(-) diff --git a/lib/api/fields/types/views/image.php b/lib/api/fields/types/views/image.php index af66576e..a1c54d16 100644 --- a/lib/api/fields/types/views/image.php +++ b/lib/api/fields/types/views/image.php @@ -12,7 +12,7 @@ // phpcs:disable Generic.WhiteSpace.ScopeIndent.Incorrect, Generic.WhiteSpace.ScopeIndent.IncorrectExact -- View file is indented for HTML structure. ?> - +
post->create(); $image_id = self::factory()->attachment->create_object( 'image.png', $post_id, [ 'post_mime_type' => 'image/jpeg', @@ -84,9 +84,9 @@ public function test_should_render_single_image_field() { } /** - * Test beans_field_image() should render multiple images field. + * Test beans_field_image() should render multiple images field and show the upload button when images exist. */ - public function test_should_render_multiple_images_field() { + public function test_should_render_multiple_images_field_and_show_upload_button_when_images_exist() { $images = []; $post_id = self::factory()->post->create(); $images[] = self::factory()->attachment->create_object( 'image-1.png', $post_id, [ @@ -114,7 +114,7 @@ public function test_should_render_multiple_images_field() { $html = ob_get_clean(); $expected = <<