Problem/Motivation

Drupal 9 tests won't run until we replace the deprecated test code.

Proposed resolution

remove deprecated api references to simpletest WebTestBase and replace with Tests BrowserTestBase

see patch

Issue fork libraries-3186677

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

ressa created an issue. See original summary.

ressa’s picture

Issue summary: View changes
ressa’s picture

Status: Active » Needs review
StatusFileSize
new388 bytes

Adding a patch.

Status: Needs review » Needs work

The last submitted patch, 3: 3186677-3-libraries-example-missing-type.patch, failed testing. View results

ressa’s picture

Status: Needs work » Needs review

Trying with the new Gitlab integration in stead :)

joseph.olstad’s picture

Status: Needs review » Fixed

latest release should fix this

8.x-3.0-alpha3

ressa’s picture

Version: 8.x-3.x-dev » 8.x-3.0-alpha3
Status: Fixed » Active

Thanks for the new release. I just tried with https://ftp.drupal.org/files/projects/libraries-8.x-3.0-alpha3.tar.gz but got the same error:

Drupal\Core\Extension\InfoParserException: Missing required keys (type) in temporary://update-extraction-67850766/libraries/tests/example/example_info_file.libraries.info.yml in Drupal\Core\Extension\InfoParserDynamic->parse() (line 57 of /app/web/core/lib/Drupal/Core/Extension/InfoParserDynamic.php).

joseph.olstad’s picture

Ok @ressa I merged your merge request, thanks! it looks good this fixes one automated test, only one failure now

I will publish alpha4

joseph.olstad’s picture

The merge had to be done on the command line, in the process I wasted a tag on alpha4

so I had to re-tag with alpha5

pushing alpha5

joseph.olstad’s picture

Status: Active » Fixed
joseph.olstad’s picture

this change seems to have broken a test in the automated testing

joseph.olstad’s picture

Status: Fixed » Needs review
joseph.olstad’s picture

there were two broken tests prior to this change, now there are 3

joseph.olstad’s picture

Title: Missing type in example_info_file.libraries.info.yml » One head test is failing.
Status: Needs review » Needs work

I reverted this change, caused test error, however please keep working on this, there's still one test fail.

ressa’s picture

Title: One head test is failing. » One head test is failing (example_info_file.libraries.info.yml type missing)
Related issues: +#1606606: Drupal.org release packager corrupts info files that are not modules, themes, or install profiles

Sorry about the extra releases. I had a look in the code, and there is a reference to an issue, which actually mentions that Libraries API is special, when it comes to testing: #1606606: Drupal.org release packager corrupts info files that are not modules, themes, or install profiles. I am not sure how to proceed ... perhaps @tstoeckler has an opinion on how to get this working?

Files of interest:

src/Tests/LibrariesWebTest.php
tests/example/example_info_file.libraries.info.yml

Should type be unset, like the other fields are here in line 176 of src/Tests/LibrariesWebTest.php?

unset($library['core'], $library['datestamp'], $library['project'], $library['version']);

dd 85’s picture

Version: 8.x-3.0-alpha3 » 8.x-3.0-alpha6

Can't upgrade module from 8.x-3.0-alpha1 to 8.x-3.0-alpha6
I get the error
Drupal\Core\Extension\InfoParserException: Missing required keys (type) in temporary://update-extraction-996ccefd/libraries/tests/example/example_info_file.libraries.info.yml in Drupal\Core\Extension\InfoParserDynamic->parse() (line 57 of /core/lib/Drupal/Core/Extension/InfoParserDynamic.php).

ressa’s picture

Status: Needs work » Postponed (maintainer needs more info)

With what method did you update the module?

dd 85’s picture

/admin/reports/updates/update

joseph.olstad’s picture

Thanks for reporting. If someone can confirm that one of the suggested fixes work please let me know

ressa’s picture

Status: Postponed (maintainer needs more info) » Needs work

Hi @joseph.olstad. The two patches in this issue (local = #3, GitLab = #7) are identical, adding type: module in tests/example/example_info_file.libraries.info.yml, which makes the tests break. So this issue needs more work ...

joseph.olstad’s picture

StatusFileSize
new627 bytes

Testing new patch.

joseph.olstad’s picture

Title: One head test is failing (example_info_file.libraries.info.yml type missing) » One head test is failing
Status: Needs work » Needs review

patch 24 is passing all green in 8.9.x, adding more

joseph.olstad’s picture

looks like a problem with the test runner, 8.9.x is fine
the errors look like caused by a problem on the test runner config.

ressa’s picture

Great that you got the test thing working @joseph.olstad.

This issue was originally about not being able to download the module from /admin/modules/install or update from /admin/reports/updates/update, and adding type: module. Will the updated test allow this to be added?

joseph.olstad’s picture

Try a rollup patch with your change and the latest patch?

ressa’s picture

I wasn't sure if I needed to create a new branch, but ended up creating another one. I was a little surprised to see the type: module already there ... this new GitLab system takes some getting used to :) And it looks like the test passes.

  • joseph.olstad committed c9f4fce on 8.x-3.x authored by ressa
    Issue #3186677 by ressa, joseph.olstad, DD 85: One head test is failing
    
joseph.olstad’s picture

Status: Needs review » Fixed
ressa’s picture

Title: One head test is failing » One head test is failing (example_info_file.libraries.info.yml type missing)
Version: 8.x-3.0-alpha6 » 8.x-3.x-dev
Status: Fixed » Needs work

It's great that the tests are passing, but technically this issue is not fixed, since type: module is still missing from /tests/example/example_info_file.libraries.info.yml . I tried to re-run the test for #3 (adds type: module) which now includes the patch from #24, but it fails ...

Can I ask you to close this no longer relevant Merge Request, @joseph.olstad? https://git.drupalcode.org/project/libraries/-/merge_requests/3
Do you prefer patches uploaded here in the old style, rather than in the new GitLab system?

ressa’s picture

Issue summary: View changes

Updating Issue Summary to use dev-version as example, as well as add update.

joseph.olstad’s picture

Status: Needs work » Needs review
StatusFileSize
new388 bytes

not sure if this is needed or not.

joseph.olstad’s picture

ressa, if we add type, do we need to add core version support and the other elements into the info.yml?

I think if we add this we maybe have to add the rest.

Status: Needs review » Needs work

The last submitted patch, 36: 3186677-35.patch, failed testing. View results

ressa’s picture

Status: Needs work » Needs review
StatusFileSize
new426 bytes

Thanks for closing that MR @joseph.olstad. Let's try to deal with this issue with the old patch system here.

I found the CR New 'core_version_requirement' key in info.yml files for modules, themes and profiles allows Composer semantic version constraints including specifying multiple major versions of core, perhaps of use? Based on that I am adding a patch which also includes core_version_requirement: ^8.8 || ^9, let's see what the testbot says.

Status: Needs review » Needs work

The last submitted patch, 39: 3186677-39.patch, failed testing. View results

ressa’s picture

I had a look at the history of /tests/example/example_info_file.libraries.info.yml and it looks like adding and removing 'type' key has been done before.

joseph.olstad’s picture

yes I already reverted this change because it didn't pass testing.

but there's maybe something else to figure out here

ressa’s picture

I agree, there is more to be done. My point is, the type was first added and deliberately removed a week later in 2013.

joseph.olstad’s picture

Title: One head test is failing (example_info_file.libraries.info.yml type missing) » 9x head test is failing on prophecy dependency
joseph.olstad’s picture

StatusFileSize
new363 bytes

try this

joseph.olstad’s picture

Title: 9x head test is failing on prophecy dependency » fix deprecated tests for D9x compatibility
Issue summary: View changes
StatusFileSize
new732 bytes
joseph.olstad’s picture

StatusFileSize
new1.54 KB

trying something.

ressa’s picture

While I think it will be great to get tests working, the issue has now been hijacked, originally about not being able to download and update the module via the GUI.

Wouldn't a better approach be to revert this issue to the original focus (not being able to download the module via GUI) and create a new issue about getting tests working?

joseph.olstad’s picture

Hoping someone else can pick up the ball here.

joseph.olstad’s picture

ressa, how about close this issue and open two new ones.

I'd prefer not breaking tests in order to fix what you're looking to fix

do you have a better solution?

ressa’s picture

Sounds good @joseph.olstad. I'll create a fresh issue for the problem with download/update via GUI. Perhaps you can create one for the test issue?

joseph.olstad’s picture

ressa, your issue was related to the tests, we cannot fix it until we fix the tests and some of them currently do not work on D9 due to the deprecated apis being removed.

ressa’s picture

I have created #3190825: Download or update via the GUI doesn't work. I guess this issue can be kept open, to make the D9 tests work here?

paulocs’s picture

Status: Needs work » Needs review
StatusFileSize
new3.87 KB

Fixing tests to drupal 9.
Lets see if they will pass.

paulocs’s picture

StatusFileSize
new322 bytes
new4.06 KB

New patch because I forgot to change one place.

paulocs’s picture

StatusFileSize
new1.15 KB
new5.27 KB

finally...

joseph.olstad’s picture

Status: Needs review » Fixed
joseph.olstad’s picture

Thanks @paulocs, bravo!

Status: Fixed » Closed (fixed)

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