As per the parent issue.

Scope:
./Common/AddFeedTest.php
./Common/FormatDateTest.php
./Common/RenderWebTest.php
./Common/SimpleTestErrorCollectorTest.php

Done in #2955690: Move Common tests in system.module to BTB:
./Common/AlterTest.php
./Common/EarlyRenderingControllerTest.php
./Common/NoJavaScriptAnonymousTest.php
./Common/UrlTest.php

Comments

Jo Fitzgerald created an issue. See original summary.

jofitz’s picture

Assigned: jofitz » Unassigned
Status: Active » Needs review
StatusFileSize
new9.38 KB

Moved all 8 files.
Corrected namespace.
Updated references.

Status: Needs review » Needs work

The last submitted patch, 2: 2863382-2.patch, failed testing.

michielnugter’s picture

Issue tags: +phpunit initiative
berdir’s picture

Component: cache system » system.module

I'd say this is system module since the tests live the there. Wondering if tests in system.module should instead be moved to core/tests instead, we only had them in system.module because that was the only place they could be before..

Some hints on fixing the tests

* I think instead of setRawContent(), you want to use assertContains() or similar assertions on the string that you have.
* assertNoCacheTag() and assertCacheTag() should possibly be copied into some cache asserts trait?
* settingsSet(): Looks like we have no replacement for that yet in browser test base, \Drupal\Tests\system\Functional\System\SitesDirectoryHardeningTest::testSitesDirectoryHardeningConfig() inlines it, but we do have \Drupal\KernelTests\KernelTestBase::setSetting(), maybe that could move into common trait or something.
* assertNoPattern() is in AssertContentTrait
* assertCacheContext() is in \Drupal\system\Tests\Cache\AssertPageCacheContextsAndTagsTrait, sounds like a nice place for assertCacheTag methods above?

Not sure what to do with Drupal\Tests\system\Functional\Common\SimpleTestErrorCollectorTest::testErrorCollect(). That's actually a simpletest test, so we might not want to remove that until we remove simpletest and instead copy it to be able to test the same with BrowserTestBase if necessary, which might look quite different.

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.

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.

dawehner’s picture

Note: #2955690: Move Common tests in system.module to BTB contains a bunch of tests which just required a 1to1 movement

lendude’s picture

Issue summary: View changes
lendude’s picture

Status: Needs work » Needs review
Issue tags: +DevDaysLisbon
StatusFileSize
new8.16 KB

Here we go, no interdiff, because this is quite different then the moves from #2

  • Converted the stuff that I could to a Kerneltest
  • Moved SimpleTestErrorCollectorTest to the simpletest module and tagged it with WebTestBase group, that can be removed when WebTestBase gets removed
  • Unclear what setSetting was doing, since the settings were never used, just set up in setUp(), so just removed that (am I overlooking something?).

Status: Needs review » Needs work

The last submitted patch, 10: 2863382-10.patch, failed testing. View results

dawehner’s picture

  1. +++ b/core/modules/system/tests/src/Functional/Common/FormatDateTest.php
    @@ -38,11 +38,6 @@ protected function setUp() {
         $this->refreshVariables();
     
    -    $this->settingsSet('locale_custom_strings_' . self::LANGCODE, [
    -      '' => ['Sunday' => 'domingo'],
    -      'Long month name' => ['March' => 'marzo'],
    -    ]);
    -
         ConfigurableLanguage::createFromLangcode(static::LANGCODE)->save();
         $this->resetAll();
    

    This is not longer needed as #2795601: Convert \Drupal\Tests\system\Functional\Common\FormatDateTest mostly to a kernel test moved almost everything over

  2. +++ b/core/modules/system/tests/src/Kernel/Common/FormElementsRenderTest.php
    @@ -162,8 +140,9 @@ public function testDrupalRenderFormElements() {
       protected function assertRenderedElement(array $element, $xpath, array $xpath_args = []) {
    -    $original_element = $element;
    -    $this->setRawContent(drupal_render_root($element));
    +    /** @var \Drupal\Core\Render\RendererInterface $renderer */
    +    $renderer = $this->container->get('renderer');
    +    $this->setRawContent($renderer->renderRoot($element));
    

    Is there a reason we are not just using $this->render() ?

lendude’s picture

Status: Needs work » Needs review
StatusFileSize
new2.42 KB
new8.79 KB

@dawehner++

12.1 removed a whole bunch of stuff
12.2 nope, no reason other then me forgetting that that is a thing :)

Also fixed the namespace for the moved simpletest (duh)

borisson_’s picture

Status: Needs review » Reviewed & tested by the community

This looks very good, great work! I have no suggestions or nits to pick.

alexpott’s picture

Updating issue credit

alexpott’s picture

Status: Reviewed & tested by the community » Fixed

Committed 17da127 and pushed to 8.6.x. Thanks!

diff --git a/core/modules/system/tests/src/Functional/Common/FormatDateTest.php b/core/modules/system/tests/src/Functional/Common/FormatDateTest.php
index fe22c134e8..062d6f4124 100644
--- a/core/modules/system/tests/src/Functional/Common/FormatDateTest.php
+++ b/core/modules/system/tests/src/Functional/Common/FormatDateTest.php
@@ -2,7 +2,6 @@
 
 namespace Drupal\Tests\system\Functional\Common;
 
-use Drupal\language\Entity\ConfigurableLanguage;
 use Drupal\Tests\BrowserTestBase;
 
 /**

Fixing unused use on commit.

  • alexpott committed 17da127 on 8.6.x
    Issue #2863382 by Lendude, Jo Fitzgerald, dawehner, Berdir: Common:...

Status: Fixed » Closed (fixed)

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