Support from Acquia helps fund testing for Drupal Acquia logo

Comments

ParisLiakos’s picture

Status: Active » Needs review
FileSize
1.33 KB
daffie’s picture

Status: Needs review » Needs work
Issue tags: +Needs reroll

This still needs to happen, But it needs a reroll.

rpayanm’s picture

Status: Needs work » Needs review
Issue tags: -Needs reroll +Novice
FileSize
9.25 KB
tibbsa’s picture

Shouldn't the file-level comment be 'Contains \Drupal\Tests\Component\Uility\ImageTest' rather than '...\Image\ImageTest'?

rpayanm’s picture

FileSize
474 bytes
9.26 KB

@tibbsa yeah! you are right, thank you!

daffie’s picture

Status: Needs review » Needs work
+++ b/core/tests/Drupal/Tests/Component/Utility/ImageTest.php
@@ -0,0 +1,164 @@
-/**
- * @coversDefaultClass \Drupal\Component\Utility\Image
- * @group Image
- */
- class ImageTest extends UnitTestCase {
+/**
+ * Tests \Drupal\Component\Utility\Image.
+ *
+ * @group Utility
+ *
+ * @coversDefaultClass \Drupal\Component\Utility\Image
+ */
+class ImageTest extends UnitTestCase {
+++ b/core/tests/Drupal/Tests/Component/Utility/ImageTest.php
@@ -0,0 +1,164 @@
-  /**
-   * Tests all control flow branches in image_dimensions_scale().
-   *
-   * @dataProvider providerTestScaleDimensions
-   */
-  public function testScaleDimensions($input, $output) {
+  /**
+   * Tests all control flow branches in image_dimensions_scale().
+   *
+   * @param array $input
+   *   Array which contains input for Image::scaleDimensions().
+   * @param array $ouput
+   *   Array which contains expected output after passing
+   *   through Image::scaleDimensions. Also contains a boolean
+   *   'return_value' which should match the expected return value.
+   *
+   * @dataProvider providerTestScaleDimensions
+   *
+   * @covers ::scaleDimensions
+   */
+  public function testScaleDimensions($input, $output) {
+++ b/core/tests/Drupal/Tests/Component/Utility/ImageTest.php
@@ -0,0 +1,164 @@
-  /**
-   * Provides data for image dimension scale tests.
-   *
-   * @return array
-   *   Keyed array containing:
-   * - 'input' - Array which contains input for
-   *   Image::scaleDimensions().
-   * - 'output' - Array which contains expected output after passing
-   *   through Image::scaleDimensions. Also contains a boolean
-   *   'return_value' which should match the expected return value.
-   *
-   * @see testScaleDimensions()
-   */
-  public function providerTestScaleDimensions() {
+  /**
+   * Provides data for image dimension scale tests.
+   *
+   * @return array
+   *   Test data.
+   */
+  public function providerTestScaleDimensions() {

Some docblock changes to get in line with other PHPUnit tests.

daffie’s picture

Did some digging and I believe it is better to change the comments to:

  /**
   * Tests all control flow branches in image_dimensions_scale().
   *
   * @dataProvider providerTestScaleDimensions
   * @covers ::scaleDimensions
   */
  public function testScaleDimensions($input, $output) {
  /**
   * Provides data for image dimension scale tests.
   *
   * @return array
   *   - Array which contains input for Image::scaleDimensions().
   *   - Array which contains expected output after passing
   *     through Image::scaleDimensions. Also contains a boolean
   *     'return_value' which should match the expected return value.
   */
  public function providerTestScaleDimensions() {
rpayanm’s picture

Assigned: Unassigned » rpayanm
rpayanm’s picture

Assigned: rpayanm » Unassigned
Status: Needs work » Needs review
FileSize
1.71 KB
15.22 KB
daffie’s picture

Status: Needs review » Needs work

@rpayanm: I think something went wrong with your patch. There is all sort of stuff that does not belong in this patch.

rpayanm’s picture

Status: Needs work » Needs review
FileSize
9.25 KB

Sorry, I forgot git rebase 8.0.x after of git pull.

daffie’s picture

Status: Needs review » Reviewed & tested by the community

The ImageTest has been moved and renamed.
The old test file has been deleted.
The comments are all in order.
It looks good to me so I give it a RTBC.

tstoeckler’s picture

Not downgrading but in these cases it really helps to roll patches with -C -M in order to allow for easier reviewing.

rpayanm’s picture

@tstoeckler you can explain more about this? it's good learn every something new!

alexpott’s picture

Status: Reviewed & tested by the community » Needs work

This does more than just move.

diff --git a/core/tests/Drupal/Tests/Component/Image/ImageUtilityTest.php b/core/tests/Drupal/Tests/Component/Utility/ImageTest.php
similarity index 86%
rename from core/tests/Drupal/Tests/Component/Image/ImageUtilityTest.php
rename to core/tests/Drupal/Tests/Component/Utility/ImageTest.php
index 3c51ca9..63f20a6 100644
--- a/core/tests/Drupal/Tests/Component/Image/ImageUtilityTest.php
+++ b/core/tests/Drupal/Tests/Component/Utility/ImageTest.php
@@ -2,26 +2,30 @@
 
 /**
  * @file
- * Contains \Drupal\Tests\Component\Image\ImageUtilityTest.
+ * Contains \Drupal\Tests\Component\Utility\ImageTest.
  */
 
-namespace Drupal\Tests\Component\Image;
+namespace Drupal\Tests\Component\Utility;
 
 use Drupal\Component\Utility\Image;
 use Drupal\Tests\UnitTestCase;
 
 /**
+ * Tests \Drupal\Component\Utility\Image.
+ *
+ * @group Utility
+ *
  * @coversDefaultClass \Drupal\Component\Utility\Image
- * @group Image
  */
-class ImageUtilityTest extends UnitTestCase {
+class ImageTest extends UnitTestCase {
 
   /**
    * Tests all control flow branches in image_dimensions_scale().
    *
    * @dataProvider providerTestScaleDimensions
+   * @covers ::scaleDimensions
    */
-  function testScaleDimensions($input, $output) {
+  public function testScaleDimensions($input, $output) {
     // Process the test dataset.
     $return_value = Image::scaleDimensions($input['dimensions'], $input['width'], $input['height'], $input['upscale']);
 
@@ -39,14 +43,10 @@ function testScaleDimensions($input, $output) {
    * Provides data for image dimension scale tests.
    *
    * @return array
-   *   Keyed array containing:
-   * - 'input' - Array which contains input for
-   *   Image::scaleDimensions().
-   * - 'output' - Array which contains expected output after passing
-   *   through Image::scaleDimensions. Also contains a boolean
-   *   'return_value' which should match the expected return value.
-   *
-   * @see testScaleDimensions()
+   *   - Array which contains input for Image::scaleDimensions().
+   *   - Array which contains expected output after passing
+   *     through Image::scaleDimensions. Also contains a boolean
+   *     'return_value' which should match the expected return value.
    */
   public function providerTestScaleDimensions() {
     // Define input / output datasets to test different branch conditions.

We should have one issue to move and one issue to fix other issues.

@rpayanm read https://www.drupal.org/documentation/git/configure - specifically the bit on Optimize diffs for renamed and copied files

mitrpaka’s picture

Status: Needs work » Needs review
FileSize
1.32 KB
daffie’s picture

Status: Needs review » Reviewed & tested by the community

The ImageTest has been moved and renamed.
The old test file has been deleted.
This patch has been made with the "git mv" command.
It looks good to me so I give it a RTBC.

alexpott’s picture

Status: Reviewed & tested by the community » Fixed

Tests are not covered by the beta evaluation. Committed 2c23066 and pushed to 8.0.x. Thanks!

  • alexpott committed 2c23066 on 8.0.x
    Issue #2258335 by rpayanm, ParisLiakos, mitrpaka: Move Drupal\Tests\...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.