Problem/Motivation

Because of #3083275: [meta] Update tests that rely on Classy to not rely on it anymore and Classy being deprecated in Drupal 9 + removed in Drupal 10,: Tests that aren't specifically testing Classy yet declare $defaultTheme = 'classy'; should be refactored to use Stark as the default theme instead.

Proposed resolution

Change all tests in this module to use Stark as the default theme, and refactor the tests where needed so they continue to function properly.

This one appears to be fairly simple.

1. Do a find-replace that changes classy to stark in the locale module.

2. In Drupal\Tests\locale\Functional\LocaleContentTest::testContentTypeDirLang() remove the node class from the cssSelect calls. For example:

Before: $this->cssSelect('article.node[lang="en"]');
After: $this->cssSelect('article[lang="en"]');

That node class comes from the node.html.twig template in classy.

Issue fork drupal-3274265

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:

Comments

danflanagan8 created an issue. See original summary.

danflanagan8’s picture

I marked this as Novice in an attempt to get some new contributors on the case. I promise quick reviews. :)

Johnny Santos’s picture

Assigned: Unassigned » Johnny Santos

Going for it, thanks for the tag!

Johnny Santos’s picture

Assigned: Johnny Santos » Unassigned
Status: Active » Needs review

Done as told on the issue, thanks again.

danflanagan8’s picture

Status: Needs review » Needs work

Thanks, @Johnny Santos!

This module actually has some Kernel tests that rely on Classy in addition to the Functional tests that you have addressed.

Could you please replace classy with stark in

1. Drupal\Tests\locale\Kernel\LocaleConfigManagerTest
2. core/modules/locale/tests/modules/locale_test/config/optional/block.block.test_default_config.yml

Thanks!

Johnny Santos’s picture

Assigned: Unassigned » Johnny Santos

Sure, on it

Johnny Santos’s picture

Assigned: Johnny Santos » Unassigned
Status: Needs work » Needs review

Ok, just did as asked on comment #6

danflanagan8’s picture

Status: Needs review » Needs work

Oops, I missed something important when I was triaging this issue. There was a failure:

1) Drupal\Tests\locale\Functional\LocaleTranslatedSchemaDefinitionTest::testTranslatedUpdate
Behat\Mink\Exception\ExpectationException: The string "messages--status" was not found anywhere in the HTML response of the current page.

/var/www/html/vendor/behat/mink/src/WebAssert.php:768
/var/www/html/vendor/behat/mink/src/WebAssert.php:324
/var/www/html/core/tests/Drupal/Tests/WebAssert.php:524
/var/www/html/core/modules/locale/tests/src/Functional/LocaleTranslatedSchemaDefinitionTest.php:98
/var/www/html/vendor/phpunit/phpunit/src/Framework/TestResult.php:726

The line that triggered that is:

$this->assertSession()->responseContains('messages--status');

Now that we're using stark, that class isn't on messages. That assertion escaped my normal search for css, xpath, and class=.

Luckily there is an easy fix! You can use one of the new assertions described here: https://www.drupal.org/node/3270424

In this case, the test is just asserting that a status message is present. So you can change the line of code to:

$this->assertSession()->statusMessageExists('status')

Johnny Santos’s picture

Assigned: Unassigned » Johnny Santos

No problem, going for it as well

Johnny Santos’s picture

Assigned: Johnny Santos » Unassigned
Status: Needs work » Needs review

Just fixed and changed the method as asked.
Thanks for the documentation!

danflanagan8’s picture

Status: Needs review » Reviewed & tested by the community

Thanks, @Johnny Santos!

MR looks good. All green.

In case it comes in handy in the future, here are the docs on running phpunit tests locally: https://www.drupal.org/docs/automated-testing/phpunit-in-drupal/running-...

Thanks for getting involved!

alexpott’s picture

Status: Reviewed & tested by the community » Fixed

Committed and pushed 5c6d023687 to 10.0.x and f56cd047c2 to 9.4.x. Thanks!

  • alexpott committed 5c6d023 on 10.0.x
    Issue #3274265 by Johnny Santos, danflanagan8: Locale Tests should not...

  • alexpott committed f56cd04 on 9.4.x
    Issue #3274265 by Johnny Santos, danflanagan8: Locale Tests should not...

Status: Fixed » Closed (fixed)

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