Parent issue: #2866082: [Plan] Roadmap for Simpletest

Problem/Motivation

Our phpunit support within run-tests.sh is generally brittle and difficult to maintain, which is why we have experimented with other test runners such as paratest and Symfony's simple-phpunit.

This issue supports these goals:

  • Isolate and remove the hard dependencies between run-tests.sh and the simpletest module.
  • Refactor some parts of simpletest module into a testable class so it can be more easily maintained.
  • Facilitate architectural changes to the testing system, whatever they might be.

There is some overlap between this issue and #2905007: Allow run-tests.sh to report skipped/risky/incomplete PHPUnit-based tests, where a JUnit helper class will be introduced once it's complete.

Proposed resolution

Refactor simpletest_run_phpunit_tests() and its simpletest_phpunit_*() friends to a class which doesn't depend on simpletest module.

Also refactor the JUnit conversion to a utility class to support , so the class doesn't need a require_once('simpletest.module').

Remaining tasks

  • Add @trigger_error() to deprecated methods.
  • Remove usages from run-tests.sh.

User interface changes

API changes

Data model changes

CommentFileSizeAuthor
#116 2641632-116-interdiff.txt6.8 KBkim.pepper
#116 2641632-116.patch51.49 KBkim.pepper
#111 interdiff.txt739 bytesMile23
#111 2641632_111.patch51.27 KBMile23
#107 interdiff.txt23.28 KBMile23
#107 2641632_107.patch51.49 KBMile23
#106 interdiff.txt7.56 KBMile23
#106 2641632_106.patch35.33 KBMile23
#103 interdiff.txt11.57 KBMile23
#103 2641632_103.patch33.11 KBMile23
#101 2641632_101.patch32.38 KBMile23
#74 2641632_74.patch27.62 KBMile23
#68 interdiff.txt720 bytesMunavijayalakshmi
#68 2641632_68.patch27.48 KBMunavijayalakshmi
#67 interdiff.txt1.79 KBMile23
#67 2641632_67.patch27.5 KBMile23
#65 2641632_65.patch27.59 KBMile23
#63 2641632_63.patch27.34 KBMile23
#62 2641632_62.patch2.19 KBMile23
#56 interdiff_55.patch903 bytesMile23
#56 interdiff_50.patch913 bytesMile23
#56 2641632_56.patch27.19 KBMile23
#55 interdiff.txt976 bytesMile23
#55 2641632_55.patch27.38 KBMile23
#50 2641632_50.patch27.29 KBMile23
#44 interdiff.txt1.46 KBMile23
#44 2641632_44.patch26.99 KBMile23
#40 interdiff.txt2.15 KBMile23
#40 2641632_40.patch29.01 KBMile23
#37 interdiff.txt3.16 KBMile23
#37 2641632_37.patch28.96 KBMile23
#35 interdiff.txt2.38 KBMile23
#35 2641632_35.patch28.78 KBMile23
#32 interdiff.txt4.74 KBMile23
#32 2641632_31.patch28.98 KBMile23
#28 2641632_28.patch28.7 KBMile23
#19 2641632_19.patch27.65 KBMile23
#19 interdiff.txt1.29 KBMile23
#17 interdiff.txt6.07 KBMile23
#17 2641632_17.patch27.68 KBMile23
#14 interdiff.txt3.63 KBMile23
#14 2641632_14.patch27.75 KBMile23
#7 2641632_7.patch27.38 KBMile23
#4 interdiff.txt11.87 KBMile23
#4 2641632_4.patch27.33 KBMile23
#4 2641632_4_test_only.patch1.27 KBMile23
#2 2641632_2.patch19.83 KBMile23
#78 2641632_77.patch27.05 KBMile23
#82 2641632_82.patch27.07 KBMile23
#82 interdiff.txt767 bytesMile23
#86 2641632_86.patch27.29 KBMile23
#86 interdiff.txt4.6 KBMile23
#92 2641632_92.patch27.57 KBMile23
#92 interdiff.txt8.88 KBMile23
#94 2641632_94.patch30.61 KBMile23
#94 interdiff.txt7.21 KBMile23
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Mile23 created an issue. See original summary.

Mile23’s picture

Issue summary: View changes
Status: Active » Needs review
FileSize
19.83 KB

Not rocket science. :-)

This just moves all the code from the functions to methods on a class. Add some dependency injection and we're done.

I left all the simpletest_*() functions in place for BC.

@todo: Mark those functions as @deprecated.

@todo: Write some tests.

Status: Needs review » Needs work

The last submitted patch, 2: 2641632_2.patch, failed testing.

Mile23’s picture

Status: Needs work » Needs review
FileSize
1.27 KB
27.33 KB
11.87 KB

The failure relates to SimpletestPhpunitRunCommandTest, which I have to say is a super-awesome great test to have, but it's full of bugs, so I'm changing it here.

It looks like this:

function testSimpletestPhpUnitRunCommand() {
  include_once __DIR__ . '/../../fixtures/simpletest_phpunit_run_command_test.php';
  $app_root = __DIR__ . '/../../../../../..';
  include_once "$app_root/core/modules/simpletest/simpletest.module";
  $container = new ContainerBuilder;
  $container->set('app.root', $app_root);
  $file_system = $this->prophesize('Drupal\Core\File\FileSystemInterface');
  $file_system->realpath('public://simpletest')->willReturn(sys_get_temp_dir());
  $container->set('file_system', $file_system->reveal());
  \Drupal::setContainer($container);
  $test_id = basename(tempnam(sys_get_temp_dir(), 'xxx'));
  foreach (['pass', 'fail'] as $status) {
    putenv('SimpletestPhpunitRunCommandTestWillDie=' . $status);
    $ret = simpletest_run_phpunit_tests($test_id, ['Drupal\Tests\simpletest\Unit\SimpletestPhpunitRunCommandTestWillDie']);
    $this->assertSame($ret[0]['status'], $status);
  }
  unlink(simpletest_phpunit_xml_filepath($test_id));
}

It sets the file_system service to deal with the temp file directory, which is good.

Then it generates a temp file and uses its name as the test id, which is bad, because the test id is supposed to be an integer, and now we have an unneeded file in tmp.

It also uses the same id for two test runs, which means the files will overwrite themselves and thus we lose the benefit of expecting that two files will be generated.

I changed the test so that it uses a proper integer for the test id. I refactored the include_once rigamarole to setUp().

It now has near-identical tests of both the simpletest_*() function behavior, and also the new PhpUnitTestRunner behavior, in order to prove backward compatibility.

Minor changes to the test runner include service dependencies (so we only need the working path, and not the file_system service).

Also a pure unit test of runTests().

Mile23’s picture

Filed a separate issue for fixing the test: #2643624: Fix SimpletestPhpunitRunCommandTest

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

Drupal 8.1.0-beta1 was released on March 2, 2016, which means new developments and disruptive changes should now 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.

Mile23’s picture

Version: 8.2.x-dev » 8.1.x-dev
Issue summary: View changes
FileSize
27.38 KB

Setting to 8.1.x since this is a testing improvement.

Rerolling.

dawehner’s picture

Rather than spending time here it would be better IMHO to get rid of the simpletest <-> phpunit integration and rather provide a phpunit wrapper script which fullfills the purposes of the testbot.

Mile23’s picture

When someone tells me that it's not run-tests.sh and simpletest UI's job to run phpunit tests, then sure.

Until then: Please review. :-)

This issue is secondary to #2608532: Simpletest UI munges PHPUnit-based test output anyway.

dawehner’s picture

@Mile23
Do you understand my point aka. the time invested into rewriting those bits is less effective than getting rid of it in the first place? No question though in general, the new code is much better, especially better tested.

Mile23’s picture

Do you understand my point aka. the time invested into rewriting those bits is less effective than getting rid of it in the first place?

Yes.

However, we have it and it sucks. We need it because PHPUnit doesn't handle fatal errors very well and so the testbot can't report it, so we have to use run-tests.sh. Which, btw: #2624926: Refactor run-tests.sh for Console component.

We *could* make our own PHPUnit test runner class which might do a better job with fatals than \PHPUnit_Framework_TestSuite under run-tests.sh, in which case this issue is the first reviewable step of refactoring.

We also need to run PHPUnit tests from simpletest UI. I've only seen an issue which wants to hobble simpletest UI so you can't run PHPUnit tests, but I fixed that in #2608532: Simpletest UI munges PHPUnit-based test output so why would we break our own tools?

As I mentioned, I solved the problem in #2608532: Simpletest UI munges PHPUnit-based test output without this refactoring, but this refactoring would make it easier to solve future issues, including your concerns. So it's a nice-to-have. And I'd be into doing a bunch of the work I just outlined in this comment, but not if I have to call simpletest_phpunit_drupal_core_devs_think_you_are_wasting_your_time(). :-)

dawehner’s picture

Thanks a ton for trying to improve those things! A ton!

However, we have it and it sucks.

Well, what we actually just need is a small wrapper script for phpunit which does the handling of the fatals. https://github.com/brianium/paratest kinda provides that in some way already.

I'll review your work later, no worries.

joachim’s picture

Status: Needs review » Needs work

Just a couple of formatting nitpicks:

  1. +++ b/core/lib/Drupal/Core/Test/JUnitConverter.php
    @@ -0,0 +1,122 @@
    +/**
    + * @file
    + * Contains \Drupal\simpletest\JUnitConverter.
    + */
    

    @file docblocks are deprecated for classes.

  2. +++ b/core/tests/Drupal/Tests/Core/Test/PhpUnitTestRunnerTest.php
    @@ -0,0 +1,71 @@
    +    $log_path = 'test_log_path';
    +   ¶
    +    // Create a mock runner.
    

    Stray whitespace.

Mile23’s picture

Version: 8.1.x-dev » 8.2.x-dev
Status: Needs work » Needs review
FileSize
27.75 KB
3.63 KB

Thanks.

Bumping to 8.2.x because it improves tests and that's allowed during beta.

Needed a re-roll. Also needed some changes to reflect #2575725: Run PHPunit tests one at a time via UI to avoid exception when selecting too many which I hope I did completely.

Mile23’s picture

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

This is probably too disruptive for 8.2.x during RC/beta times. Moving to 8.3.x. The patch still applies but the deprecation messages will need to change. Re-running the tests.

dawehner’s picture

I really like separating the concerns here. It makes things much easier to follow.

  1. +++ b/core/lib/Drupal/Core/Test/JUnitConverter.php
    @@ -0,0 +1,122 @@
    + */
    +class JUnitConverter {
    

    Conceptually I'm wondering whether its better to make those methods non static, especially when you think about a converter as some actual existing thing you can initialize.

  2. +++ b/core/modules/simpletest/simpletest.module
    @@ -283,9 +274,13 @@ function simpletest_phpunit_xml_filepath($test_id) {
      */
     function simpletest_phpunit_configuration_filepath() {
    

    Do you mind open a follow up to discuss dropping this function? This is not actually used anywhere in core and is actually conceptually wrong :) We should pick of core/phpunit.xml as well

  3. +++ b/core/modules/simpletest/simpletest.module
    @@ -301,62 +296,14 @@ function simpletest_phpunit_configuration_filepath() {
    - *   The results as returned by exec().
    + *  The results as returned by exec().
    

    Let's keep the additional space :)

  4. +++ b/core/modules/simpletest/tests/src/Unit/SimpletestPhpunitRunCommandTest.php
    @@ -3,35 +3,79 @@
    +  protected $fixture_container;
    

    Nitpick: Is there a reason we use snake_case :)?

Mile23’s picture

Thanks for the review.

#16.1: The reason JUnitConverter is a collection of static methods is so it can have BC with functions like simpletest_phpunit_xml_to_rows(). We move the functions to a class so that we can autoload the class instead of doing the require_once for simpletest.module. The functions don't keep state so we don't need the converter class to keep state. I wager that in the future, if we're abandoning simpletest, we won't need a way to convert between JUnit and {simpletest} schema, so let's not try too hard. If we discover that we still need {simpletest} then we can modify JUnitConverter to our whims.

#16.2: Dead code in Simpletest. Who'da thunk? #2798273: simpletest_phpunit_configuration_filepath() is dead code. Deprecate it.

#16.3: Done.

#16.4: Fixed case of that variable. Also I realize I never set this issue as related to #2643624: Fix SimpletestPhpunitRunCommandTest

joachim’s picture

Status: Needs review » Needs work

A little nitpicking, but other than that looks good to me.

+/**
+ * @file
+ * Contains \Drupal\simpletest\JUnitConverter.
+ */

These are no longer used.

> + * Finds all test cases recursively from a test suite list.

In passing -- some of the docs here aren't very clear. But best to keep this a clean refactor and improve docs later.

  public static function create(ContainerInterface $c) {

All container-aware classes I've seen so far call it $container. For DX I think that should be kept consistent.

Mile23’s picture

Status: Needs work » Needs review
FileSize
1.29 KB
27.65 KB

Agreed about the docs. They're not as great as they could be. That example, though, makes sense if you know how JUnit works. :-)

Here are the other items in a patch.

dawehner’s picture

Status: Needs review » Reviewed & tested by the community

This makes certainly the code better to follow. While I personally think focusing on converting away from simpletest would be a better invest of time, and experiment with paratest for example, but for sure, this patch, as it is, is a nice thing!

  1. +++ b/core/lib/Drupal/Core/Test/JUnitConverter.php
    @@ -0,0 +1,117 @@
    + * This is mainly for converting PHPUnit output.
    + */
    +class JUnitConverter {
    
    +++ b/core/lib/Drupal/Core/Test/PhpUnitTestRunner.php
    @@ -0,0 +1,234 @@
    + * $results = $runner->runTests($test_id, $test_list['phpunit']);
    + * @endcode
    + */
    +class PhpUnitTestRunner {
    

    Can we mark those classes explicit as internal? IMHO they are not meant to be used outside of core, or are they?

  2. +++ b/core/modules/simpletest/simpletest.module
    @@ -178,29 +181,13 @@ function simpletest_run_tests($test_list) {
    + *   Drupal\Core\Test\PhpUnitTestRunner::runTests().
    
    @@ -273,9 +260,13 @@ function simpletest_summarize_phpunit_result($results) {
    + *   Drupal\Core\Test\PhpUnitTestRunner::xmlLogFilepath().
    
    @@ -283,9 +274,13 @@ function simpletest_phpunit_xml_filepath($test_id) {
    + *   Drupal\Core\Test\PhpUnitTestRunner::phpUnitConfigurationFilepath().
    
    @@ -302,61 +297,13 @@ function simpletest_phpunit_configuration_filepath() {
    + *   Drupal\Core\Test\PhpUnitTestRunner::runCommand().
    
    @@ -364,25 +311,13 @@ function simpletest_phpunit_run_command(array $unescaped_test_classnames, $phpun
    + *   Drupal\Core\Test\PhpUnitTestRunner::phpUnitCommand().
    
    @@ -752,18 +687,12 @@ function simpletest_mail_alter(&$message) {
    + *   Drupal\Core\Test\JUnitConverter::xmlToRows().
    
    @@ -776,34 +705,12 @@ function simpletest_phpunit_xml_to_rows($test_id, $phpunit_xml_file) {
    + *   Drupal\Core\Test\JUnitConverter::findTestCases().
    
    @@ -816,32 +723,10 @@ function simpletest_phpunit_find_testcases(\SimpleXMLElement $element, \SimpleXM
    + *   Drupal\Core\Test\JUnitConverter::testcaseToSimpletestRow().
    
    +++ b/core/modules/simpletest/tests/src/Unit/SimpletestPhpunitRunCommandTest.php
    @@ -3,35 +3,79 @@
    + * Drupal\Tests\simpletest\Unit\SimpletestPhpunitRunCommandTestWillDie which can
    
    +++ b/core/tests/Drupal/Tests/Core/Test/PhpUnitTestRunnerTest.php
    @@ -0,0 +1,66 @@
    + * @see Drupal\Tests\simpletest\Unit\SimpletestPhpunitRunCommandTest
    

    Nitpick, let's start with "\" if possible :)

joachim’s picture

> Can we mark those classes explicit as internal? IMHO they are not meant to be used outside of core, or are they?

If you mean with an @internal tag, then that's not actually yet part of our standard!

dawehner’s picture

@joachim
Well, I'm more of a fan of structuring our standards around the idea what people actually use vs. the other way round.

lib/Drupal/Component/Render/MarkupInterface.php:14: * filtering itself, then it must be marked as "@internal". For example, Views
lib/Drupal/Core/Entity/Routing/AdminHtmlRouteProvider.php:15: * @internal
lib/Drupal/Core/Entity/Routing/DefaultHtmlRouteProvider.php:30: * @internal
lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php:256:   * @internal Only to be used internally by Entity API. Expected to be
lib/Drupal/Core/Field/FieldFilteredMarkup.php:16: * @internal
lib/Drupal/Core/Render/MainContent/HtmlRenderer.php:287:   * @internal
lib/Drupal/Core/Render/MainContent/HtmlRenderer.php:324:   * @internal
lib/Drupal/Core/Render/Markup.php:15: * @internal
lib/Drupal/Core/Render/RenderCacheInterface.php:8: * @internal
lib/Drupal/Core/Render/RenderCache.php:14: * @internal
lib/Drupal/Core/Routing/UrlGeneratorInterface.php:76:   * @internal
lib/Drupal/Core/Theme/Registry.php:16: * @internal
lib/Drupal/Core/TypedData/Validation/ExecutionContext.php:120:   * @internal Called by \Drupal\Core\TypedData\Validation\ExecutionContextFactory.
lib/Drupal/Core/TypedData/Validation/RecursiveContextualValidator.php:25: * information about @internal.
lib/Drupal/Core/Utility/LinkGeneratorInterface.php:71:   * @internal
lib/Drupal/Core/Utility/LinkGeneratorInterface.php:86:   * @internal
modules/aggregator/aggregator.module:169: * @internal
modules/big_pipe/src/Render/BigPipeMarkup.php:15: * @internal
modules/content_moderation/src/Entity/ContentModerationState.php:131:   * @internal
modules/content_translation/content_translation.admin.inc:155: * @internal
modules/filter/src/Render/FilteredMarkup.php:15: * @internal
modules/migrate/src/Plugin/Discovery/ProviderFilterDecorator.php:11: * @internal
modules/migrate/src/Plugin/Discovery/StaticReflectionParser.php:10: * @internal
modules/migrate/src/Plugin/Discovery/AnnotatedClassDiscoveryAutomatedProviders.php:15: * @internal
modules/rest/src/Plugin/rest/resource/EntityResourceAccessTrait.php:9: * @internal
modules/rest/src/Plugin/rest/resource/EntityResourceValidationTrait.php:10: * @internal
modules/system/src/Form/PrepareModulesEntityUninstallForm.php:204:   * @internal
modules/views/src/Render/ViewsRenderPipelineMarkup.php:15: * @internal
tests/Drupal/KernelTests/KernelTestBase.php:243:   * @internal
tests/Drupal/KernelTests/KernelTestBase.php:444:   * @internal
themes/bartik/bartik.info.yml:1:# This theme is marked as @internal. It is intended to evolve and change over
themes/seven/seven.info.yml:1:# This theme is marked as @internal. It is intended to evolve and change over

The concept of @internal kinda exists already.

joachim’s picture

Indeed, but because it's not been set in our standards, API module doesn't support it yet...

Anyway, the boat's sailed on this, so I don't think adding more instances of this is a problem.

dawehner’s picture

@joachim
Thank you for that :)

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 19: 2641632_19.patch, failed testing.

Mile23’s picture

Mile23’s picture

Title: Refactor simpletest_run_phpunit_tests() etc. to a class » Refactor simpletest's *_phpunit_*() functions etc. to a class
Mile23’s picture

Status: Needs work » Needs review
FileSize
28.7 KB

Can we mark those classes explicit as internal? IMHO they are not meant to be used outside of core, or are they?

Well, the thing is... They should be internal to the extent that they're almost guaranteed to change however we move forward with simpletest. We only have the JUnit converter in order to move data between phpunit test logs and {simpletest} schema. Which, btw, we assume we understand here without checking. :-) If we move towards PHPUnit only, then we likely won't need this conversion.

So yah, @internal for both classes.

Rerolled for changes linked above.

Status: Needs review » Needs work

The last submitted patch, 28: 2641632_28.patch, failed testing.

dawehner’s picture

So yah, @internal for both classes.

Cool, yeah there are areas which really simply shouldn't be part of an external API, but still, of course well documented.
Do you understand the three failures?

Mile23’s picture

Status: Needs work » Needs review

Yes, I understand the fails. Who put all those unit tests in there, anyway????

What I really don't understand is why we're now doing the same thing under two conditions:

  if ($status > 1) {
    // Something broke during the execution of phpunit.
    // Return an error record of all failed classes.
    $rows[] = [
      'test_id' => $test_id,
      'test_class' => implode(",", $unescaped_test_classnames),
      'status' => 'fail',
      'message' => 'PHPunit Test failed to complete; Error: ' . implode("\n", $output),
      'message_group' => 'Other',
      'function' => implode(",", $unescaped_test_classnames),
      'line' => '0',
      'file' => $phpunit_file,
    ];
  }

  if ($status === 1) {
    $rows[] = [
      'test_id' => $test_id,
      'test_class' => implode(",", $unescaped_test_classnames),
      'status' => 'fail',
      'message' => 'PHPunit Test failed to complete; Error: ' . implode("\n", $output),
      'message_group' => 'Other',
      'function' => implode(",", $unescaped_test_classnames),
      'line' => '0',
      'file' => $phpunit_file,
    ];
  }

But that's out of scope here.

Mile23’s picture

Er, forgot the patch. :-)

dawehner’s picture

  1. +++ b/core/lib/Drupal/Core/Test/PhpUnitTestRunner.php
    @@ -0,0 +1,251 @@
    +   *   (optional) The exit status code of the PHPUnit process will be assigned to
    ...
    +    // Setup an environment variable containing the base URL, if it is available.
    

    Ubernitpick: 80 chars line, but annoying for commiters to fix it :(

  2. +++ b/core/lib/Drupal/Core/Test/PhpUnitTestRunner.php
    @@ -0,0 +1,251 @@
    +    // A $status of 0 = passed test, 1 = failed test, > 1 indicates segfault
    +    // timeout, or other type of failure.
    +    if ($status > 1) {
    +      // Something broke during the execution of phpunit.
    +      // Return an error record of all failed classes.
    +      $rows[] = [
    +        'test_id' => $test_id,
    +        'test_class' => implode(",", $unescaped_test_classnames),
    +        'status' => 'fail',
    +        'message' => 'PHPunit Test failed to complete; Error: ' . implode("\n", $output),
    +        'message_group' => 'Other',
    +        'function' => implode(",", $unescaped_test_classnames),
    +        'line' => '0',
    +        'file' => $phpunit_file,
    +      ];
    +    }
    +
    +    if ($status === 1) {
    +      $rows[] = [
    +        'test_id' => $test_id,
    +        'test_class' => implode(",", $unescaped_test_classnames),
    +        'status' => 'fail',
    +        'message' => 'PHPunit Test failed to complete; Error: ' . implode("\n", $output),
    +        'message_group' => 'Other',
    +        'function' => implode(",", $unescaped_test_classnames),
    +        'line' => '0',
    +        'file' => $phpunit_file,
    +      ];
    +    }
    

    Good observation. Well open an issue and carry on :) We solved an issue by introducing a smaller one

jhedstrom’s picture

Anything left to be done here? The cleanup/conversions look really great. +1 for RTBC here.

Mile23’s picture

Addressed #33, plus a couple more coding standards things.

Status: Needs review » Needs work

The last submitted patch, 35: 2641632_35.patch, failed testing.

Mile23’s picture

Status: Needs work » Needs review
FileSize
28.96 KB
3.16 KB

Fixed failing test.

Mile23’s picture

Issue tags: +Dublin2016
klausi’s picture

Status: Needs review » Needs work

This makes sense, the biggest problem I have with the patch is that it does not actually remove usages of the now deprecated simpletest_*() functions. I think we should do it in this issue right away, but we can also do it as follow-up.

Some random nitpicks:

  1. +++ b/core/lib/Drupal/Core/Test/PhpUnitTestRunner.php
    @@ -0,0 +1,250 @@
    +   * @param ContainerInterface $container
    

    should use the full qualified class name.

  2. +++ b/core/lib/Drupal/Core/Test/PhpUnitTestRunner.php
    @@ -0,0 +1,250 @@
    +   * @param array $unescaped_test_classnames
    +   *   An array of test class names, including full namespaces, to be passed as
    +   *   a regular expression to PHPUnit's --filter option.
    

    data type should be "string[]", right?

  3. +++ b/core/modules/simpletest/tests/src/Unit/SimpletestPhpunitRunCommandTest.php
    @@ -3,35 +3,79 @@
    +   * @var Drupal\Core\DependencyInjection\ContainerBuilder
    

    leading "\" missing

  4. +++ b/core/modules/simpletest/tests/src/Unit/SimpletestPhpunitRunCommandTest.php
    @@ -3,35 +3,79 @@
    +   * @coversNothing
    

    we don't really use this annotation and of course your test covers some code? I would remove it.

Mile23’s picture

Status: Needs work » Needs review
FileSize
29.01 KB
2.15 KB

Thanks.

Let's do replacements as a follow-up since this is the testing system: #2808693: Remove usages of deprecated simpletest_phpunit*() and xml-related functions, turn PhpUnitTestRunner into a service

#39.4: The thing is... If you say @covers ::simpletest_run_phpunit_tests, the standards listener spits back that simpletest_run_phpunit_tests() doesn't exist, because of some class loading weirdness. Improving the @covers for testSimpletestPhpUnitRunCommand(), removing @coversNothing for testSimpletestPhpUnitRunCommandBackwardsCompatibility().

Addressed other points as well.

klausi’s picture

Status: Needs review » Reviewed & tested by the community

ok, that works for me.

The number of assertions above matches what the branch results in 8.3.x returns, so our test system still works as it should.

Mile23’s picture

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 40: 2641632_40.patch, failed testing.

Mile23’s picture

Status: Needs work » Needs review
FileSize
26.99 KB
1.46 KB

Rerolled for modernity's sake.

Updated PhpUnitTestRunner::runTests() to match changes to simpletest_run_phpunit_tests().

Changed PhpUnitTestRunnerTest to use the new TestStatus.

klausi’s picture

Status: Needs review » Reviewed & tested by the community

Looks good!

alexpott’s picture

Status: Reviewed & tested by the community » Needs review

These changes look sensible for 8.x whilst we have to maintain Simpletest. Just one thing...

+++ b/core/lib/Drupal/Core/Test/PhpUnitTestRunner.php
@@ -0,0 +1,234 @@
+  public static function create(ContainerInterface $container) {
+    return new static(
+      (string) $container->get('app.root'),
+      (string) $container->get('file_system')->realpath('public://simpletest')
+    );
+  }

+++ b/core/modules/simpletest/simpletest.module
@@ -304,61 +300,13 @@ function simpletest_phpunit_configuration_filepath() {
+  $runner = PhpUnitTestRunner::create(\Drupal::getContainer());

@@ -366,25 +314,13 @@ function simpletest_phpunit_run_command(array $unescaped_test_classnames, $phpun
+  $runner = PhpUnitTestRunner::create(\Drupal::getContainer());

+++ b/core/modules/simpletest/tests/src/Unit/SimpletestPhpunitRunCommandTest.php
@@ -83,8 +103,17 @@ public function provideStatusCodes() {
+    $runner = PhpUnitTestRunner::create($this->fixtureContainer);

Why not just simpletest.phpunit_runner to simpletest.services and use \Drupal in the procedural code?

Mile23’s picture

I'm reticent to turn it into a service because that means we have to __construct() with service classes instead of just strings, which means adding a factory service class, which adds complexity. The service would only ever be used by procedural code which is deprecated, and simpletest UI which might be extinct soon.

Also PhpUnitTestRunner is not a service of simpletest (the point of this issue), and it shouldn't be a service of core (since it should only be available during testing), so therefore who defines it?

Let's talk about doing all that as a follow-up. We already have #2808693: Remove usages of deprecated simpletest_phpunit*() and xml-related functions, turn PhpUnitTestRunner into a service which I'll amend to include service-i-fying.

Baby steps...

klausi’s picture

Status: Needs review » Reviewed & tested by the community

Agreed, turning this into a service can be done later. The constructors of the classes seem to be sufficiently decoupled from the container with the create() method. So there should not be API changes when we turn this into a service, where ever it might live.

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 44: 2641632_44.patch, failed testing.

Mile23’s picture

Status: Needs work » Needs review
FileSize
27.29 KB

Rerolled/updated to reflect changes to simpletest_phpunit_run_command().

Status: Needs review » Needs work

The last submitted patch, 50: 2641632_50.patch, failed testing.

Mile23’s picture

Status: Needs work » Needs review

The error is: "Slave went offline during build."

Re-running.

Status: Needs review » Needs work

The last submitted patch, 50: 2641632_50.patch, failed testing.

The last submitted patch, 50: 2641632_50.patch, failed testing.

Mile23’s picture

+++ b/core/modules/simpletest/simpletest.module
@@ -304,65 +300,13 @@ function simpletest_phpunit_configuration_filepath() {
-function simpletest_phpunit_run_command(array $unescaped_test_classnames, $phpunit_file, &$status = NULL, &$output = NULL) {
...
+function simpletest_phpunit_run_command(array $unescaped_test_classnames, $phpunit_file, &$status = NULL) {

Missed $output. Ewps.

Mile23’s picture

+++ b/core/modules/simpletest/simpletest.module
@@ -304,65 +300,13 @@ function simpletest_phpunit_configuration_filepath() {
+function simpletest_phpunit_run_command(array $unescaped_test_classnames, $phpunit_file, &$status = NULL, &$output = NULL) {  $runner = PhpUnitTestRunner::create(\Drupal::getContainer());
+  $runner = PhpUnitTestRunner::create(\Drupal::getContainer());

OK. That's just weird. Fixed. Please ignore #55.

Status: Needs review » Needs work

The last submitted patch, 56: interdiff_55.patch, failed testing.

The last submitted patch, 56: interdiff_50.patch, failed testing.

Mile23’s picture

Status: Needs work » Needs review

Re-running tests for the patch from #56.

Sorry about the bad file names.

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

Drupal 8.3.0-alpha1 will be released the week of January 30, 2017, which means new developments and disruptive changes should now 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.

klausi’s picture

Status: Needs review » Needs work

Patch does not apply anymore.

Mile23’s picture

Status: Needs work » Needs review
FileSize
2.19 KB

Rerolled for 8.4.x.

Mile23’s picture

FileSize
27.34 KB

Can I not make a patch any more? Sheesh.

Pls ignore #62.

The last submitted patch, 62: 2641632_62.patch, failed testing.

Mile23’s picture

Reroll, updated deprecation messages.

Status: Needs review » Needs work

The last submitted patch, 65: 2641632_65.patch, failed testing.

Mile23’s picture

Status: Needs work » Needs review
FileSize
27.5 KB
1.79 KB

Fixed the one typo that make 1754 tests fail.

Also fixed CS error reported by the testbot.

Munavijayalakshmi’s picture

+++ b/core/lib/Drupal/Core/Test/PhpUnitTestRunner.php
@@ -0,0 +1,237 @@
+    // Setup an environment variable containing the base URL, if it is available.

Line exceeding 80 characters.

Fixed and attached new patch.

klausi’s picture

Status: Needs review » Reviewed & tested by the community

Looks good, back to RTBC.

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 68: 2641632_68.patch, failed testing.

joelpittet’s picture

Status: Needs work » Reviewed & tested by the community

Testbot hiccup

Mile23’s picture

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 68: 2641632_68.patch, failed testing.

Mile23’s picture

Status: Needs review » Needs work

The last submitted patch, 74: 2641632_74.patch, failed testing.

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

Drupal 8.4.0-alpha1 will be released the week of July 31, 2017, which means new developments and disruptive changes should now 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.

Mile23’s picture

Rerolled for 8.5.x.

The follow-up will be to add @trigger_error() and remove usages from run-tests.sh.

Mile23’s picture

Le patch.

Mile23’s picture

Issue summary: View changes

Status: Needs review » Needs work

The last submitted patch, 78: 2641632_77.patch, failed testing. View results

amateescu’s picture

Here's the error reported by Drupal CI for the patch in #78:

Fatal error: Uncaught TypeError: Argument 1 passed to PHPUnit_Framework_TestCase::run() must be an instance of PHPUnit_Framework_TestResult, array given, called in /var/www/html/core/scripts/run-tests.sh on line 793 and defined in /var/www/html/vendor/phpunit/phpunit/src/Framework/TestCase.php:609
Mile23’s picture

Status: Needs work » Needs review
FileSize
27.07 KB
767 bytes

run-tests.sh filters against PHPUnit\Framework\TestCase instead of \PHPUnit_Framework_TestCase, so we can enforce changes that will make it easier to eventually use PHPUnit 5+.

But that's OK because we're supposed to test Core namespace stuff against Drupal\Tests\UnitTestCase anyway.

joelpittet’s picture

Status: Needs review » Reviewed & tested by the community

Thanks for resolving that, back to RTBC

Mile23’s picture

Issue summary: View changes

Noticed that I pasted in the wrong issue number in the recent issue summary update. Fixed.

xjm’s picture

Status: Reviewed & tested by the community » Needs work

Nice patch. Just some nits so far.

  1. +++ b/core/lib/Drupal/Core/Test/JUnitConverter.php
    @@ -0,0 +1,117 @@
    +   * @return array[]
    +   *   The results as array of rows in a format that can be inserted into
    +   *   {simpletest}.
    

    Can we be a bit more specific? Edit: I mean about the "in a format". Usually we actually want to document what the actual keys are in an associative array. Since these are moved lines, followup would be best.

  2. +++ b/core/lib/Drupal/Core/Test/JUnitConverter.php
    @@ -0,0 +1,117 @@
    +   *   (Optional) The parent of the current element. Defaults to NULL.
    

    "Optional" should not be capitalized here. Does this exist in HEAD or?

  3. +++ b/core/lib/Drupal/Core/Test/JUnitConverter.php
    @@ -0,0 +1,117 @@
    +   * @return array
    +   *   A list of all test cases.
    

    Can has followup for "array of what".

  4. +++ b/core/modules/simpletest/simpletest.module
    @@ -118,8 +116,9 @@ function _simpletest_format_summary_line($summary) {
    - * @param $test_list
    - *   List of tests to run.
    + * @param array[] $test_list
    + *   List of tests to run. The top level is keyed by type of test, either
    + *   'simpletest' or 'phpunit'. Under that is an array of class names to run.
    

    Sounds like it's a string[][]? But actually we probably shouldn't be changing this hunk at all here; presumably the only changes should be gutting and deprecating the function, rather than improving its docs.

  5. +++ b/core/modules/simpletest/simpletest.module
    @@ -181,28 +180,13 @@ function simpletest_run_tests($test_list) {
    + *   Drupal\Core\Test\PhpUnitTestRunner::runTests().
    
    @@ -275,9 +259,13 @@ function simpletest_summarize_phpunit_result($results) {
    + *   Drupal\Core\Test\PhpUnitTestRunner::xmlLogFilepath().
    
    @@ -313,65 +301,13 @@ function simpletest_phpunit_configuration_filepath() {
    + *   Drupal\Core\Test\PhpUnitTestRunner::runCommand().
    
    +++ b/core/modules/simpletest/tests/src/Unit/SimpletestPhpunitRunCommandTest.php
    @@ -12,6 +13,14 @@
    + * Drupal\Tests\simpletest\Unit\SimpletestPhpunitRunCommandTestWillDie which can
    

    Minor: I think this needs a leading \ so's not to be Drupal\thing\Drupal\thing. (In these hunks and elsewhere in the patch.)

  6. +++ b/core/modules/simpletest/tests/src/Unit/SimpletestPhpunitRunCommandTest.php
    @@ -12,6 +13,14 @@
    + * Here, we run SimpletestPhpunitRunCommandTestWillDie, make it die, and see
    + * what happens.
    

    Make it die! ☠️

Mile23’s picture

All those docblocks were from HEAD, but we just had this: #2722699: Fix Drupal.Commenting.FunctionComment.InvalidReturnNotVoid which seems to have improved things a little, creating a need for a reroll.

And that's why we should have a follow-up, too, since there are a ton of CS improvement issues that will probably touch simpletest.module.

Follow-up: #2909306: Improve docblocks for *_phpunit_* simpletest functions and/or PhpUnitTestRunner and JUnitConverter

Added leading \ to namespaces in deprecation docs.

borisson_’s picture

Status: Needs review » Reviewed & tested by the community

We now have a followup for those docs improvements, so setting back to rtbc.

Mile23’s picture

Title: Refactor simpletest's *_phpunit_*() functions etc. to a class » Refactor simpletest's *_phpunit_*() functions etc. to a class, deprecate
Issue tags: +@deprecated

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 86: 2641632_86.patch, failed testing. View results

alexpott’s picture

+++ b/core/lib/Drupal/Core/Test/PhpUnitTestRunner.php
@@ -0,0 +1,238 @@
+      putenv('BROWSERTEST_OUTPUT_DIRECTORY=' . \Drupal::service('file_system')->realpath('public://simpletest'));

I think \Drupal::service::... can be replaced with $this->workingDirectory

Also I deliberated findTestcases vs findTestCases and xmlLogFilepath vs xmlLogFilePath currently in core TestCases and FilePath are way more prevalent but the current patch is converting the snake case to camel case so the new names are in line with the old names. Not sure - but I think now might be a good time to bring the names into line with the rest of core. Unfortunately this also means replacing things like $testcases with $test_cases - however this is also totally in line with PHPUnit too.

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

Drupal 8.5.0-alpha1 will be released the week of January 17, 2018, which means new developments and disruptive changes should now 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.

Mile23’s picture

Status: Needs work » Needs review
FileSize
27.57 KB
8.88 KB

Rerolled for 8.6.x. Addressed case concerns from #90... The interdiff should tell that story.

Mile23’s picture

Issue tags: +Needs change record

Needs a change record, and the deprecation messages will need to point to it.

We should probably go ahead and add @trigger_error() too, since really only core should be calling these functions.

Mile23’s picture

Added CR. Added @trigger_error(), fixed some missed instances.

Moved UiPhpUnitOutputTest to @group legacy. See #2932909: Convert web tests to browser tests for Simpletest module for more about that edge case.

Mile23’s picture

Mile23’s picture

Title: Refactor simpletest's *_phpunit_*() functions etc. to a class, deprecate » Refactor simpletest's *_phpunit_*() (and junit) functions etc. to a class, deprecate

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

Drupal 8.6.0-alpha1 will be released the week of July 16, 2018, which means new developments and disruptive changes should now 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.

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

Drupal 8.7.0-alpha1 will be released the week of March 11, 2019, which means new developments and disruptive changes should now be targeted against the 8.8.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Mile23’s picture

Updated IS, added related issue. No longer a blocker for #2905007: Allow run-tests.sh to report skipped/risky/incomplete PHPUnit-based tests which includes a refactored JUnit helper class.

Mile23’s picture

Some planning happening in this meta.

Mile23’s picture

Rerolled.

kim.pepper’s picture

Looking good.

Just a couple of nits:

  1. +++ b/core/lib/Drupal/Core/Test/JUnitConverter.php
    @@ -0,0 +1,117 @@
    +   * @return array[]|null
    

    Why do we need to support NULL? Why not just an empty array?

  2. +++ b/core/lib/Drupal/Core/Test/PhpUnitTestRunner.php
    @@ -0,0 +1,237 @@
    +class PhpUnitTestRunner {
    

    Should this implement \Drupal\Core\DependencyInjection\ContainerInjectionInterface ?

  3. +++ b/core/modules/simpletest/simpletest.module
    @@ -187,28 +187,16 @@ function simpletest_run_tests($test_list) {
    +  @trigger_error(__FUNCTION__ . ' is deprecated. Use \Drupal\Core\Test\PhpUnitTestRunner::runTests() instead. https://www.drupal.org/node/2948547', E_USER_DEPRECATED);
    
    @@ -281,9 +269,16 @@ function simpletest_summarize_phpunit_result($results) {
    +  @trigger_error(__FUNCTION__ . ' is deprecated. Use \Drupal\Core\Test\PhpUnitTestRunner::xmlLogFilepath() instead. https://www.drupal.org/node/2948547', E_USER_DEPRECATED);
    
    @@ -319,65 +314,16 @@ function simpletest_phpunit_configuration_filepath() {
    +  @trigger_error(__FUNCTION__ . ' is deprecated. Use \Drupal\Core\Test\PhpUnitTestRunner::runCommand() instead. https://www.drupal.org/node/2948547', E_USER_DEPRECATED);
    
    @@ -385,24 +331,16 @@ function simpletest_phpunit_run_command(array $unescaped_test_classnames, $phpun
    +  @trigger_error(__FUNCTION__ . ' is deprecated. Use \Drupal\Core\Test\PhpUnitTestRunner::phpUnitCommand() instead. https://www.drupal.org/node/2948547', E_USER_DEPRECATED);
    
    @@ -842,18 +781,15 @@ function simpletest_mail_alter(&$message) {
    +  @trigger_error(__FUNCTION__ . ' is deprecated. Use \Drupal\Core\Test\JUnitConverter::xmlToRows() instead. https://www.drupal.org/node/2948547', E_USER_DEPRECATED);
    
    @@ -866,34 +802,15 @@ function simpletest_phpunit_xml_to_rows($test_id, $phpunit_xml_file) {
    +  @trigger_error(__FUNCTION__ . ' is deprecated. Use \Drupal\Core\Test\JUnitConverter::findTestCases() instead. https://www.drupal.org/node/2948547', E_USER_DEPRECATED);
    
    @@ -901,40 +818,18 @@ function simpletest_phpunit_find_testcases(\SimpleXMLElement $element, \SimpleXM
    +  @trigger_error(__FUNCTION__ . ' is deprecated. Use \Drupal\Core\Test\JUnitConverter::convertTestCaseToSimpletestRow() instead. https://www.drupal.org/node/2948547', E_USER_DEPRECATED);
    

    We should be using the standard deprecation format.

Mile23’s picture

Thanks.

Addresses #102.

kim.pepper’s picture

Status: Needs review » Reviewed & tested by the community

LGTM!

larowlan’s picture

Status: Reviewed & tested by the community » Needs review
  1. +++ b/core/lib/Drupal/Core/Test/JUnitConverter.php
    @@ -0,0 +1,117 @@
    +      if (!$element->attributes()->class) {
    +        $name = explode('::', $parent->attributes()->name, 2);
    +        $element->addAttribute('class', $name[0]);
    +      }
    +      $test_cases[] = $element;
    +    }
    +    else {
    

    we can return here and avoid the else

  2. +++ b/core/lib/Drupal/Core/Test/JUnitConverter.php
    @@ -0,0 +1,117 @@
    +      // @todo: Check on the proper values for this.
    +      'message_group' => 'Other',
    

    do we have an issue for this? is this still an open item for this patch?

  3. +++ b/core/lib/Drupal/Core/Test/PhpUnitTestRunner.php
    @@ -0,0 +1,237 @@
    +    return $this->appRoot . '/core/phpunit.xml.dist';
    

    should we also test for the phpunit.xml file which should take precedence? or is that an existing issue and not changed here?

  4. +++ b/core/lib/Drupal/Core/Test/PhpUnitTestRunner.php
    @@ -0,0 +1,237 @@
    +    if ($status == TestStatus::PASS) {
    +      $rows = JUnitConverter::xmlToRows($test_id, $phpunit_file);
    +    }
    +    else {
    +      $rows[] = [
    

    same here re early return.

Mile23’s picture

#105.1 & 4: Dun.

#105.2: Comes from this: #1963022: Problem with PHPUnit test results when using @dataProvider which was closed in 2014. So in 5 years no one has objected to using 'Other.' I think we're cool.

#105.3: You know what's funny? #2798273: simpletest_phpunit_configuration_filepath() is dead code. Deprecate it. We don't need this method on the PhpUnitTestRunner object. it must have come back in a flurry of copypasta.

Closing #2808693: Remove usages of deprecated simpletest_phpunit*() and xml-related functions, turn PhpUnitTestRunner into a service because we should do the replacement here.

Slight uptick in test coverage.

We don't have much coverage of JUnitConverter, which tempts me to go ahead and refactor a little and/or just mark a lot of stuff @internal. But really we have an issue here because simpletest-module-as-contrib will need a consistent API that uses all this for the batch runner, and that's a pain.

Also, I realize that we're overlooking simpletest_summarize_phpunit_result() and that whole chain of results form building functions. I think in the interest of limiting scope creep that's a follow-up, or will just happen alongside moving simpletest to contrib.

(run-tests.sh is a fake shell script that has a theming layer....)

Mile23’s picture

Deprecated simpletest_summarize_phpunit_result(), folded it into PhpUnitTestRunner.

Everything's @internal. We'll un-@internal some things for the eventual contrib simpletest module, or if someone shows up in issues to demand an API for their contrib module.

Updated CR to point out that this is all @internal. :-)

Added unit tests for stuff.

The follow-up I was thinking about in #106 turns out to exist already in #3074433: Decouple run-tests.sh from the simpletest module because run-tests.sh needs to be able to display a results form.

Mile23’s picture

Issue tags: -Needs followup
kim.pepper’s picture

A micro-nit:

+++ b/core/lib/Drupal/Core/Test/PhpUnitTestRunner.php
@@ -0,0 +1,278 @@
+  /**
+   * Factory method to inject the container-based dependencies.
+   *
+   * @param \Symfony\Component\DependencyInjection\ContainerInterface $container
+   *   Container to inject.
+   *
+   * @return static
+   *   Newly-created test runner object.
+   */
+  public static function create(ContainerInterface $container) {

This can just be @inheritdoc now.

Lendude’s picture

Ran some tests using the Simpletest UI and using run-tests.sh with this patch applied and the results are identical with and without the patch (in my small sample anyway).

Mile23’s picture

Addresses #109.

kim.pepper’s picture

Status: Needs review » Reviewed & tested by the community
Mile23’s picture

Issue summary: View changes
larowlan’s picture

Issue summary: View changes
larowlan’s picture

Status: Reviewed & tested by the community » Needs work

Looks like we have some phpcs regressions here

Checking changed files...
PHPCS: core/lib/Drupal/Core/Test/JUnitConverter.php passed

FILE: .../git/core/drupal/core/lib/Drupal/Core/Test/PhpUnitTestRunner.php
----------------------------------------------------------------------
FOUND 5 ERRORS AFFECTING 5 LINES
----------------------------------------------------------------------
 224 | ERROR | [x] Closing parenthesis of array declaration must be
     |       |     on a new line
 253 | ERROR | [x] There must not be a single space before a unary
     |       |     operator statement
 257 | ERROR | [x] There must not be a single space before a unary
     |       |     operator statement
 261 | ERROR | [x] There must not be a single space before a unary
     |       |     operator statement
 265 | ERROR | [x] There must not be a single space before a unary
     |       |     operator statement
----------------------------------------------------------------------
PHPCBF CAN FIX THE 5 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------

Time: 147ms; Memory: 8MB

PHPCS: core/modules/simpletest/simpletest.module passed
PHPCS: core/modules/simpletest/src/Tests/UiPhpUnitOutputTest.php passed
PHPCS: core/modules/simpletest/tests/src/Kernel/PhpUnitErrorTest.php passed

FILE: ...odules/simpletest/tests/src/Kernel/SimpletestDeprecationTest.php
----------------------------------------------------------------------
FOUND 2 ERRORS AFFECTING 2 LINES
----------------------------------------------------------------------
 73 | ERROR | [x] Closing parenthesis of array declaration must be on
    |       |     a new line
 77 | ERROR | [x] Closing parenthesis of array declaration must be on
    |       |     a new line
----------------------------------------------------------------------
PHPCBF CAN FIX THE 2 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------

Time: 180ms; Memory: 8MB

PHPCS: core/modules/simpletest/tests/src/Unit/SimpletestPhpunitRunCommandTest.php passed

FILE: .../drupal/core/tests/Drupal/Tests/Core/Test/JUnitConverterTest.php
----------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
----------------------------------------------------------------------
 76 | ERROR | [x] Closing parenthesis of array declaration must be on
    |       |     a new line
----------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------

Time: 149ms; Memory: 8MB


FILE: ...upal/core/tests/Drupal/Tests/Core/Test/PhpUnitTestRunnerTest.php
----------------------------------------------------------------------
FOUND 6 ERRORS AFFECTING 5 LINES
----------------------------------------------------------------------
  91 | ERROR | [x] Closing parenthesis of array declaration must be
     |       |     on a new line
  98 | ERROR | [x] Closing parenthesis of array declaration must be
     |       |     on a new line
 105 | ERROR | [x] Closing parenthesis of array declaration must be
     |       |     on a new line
 112 | ERROR | [x] Closing parenthesis of array declaration must be
     |       |     on a new line
 128 | ERROR | [x] Expected 1 space after FOREACH keyword; 0 found
 128 | ERROR | [x] There should be no white space after an opening
     |       |     "("
----------------------------------------------------------------------
PHPCBF CAN FIX THE 6 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------
kim.pepper’s picture

Status: Needs work » Needs review
FileSize
51.49 KB
6.8 KB

phpcs seems to get confused by having two [[ together. This patch just splits them out onto new lines.

Mile23’s picture

Thanks, @kim.pepper. I think splitting them out like that is our CS anyway. Meaning phpcs isn't the confused party here.

Lendude’s picture

Status: Needs review » Reviewed & tested by the community

#116 looks good, feedback has been addressed, back to RTBC.

  • larowlan committed 76f3729 on 8.8.x
    Issue #2641632 by Mile23, kim.pepper, Munavijayalakshmi, dawehner,...
larowlan’s picture

Status: Reviewed & tested by the community » Fixed

Committed 76f3729 and pushed to 8.8.x. Thanks!

🎉 published the change record

Status: Fixed » Closed (fixed)

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