Problem/Motivation

Image effect help text showing when an effect is edited currently has no test coverage.

Proposed resolution

Add test coverage

Remaining tasks

Contributor tasks needed
Task Novice task? Contributor instructions Complete?
Create a patch Novice Instructions X
Add automated tests Novice Instructions X
Manually test the patch Novice Instructions X
Review patch to ensure that it fixes the issue, stays within scope, is properly documented, and follows coding standards Instructions X
Commit to Drupal 8   X
Commit to Drupal 7   X
Port automated tests from D7 to D8  

Original report by @rlhawk

The help text for an image effect appears when the effect is added to an image style, but not when the effect is edited.

CommentFileSizeAuthor
#88 1737714-nr-bot.txt2.37 KBneeds-review-queue-bot
#70 interdiff_66-70.txt6.54 KBvsujeetkumar
#70 1737714-70.patch7.51 KBvsujeetkumar
#66 interdiff_64-66.txt4.96 KBvsujeetkumar
#66 1737714-66.patch6.03 KBvsujeetkumar
#64 interdiff_63-64.txt636 bytesvsujeetkumar
#64 1737714-64.patch5.97 KBvsujeetkumar
#63 1737714-63.patch5.96 KBvsujeetkumar
#61 interdiff_59-61.txt600 bytesvsujeetkumar
#61 1737714-61.patch7.01 KBvsujeetkumar
#59 interdiff_57-59.txt1.6 KBvsujeetkumar
#59 1737714-59.patch7.82 KBvsujeetkumar
#57 1737714-57.patch6.69 KBvsujeetkumar
#49 Screenshot from 2020-01-31 14-40-47.png168.42 KBRithesh BK
#42 image-automated-tests-1737714-42.patch6.36 KBpk188
#40 image-automated-tests-1737714-40.patch6.64 KBpk188
#31 1737714-31.patch5.86 KBafem
#31 interdiff.txt1.84 KBafem
#28 image-automated-tests-1737714-28.patch5.86 KBzipymonkey
#23 image-automated-tests-1737714-23.patch6.01 KBgvso
#22 interdiff-21-22.txt1.99 KBgvso
#22 image-automated-tests-1737714-22.patch5.95 KBgvso
#21 1737714-21.patch5.62 KBtherealssj
#11 drupal-bug-fix-1737714-9.patch3.72 KBlegovaer
#8 drupal-bug-fix-1737714-5.patch739 byteslegovaer
#7 image-automated-tests-1737714_4.patch3.42 KBlegovaer
#2 drupal-bug-fix-8-1737714-0.patch758 bytesrlhawk
#1 drupal-bug-fix-1737714-0.patch738 bytesrlhawk

Issue fork drupal-1737714

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

rlhawk’s picture

Status: Active » Needs review
FileSize
738 bytes

The attached patch fixes the bug so that the help text for image effects displays when the effect is edited.

rlhawk’s picture

Version: 7.x-dev » 8.x-dev
FileSize
758 bytes

Here's a new patch for Drupal 8.

claudiu.cristea’s picture

Version: 8.x-dev » 7.x-dev

I manually tested and is fixed now in D8. Moving back to D7.

dcam’s picture

Issue summary: View changes
Status: Needs review » Needs work
Issue tags: +Needs tests, +Novice

We'll need to add an automated test for this. See the instructions for adding automated tests.

Also, I haven't looked into the code, but I'm guessing the other $arg[] indexes in the line changed by the patch will also need to be updated.

darol100’s picture

Issue tags: +Needs reroll
<ul>
  <li>error: patch failed: core/modules/image/image.module:64</li>
  <li>error: core/modules/image/image.module: patch does not apply</li>
</ul>

This patch is out-dated. Needs re-roll.

legovaer’s picture

I'm currently working on the automated tests for this regression.

legovaer’s picture

This patch contains the automated tests for this issue.

legovaer’s picture

FileSize
739 bytes

Here's a new patch for D7.

legovaer’s picture

Status: Needs work » Needs review

The last submitted patch, 7: image-automated-tests-1737714_4.patch, failed testing.

legovaer’s picture

Added patch that contains both the automated tests + the patch that will fix the issue.

rlhawk’s picture

Status: Needs review » Reviewed & tested by the community

I tested the patch and it fixes the issue. The tests work great.

David_Rothstein’s picture

Status: Reviewed & tested by the community » Fixed

Committed to 7.x - thanks!

Fixed a lot of small things in the tests on commit:

diff --git a/modules/image/image.test b/modules/image/image.test
index fffd7db..87d803a 100644
--- a/modules/image/image.test
+++ b/modules/image/image.test
@@ -491,8 +491,6 @@ class ImageEffectsUnitTest extends ImageToolkitTestCase {
  * Tests the administrative user interface.
  */
 class ImageAdminUiTestCase extends ImageFieldTestCase {
-
-
   public static function getInfo() {
     return array(
       'name' => 'Administrative user interface',
@@ -507,8 +505,6 @@ class ImageAdminUiTestCase extends ImageFieldTestCase {
 
   /**
    * Test if the help text is available on the add effect form.
-   *
-   * This is a regression test for https://www.drupal.org/node/1737714.
    */
   function testAddEffectHelpText() {
     // Create a random image style.
@@ -516,31 +512,29 @@ class ImageAdminUiTestCase extends ImageFieldTestCase {
 
     // Open the add effect form and check for the help text.
     $this->drupalGet($style['path'] . '/add/image_crop');
-    $this->assertText(t('Cropping will remove portions of an image to make it the specified dimensions.'), 'The Image Style effect help text was displayed on the add effect page.');
+    $this->assertText(t('Cropping will remove portions of an image to make it the specified dimensions.'), 'The image style effect help text was displayed on the add effect page.');
   }
 
   /**
    * Test if the help text is available on the edit effect form.
-   *
-   * This is a regression test for https://www.drupal.org/node/1737714.
    */
   function testEditEffectHelpText() {
     // Create a random image style.
-    $rand_style = $this->createRandomStyle();
+    $random_style = $this->createRandomStyle();
 
     // Add the crop effect to the image style.
     $edit = array();
     $edit['data[width]'] = 20;
     $edit['data[height]'] = 20;
-    $this->drupalPost($rand_style['path'] . '/add/image_crop', $edit, t('Add effect'));
+    $this->drupalPost($random_style['path'] . '/add/image_crop', $edit, t('Add effect'));
 
     // Open the edit effect form and check for the help text.
     drupal_static_reset('image_styles');
-    $style = image_style_load($rand_style['name']);
+    $style = image_style_load($random_style['name']);
 
     foreach ($style['effects'] as $ieid => $effect) {
-      $this->drupalGet($rand_style['path'] . '/effects/' . $ieid);
-      $this->assertText(t('Cropping will remove portions of an image to make it the specified dimensions.'), 'The Image Style effect help text was displayed on the edit effect page.');
+      $this->drupalGet($random_style['path'] . '/effects/' . $ieid);
+      $this->assertText(t('Cropping will remove portions of an image to make it the specified dimensions.'), 'The image style effect help text was displayed on the edit effect page.');
     }
   }
 }

  • David_Rothstein committed e344d46 on 7.x
    Issue #1737714 by legovaer, rlhawk: Help text does not display when...
darol100’s picture

@David_Rothstein,

Does this applies also to D8 ? Should we move this issue into a D8 version ?

David_Rothstein’s picture

Title: Help text does not display when editing an image effect » (followup to forward-port the tests) Help text does not display when editing an image effect
Version: 7.x-dev » 8.0.x-dev
Status: Fixed » Patch (to be ported)

Actually those tests look pretty nice and I doubt there's any tests like that in Drupal 8 now, so it would be good to forward-port them.

David_Rothstein’s picture

Does this applies also to D8 ? Should we move this issue into a D8 version ?

Oh, I guess I cross-posted :) Based on earlier comments and what I see in the admin UI, the bug itself doesn't affect Drupal 8, so just the tests would be needed.

darol100’s picture

@David_Rothstein, only the test or the entire patch ?

David_Rothstein’s picture

Just the tests... but if they fail because I'm wrong, then the entire patch :)

r.nabiullin’s picture

Issue tags: -Needs reroll
therealssj’s picture

Patch ported for 8.0.x, but seems to fail as it is not loading the help text.

The issue doesn't affect 8.0.x but the help text is not displayed when running tests.

gvso’s picture

This may help going further in the test

gvso’s picture

Just added documentation to public static $modules = array('help', 'block', 'system');

gvso’s picture

Status: Patch (to be ported) » Needs review

The last submitted patch, 21: 1737714-21.patch, failed testing.

Version: 8.0.x-dev » 8.1.x-dev

Drupal 8.0.6 was released on April 6 and is the final bugfix release for the Drupal 8.0.x series. Drupal 8.0.x will not receive any further development aside from security fixes. Drupal 8.1.0-rc1 is now available and sites should prepare to update to 8.1.0.

Bug reports should be targeted against the 8.1.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.2.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

vsawant’s picture

Version: 8.1.x-dev » 8.2.x-dev
Issue tags: +neworleans2016

The new development version is 8.2

zipymonkey’s picture

Patch could not be applied to 8.2.x branch. Rerolling the patch for 8.2.x.

dcam’s picture

Version: 8.2.x-dev » 8.1.x-dev

I think that we can apply this against 8.1.x. Check out the Allowed changes during the Drupal 8 release cycle. There's nothing specifically in that document about this case, probably because it's unusual to be forward-porting anything. It's a non-disruptive change though. We're not even fixing a bug here, much less changing an API or altering the UI. If anything, it would be helpful to include these tests in the earliest minor version possible to help ensure its stability moving forward.

#28 applies to 8.1.x so there's no reason to set the status to Needs Work.

dcam’s picture

Status: Needs review » Needs work

I did a code review of this #28 and found a few problems. A new patch needs to be rolled with the following changes.

  1. +++ b/core/modules/image/src/Tests/ImageAdminStylesTest.php
    @@ -332,10 +332,7 @@ public function testAjaxEnabledEffectForm() {
    +    list($style, $style_name, ) = $this->createRandomStyle();
    

    The final comma and space inside the list() call can be deleted.

  2. +++ b/core/modules/image/src/Tests/ImageAdminUiTest.php
    @@ -0,0 +1,67 @@
    +    // Open the edit effect form and check fImagor the help text.
    

    There's a typo in this comment.

  3. +++ b/core/modules/image/src/Tests/ImageAdminUiTest.php
    @@ -0,0 +1,67 @@
    +      $this->assertText(t('Resizing will make images an exact set of dimensions. This may cause images to be stretched or shrunk disproportionately.'), 'The image style effect help text was displayed on the add effect page.');
    

    The assert message needs to be edited, "...on the edit effect page."

Otherwise, the patch looks good and I'd RTBC it.

afem’s picture

Status: Needs work » Needs review
FileSize
1.84 KB
5.86 KB

I applied the changes from #30.

zipymonkey’s picture

Patch in #31 apply fine for me on 8.1.x branch. Looks good to me.

dcam’s picture

Status: Needs review » Reviewed & tested by the community

#31 is RTBC. The problems that I mentioned in #30 have been corrected. The tests are functionally the same as those that were committed to D7.

Good work today in NOLA @afemath and @zipymonkey!

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 31: 1737714-31.patch, failed testing.

zipymonkey’s picture

Status: Needs work » Reviewed & tested by the community

Reran the test on parch #31 since the failure was to be in core/modules/migrate_drupal_ui/src/Tests/MigrateUpgradeTestBase.php. It passed this time so I'm changing this back to RTBC.

Thanks for the help @dcam and @afemath.

alexpott’s picture

Status: Reviewed & tested by the community » Needs work
+++ b/core/modules/image/src/Tests/ImageFieldTestBase.php
@@ -126,6 +126,24 @@ function previewNodeImage($image, $field_name, $type) {
+   * @return array
+   *  A list containing the details of the generated image style.

If we're introducing a new helper to create an ImageStyle object I think we should behave like the other test entity creators and return the created entity. ie. this should just return the $style object and then the tests can call ->id(), ->label() and ->url(). Doing list() on the return looks unnecessarily magic.

The last submitted patch, 31: 1737714-31.patch, failed testing.

Version: 8.1.x-dev » 8.2.x-dev

Drupal 8.1.9 was released on September 7 and is the final bugfix release for the Drupal 8.1.x series. Drupal 8.1.x will not receive any further development aside from security fixes. Drupal 8.2.0-rc1 is now available and sites should prepare to upgrade to 8.2.0.

Bug reports should be targeted against the 8.2.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.3.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.2.x-dev » 8.3.x-dev

Drupal 8.2.6 was released on February 1, 2017 and is the final full bugfix release for the Drupal 8.2.x series. Drupal 8.2.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.3.0 on April 5, 2017. (Drupal 8.3.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.3.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.4.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

pk188’s picture

Status: Needs work » Needs review
FileSize
6.64 KB

Re rolled #28. Fixed #30.

Status: Needs review » Needs work

The last submitted patch, 40: image-automated-tests-1737714-40.patch, failed testing. View results

pk188’s picture

Status: Needs work » Needs review
FileSize
6.36 KB

Status: Needs review » Needs work

The last submitted patch, 42: image-automated-tests-1737714-42.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

Version: 8.3.x-dev » 8.4.x-dev

Drupal 8.3.6 was released on August 2, 2017 and is the final full bugfix release for the Drupal 8.3.x series. Drupal 8.3.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.4.0 on October 4, 2017. (Drupal 8.4.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.4.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.5.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.4.x-dev » 8.5.x-dev

Drupal 8.4.4 was released on January 3, 2018 and is the final full bugfix release for the Drupal 8.4.x series. Drupal 8.4.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.5.0 on March 7, 2018. (Drupal 8.5.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.5.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.6.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.5.x-dev » 8.6.x-dev

Drupal 8.5.6 was released on August 1, 2018 and is the final bugfix release for the Drupal 8.5.x series. Drupal 8.5.x will not receive any further development aside from security fixes. Sites should prepare to update to 8.6.0 on September 5, 2018. (Drupal 8.6.0-rc1 is available for testing.)

Bug reports should be targeted against the 8.6.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.7.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Rithesh BK’s picture

Assigned: Unassigned » Rithesh BK

currently i am working on it ......

Rithesh BK’s picture

currently checking the issue ......

Rithesh BK’s picture

Assigned: Rithesh BK » Unassigned
Status: Needs work » Closed (works as designed)
FileSize
168.42 KB

Image effect help text is displaying when an effect is edited for drupal version 8.6.x-dev. Hence it is fixed. Please find the attached screenshot ....

dhirendra.mishra’s picture

Status: Closed (works as designed) » Needs review

Let Creator of this issue to mark "closed status".

rlhawk’s picture

Status: Needs review » Needs work

The remaining task in this issue is to forward-port to D8 the image effect tests that were added to D7. I'll update the issue description to reflect that.

rlhawk’s picture

Issue summary: View changes

Version: 8.6.x-dev » 8.8.x-dev

Drupal 8.6.x will not receive any further development aside from security fixes. Bug reports should be targeted against the 8.8.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.9.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

narendra.rajwar27’s picture

Assigned: Unassigned » narendra.rajwar27
narendra.rajwar27’s picture

Assigned: narendra.rajwar27 » Unassigned

Version: 8.8.x-dev » 8.9.x-dev

Drupal 8.8.7 was released on June 3, 2020 and is the final full bugfix release for the Drupal 8.8.x series. Drupal 8.8.x will not receive any further development aside from security fixes. Sites should prepare to update to Drupal 8.9.0 or Drupal 9.0.0 for ongoing support.

Bug reports should be targeted against the 8.9.x-dev branch from now on, and new development or disruptive changes should be targeted against the 9.1.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

vsujeetkumar’s picture

Status: Needs work » Needs review
FileSize
6.69 KB

Re-roll patch given for 8.9.x.

Status: Needs review » Needs work

The last submitted patch, 57: 1737714-57.patch, failed testing. View results

vsujeetkumar’s picture

Status: Needs work » Needs review
FileSize
7.82 KB
1.6 KB

Fixed the tests.

Status: Needs review » Needs work

The last submitted patch, 59: 1737714-59.patch, failed testing. View results

vsujeetkumar’s picture

Status: Needs work » Needs review
FileSize
7.01 KB
600 bytes

Fixed fail test.

vsujeetkumar’s picture

Re-roll patch given for 9.3.x.

vsujeetkumar’s picture

Fixed the CSpell issue.

mondrake’s picture

Status: Needs review » Needs work
  1. --- /dev/null
    +++ b/core/modules/image/src/Tests/ImageAdminUiTest.php
    
    +++ b/core/modules/image/src/Tests/ImageAdminUiTest.php
    @@ -0,0 +1,62 @@
    
    @@ -0,0 +1,62 @@
    +<?php
    +
    +namespace Drupal\image\Tests;
    

    Oh... a Simpletest test! This is not executed any more, actually. To be converted to a Functional test.

  2. +++ b/core/modules/image/src/Tests/ImageAdminUiTest.php
    @@ -0,0 +1,62 @@
    +  public function testAddEffectHelpText() {
    

    :void return typehint

  3. +++ b/core/modules/image/src/Tests/ImageAdminUiTest.php
    @@ -0,0 +1,62 @@
    +    $this->assertText(t('Resizing will make images an exact set of dimensions. This may cause images to be stretched or shrunk disproportionately.'), 'The image style effect help text was displayed on the add effect page.');
    

    assertText() is deprecated

  4. +++ b/core/modules/image/src/Tests/ImageAdminUiTest.php
    @@ -0,0 +1,62 @@
    +  public function testEditEffectHelpText() {
    

    :void return typehint

  5. +++ b/core/modules/image/src/Tests/ImageAdminUiTest.php
    @@ -0,0 +1,62 @@
    +    $this->drupalPostForm($style_path . '/add/image_resize', $edit, t('Add effect'));
    

    drupalPostForm() is deprecated

  6. +++ b/core/modules/image/src/Tests/ImageAdminUiTest.php
    @@ -0,0 +1,62 @@
    +      $this->assertText(t('Resizing will make images an exact set of dimensions. This may cause images to be stretched or shrunk disproportionately.'), 'The image style effect help text was displayed on the add effect page.');
    

    assertText() is deprecated

  7. +++ b/core/modules/image/tests/src/Functional/ImageFieldTestBase.php
    @@ -89,6 +89,25 @@ public function previewNodeImage($image, $field_name, $type) {
    +  public function createRandomStyle() {
    

    Needs a return typehint

  8. +++ b/core/modules/image/tests/src/Functional/ImageFieldTestBase.php
    @@ -89,6 +89,25 @@ public function previewNodeImage($image, $field_name, $type) {
    +    return [
    +      $style,
    +      $style_name,
    +      'admin/config/media/image-styles/manage/' . $style_name,
    +    ];
    +  }
    

    Do we really need to return an array? Maybe this would do in D7, but now we should be able to retrieve the style's name and Url from the object itself?

vsujeetkumar’s picture

Status: Needs work » Needs review
FileSize
6.03 KB
4.96 KB

Worked on #65:
#65.1: Converted to functional test.
#65.2: :void typehint added.
#65.3: Fixed.
#65.4: :void typehint added.
#65.5: Fixed.
#65.6: Fixed.
#65.7: :array typehint added.
#65.8: Pending.

mondrake’s picture

Priority: Minor » Normal
Status: Needs review » Needs work
  1. +++ b/core/modules/image/tests/src/Functional/ImageAdminUiTest.php
    @@ -0,0 +1,68 @@
    +    $this->assertSession()->pageTextContains(t('Resizing will make images an exact set of dimensions. This may cause images to be stretched or shrunk disproportionately.'));
    ...
    +      $this->assertSession()->pageTextContains(t('Resizing will make images an exact set of dimensions. This may cause images to be stretched or shrunk disproportionately.'));
    

    There's no need to wrap the string in t() here, we are not testing translations.

  2. +++ b/core/modules/image/tests/src/Functional/ImageFieldTestBase.php
    @@ -89,6 +89,25 @@ public function previewNodeImage($image, $field_name, $type) {
    +    return [
    +      $style,
    +      $style_name,
    +      'admin/config/media/image-styles/manage/' . $style_name,
    +    ];
    

    just return $style. Then in calling code, the style name would be $style->getName(), and the path $style->toUrl() or even $style->toUrl()->toString().

dhirendra.mishra’s picture

Assigned: Unassigned » dhirendra.mishra

Let me work on this

mondrake’s picture

Issue tags: -Needs tests

This is test only code, so removing irrelevant tag

vsujeetkumar’s picture

Status: Needs work » Needs review
FileSize
7.51 KB
6.54 KB

Worked on #67, Please have a look.

Version: 9.3.x-dev » 9.4.x-dev

Drupal 9.3.0-rc1 was released on November 26, 2021, which means new developments and disruptive changes should now be targeted for the 9.4.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.4.x-dev » 9.5.x-dev

Drupal 9.4.0-alpha1 was released on May 6, 2022, which means new developments and disruptive changes should now be targeted for the 9.5.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.5.x-dev » 10.1.x-dev

Drupal 9.5.0-beta2 and Drupal 10.0.0-beta2 were released on September 29, 2022, which means new developments and disruptive changes should now be targeted for the 10.1.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Lendude’s picture

Title: (followup to forward-port the tests) Help text does not display when editing an image effect » Add test coverage for Help text displaying when editing an image effect
Issue summary: View changes
Status: Needs review » Needs work

Updated the title a bit, to be more in line with the patch.

  1. +++ b/core/modules/image/tests/src/Functional/ImageAdminUiTest.php
    @@ -0,0 +1,68 @@
    +  protected $defaultTheme = 'classy';
    

    This should now be 'stark' I guess

  2. +++ b/core/modules/image/tests/src/Functional/ImageAdminUiTest.php
    @@ -0,0 +1,68 @@
    +    // Open the edit effect form and check image style effect help text.
    +    $style = ImageStyle::load($style->getName());
    +    $effects = $style->get('effects');
    +    foreach ($effects as $ieid => $effect) {
    +      $this->drupalGet($style->toUrl()->toString() . '/effects/' . $ieid);
    ...
    +      $this->assertSession()->pageTextContains('Resizing will make images an exact set of dimensions. This may cause images to be stretched or shrunk disproportionately.');
    

    We should check that $effects isn't empty (or size 1, since we added one effect earlier), because if it is empty, this will still pass

rpayanm made their first commit to this issue’s fork.

rpayanm’s picture

Title: Add test coverage for Help text displaying when editing an image effect » 1737714-10.1.x
Status: Needs work » Needs review

Please review.

rpayanm’s picture

Title: 1737714-10.1.x » Add test coverage for Help text displaying when editing an image effect

smustgrave made their first commit to this issue’s fork.

smustgrave’s picture

Status: Needs review » Reviewed & tested by the community
Issue tags: +Needs Review Queue Initiative

Reviewing MR 3270

Removing credit for myself as I just rebased to make sure the tests passed.

The changes requested in #74 have been addressed
All new functions have a return typehint.

xjm’s picture

Status: Reviewed & tested by the community » Needs work

Thanks for working on this issue! A few points:

  1. +++ b/core/modules/image/tests/src/Functional/ImageAdminStylesTest.php
    @@ -316,10 +316,7 @@ public function testStyle() {
    -    $style_name = strtolower($this->randomMachineName(10));
    -    $style_label = $this->randomString();
    -    $style = ImageStyle::create(['name' => $style_name, 'label' => $style_label]);
    -    $style->save();
    +    $style = $this->createRandomStyle();
         $style_path = 'admin/config/media/image-styles/manage/';
    
    +++ b/core/modules/image/tests/src/Functional/ImageFieldTestBase.php
    @@ -89,6 +89,21 @@ public function previewNodeImage($image, $field_name, $type) {
    +  public function createRandomStyle(): object {
    +    $style_name = strtolower($this->randomMachineName());
    +    $style_label = $this->randomString();
    +    $values = ['name' => $style_name, 'label' => $style_label];
    +    $style = \Drupal::entityTypeManager()->getStorage('image_style')->create($values);
    +    $style->save();
    +    return $style;
    

    In general, Drupal has moved away from creating random fixture data, since it can cause all sorts of random failures and obscure what is actually being tested. We're better off having a fixed value (or data provider of values covering edgecases). I can see the value of having a helper method to save a new image style, but I think it should probably take the style name and label as parameters rather than being random.

    Also, we should almost never typehint a generic object. Surely there's an interface for image styles?

  2. +++ b/core/modules/image/tests/src/Functional/ImageAdminUiTest.php
    @@ -0,0 +1,68 @@
    + * Tests the administrative user interface.
    

    That would be a really big test...

    I think this is supposed to be "Tests the image style administration UI" or something along those lines.

  3. +++ b/core/modules/image/tests/src/Functional/ImageAdminUiTest.php
    @@ -0,0 +1,68 @@
    +   * Test if the help text is available on the edit effect form.
    ...
    +   * Test if the help text is available on the edit effect form.
    

    Nit: "Tests that..."

    Also, are these two docblocks supposed to be identical? Seems like they should be different.

  4. +++ b/core/modules/image/tests/src/Functional/ImageAdminUiTest.php
    @@ -0,0 +1,68 @@
    +    $this->submitForm($edit, t('Add effect'));
    

    I don't think we need the use of t() here.

xjm’s picture

I just realized this issue has both patches and an MR, so I was reviewing the wrong thing. Most of my feedback still applies, though.

Hiding the patches, but please apply the above feedback to the MR. Thanks!

rpayanm’s picture

Status: Needs work » Needs review

I made the xjm's suggestions, please review.

smustgrave’s picture

Status: Needs review » Reviewed & tested by the community

Points from #81 have been addressed.

quietone’s picture

Status: Reviewed & tested by the community » Needs work

See the comments in the MR.

quietone’s picture

Assigned: dhirendra.mishra » Unassigned

It has been two years since @dhirendra.mishra worked on this, so un-asssinging.

rpayanm’s picture

Status: Needs work » Needs review

I made the @quietone's suggestions.

needs-review-queue-bot’s picture

Status: Needs review » Needs work
FileSize
2.37 KB

The Needs Review Queue Bot tested this issue. It fails the Drupal core commit checks. Therefore, this issue status is now "Needs work".

Apart from a re-roll or rebase, this issue may need more work to address feedback in the issue or MR comments. To progress an issue, incorporate this feedback as part of the process of updating the issue. This helps other contributors to know what is outstanding.

Consult the Drupal Contributor Guide to find step-by-step guides for working with issues.

sourabhjain made their first commit to this issue’s fork.

sourabhjain’s picture

Status: Needs work » Needs review
smustgrave’s picture

Status: Needs review » Needs work

Still appears to have one open thread.

rpayanm’s picture

Status: Needs work » Needs review
smustgrave’s picture

Status: Needs review » Needs work

Seems MR has some kind of failure.

royalpinto007 made their first commit to this issue’s fork.

royalpinto007’s picture

Status: Needs work » Needs review
royalpinto007’s picture

Status: Needs review » Needs work

sahil.goyal made their first commit to this issue’s fork.

sahil.goyal’s picture

Status: Needs work » Needs review

Moving to Needs Review.

smustgrave’s picture

Status: Needs review » Needs work

I think this could probably be a kernel test no? Does it need a full bootstrap for testing a message? If it remains a functional still don't think it needs to be it's own.

acbramley made their first commit to this issue’s fork.

acbramley’s picture

Made some minor updates and left a few comments. I think this is fine as a functional test as the issue is about help text appearing on specific routes.

Keeping as NW because I feel like there are some changes that are out of scope here.

Version: 10.1.x-dev » 11.x-dev

Drupal core is moving towards using a “main” branch. As an interim step, a new 11.x branch has been opened, as Drupal.org infrastructure cannot currently fully support a branch named main. New developments and disruptive changes should now be targeted for the 11.x branch, which currently accepts only minor-version allowed changes. For more information, see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.