tripal / tripal

The Tripal package is a suite of Drupal modules for creating biological (genomic, genetic, breeding) websites. Visit the Tripal homepage at http://tripal.info for documentation, support, and other information. The Drupal project page is at http://drupal.org/project/tripal.
GNU General Public License v2.0
67 stars 49 forks source link

PHPUnit testing error on Drupal 10.2 - not sure if it's an incompatibility, bug or something else #1804

Closed risharde closed 6 months ago

risharde commented 8 months ago

Discussion or Question

This is the error message and it leads me to code I don't understand so I'm hoping someone can help me figure this one out. This error pops up only after a recent move to Drupal 10.2 (originally I had no issues on the Drupal 9) Searching the string 'data_search' leads me to the tripal.install file with code but that's where I'm clueless

1) Drupal\Tests\tripal_chado\Functional\TripalPubLibraryTest::testTripalPubLibraryTestSimpleTest Drupal\Core\Config\Schema\SchemaIncompleteException: Schema errors for system.menu.data_search with the following errors: 0 [id] The <em class="placeho lder">&quot;data_search&quot;</em> machine name is not valid.

/var/www/html/drupal10/web/core/lib/Drupal/Core/Config/Development/ConfigSchemaChecker.php:94 /var/www/html/drupal10/web/core/lib/Drupal/Component/EventDispatcher/ContainerAwareEventDispatcher.php:111 /var/www/html/drupal10/web/core/lib/Drupal/Core/Config/Config.php:229 /var/www/html/drupal10/web/core/lib/Drupal/Core/Config/Entity/ConfigEntityStorage.php:278 /var/www/html/drupal10/web/core/lib/Drupal/Core/Entity/EntityStorageBase.php:486 /var/www/html/drupal10/web/core/lib/Drupal/Core/Config/Entity/ConfigEntityStorage.php:257 /var/www/html/drupal10/web/core/lib/Drupal/Core/Entity/EntityBase.php:352 /var/www/html/drupal10/web/core/lib/Drupal/Core/Config/Entity/ConfigEntityBase.php:609 /var/www/html/drupal10/web/core/modules/system/src/Entity/Menu.php:100 /var/www/html/drupal10/web/modules/tripal/tripal/tripal.install:33 /var/www/html/drupal10/web/core/lib/Drupal/Core/Extension/ModuleHandler.php:400 /var/www/html/drupal10/web/core/lib/Drupal/Core/Extension/ModuleInstaller.php:364 /var/www/html/drupal10/web/core/lib/Drupal/Core/ProxyClass/Extension/ModuleInstaller.php:83 /var/www/html/drupal10/web/core/lib/Drupal/Core/Test/FunctionalTestSetupTrait.php:466 /var/www/html/drupal10/web/core/tests/Drupal/Tests/BrowserTestBase.php:558 /var/www/html/drupal10/web/core/tests/Drupal/Tests/BrowserTestBase.php:366 /var/www/html/drupal10/web/modules/tripal/tripal/tests/src/Functional/TripalTestBrowserBase.php:33 /var/www/html/drupal10/web/modules/tripal/tripal_chado/tests/src/Functional/ChadoTestBrowserBase.php:71 /var/www/html/drupal10/vendor/phpunit/phpunit/src/Framework/TestResult.php:728

risharde commented 8 months ago

@laceysanderson @dsenalik not sure if you guys saw this issue before

dsenalik commented 8 months ago

Lol I am probably the current "expert" on Drupal 10.2 error messages, but that doesn't mean much. that is a new one, is this your new pub importer branch?

risharde commented 8 months ago

@dsenalik lol sorry that's as far as the error goes unfortunately and yes that's on the new pub important branch :)

dsenalik commented 8 months ago

I built a php 8.3 drupal 10.2 docker and ran this: $ export n=1642 $ docker exec --workdir=/var/www/drupal9/web/modules/contrib/tripal $n phpunit --testdox --verbose --filter testTripalPubLibraryTestSimpleTest PHPUnit 9.6.17 by Sebastian Bergmann and contributors.

Runtime: PHP 8.3.3 Configuration: /var/www/drupal/web/modules/contrib/tripal/phpunit.xml

Testing Tripal Pub Library (Drupal\Tests\tripal_chado\Functional\TripalPubLibrary) ✔ Tripal pub library test simple test [54554.10 ms]

Time: 00:55.171, Memory: 16.00 MB

OK (1 test, 15 assertions)

🤷

risharde commented 8 months ago

Thanks Doug, I'll check on that phpunit.xml file and see if I find any differences since I was using the phpunit.xml file from my D9 version - maybe that will solve it, I'll keep you posted

risharde commented 8 months ago

I'm so confused, I still get the same error even if I use the phpunit.xml file from within the repo (changing the necessary variables to point to the site) @dsenalik do we have instructions anywhere on how to set up a docker? Could you link this to me? I'll try the docker on my server and see if that works, thanks so much!

risharde commented 8 months ago

Oh, I think I found the docs, I'll try this out soon, thought I'd post it here just in case someone reads this issue / thread https://tripaldoc.readthedocs.io/en/latest/install/docker.html

laceysanderson commented 8 months ago

@risharde, yes the docker is a really good option!

That said, do you want to share your version of the phpunit.xml file and the path to the base of the site. That way I can take a look at it and see if anything jumps out to me.

risharde commented 8 months ago

@laceysanderson Thanks Lace, here's the phpunit file from the repo that I modified a bit - hopefully it displays properly here root folder is /var/www/html/drupal10/web

phpunit.xml.txt

dsenalik commented 8 months ago

The docker root folder is /var/www/drupal/web - I don't know if that helps

laceysanderson commented 8 months ago

Your bootstap path is wrong @risharde. You have this:

<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         bootstrap="tests/bootstrap.php" colors="true"
         beStrictAboutTestsThatDoNotTestAnything="true"
         beStrictAboutOutputDuringTests="true"
         beStrictAboutChangesToGlobalState="true"
         printerClass="\Drupal\Tests\Listeners\HtmlOutputPrinter"
         xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd">

The path should be the relative path from where you run the command (i.e. in the Tripal folder) to the bootrap file for Drupal core. The boostrap file is in [Drupalroot]/core/tests/bootstrap.php and the tripal module should be installed in [Drupalroot]/modules/contrib/tripal. That is why we set it to ../../../core/tests/bootstrap.php so that it will go up 3 directories (i.e. back to [drupalroot]) and then back up to the bootstrap file.

The base path shouldn't matter and this phpunit.xml should still work as long as you have tripal installed in [Drupalroot]/modules/contrib/tripal... which is where composer puts it.

Based on your error message in the original though, you have it at /var/www/html/drupal10/web/modules/tripal which means you bootstrap path should only go up two instead of three directories.

As such, change your phpunit.xml file header to this instead and it should work with your install.

<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         bootstrap="../../core/tests/bootstrap.php" colors="true"
         beStrictAboutTestsThatDoNotTestAnything="true"
         beStrictAboutOutputDuringTests="true"
         beStrictAboutChangesToGlobalState="true"
         printerClass="\Drupal\Tests\Listeners\HtmlOutputPrinter"
         xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd">
risharde commented 8 months ago

Thanks @laceysanderson , I was running my phpunit tests within the core folder so that was why I didn't have the ../.. path (this worked on my d9 install)

I will double check what you mentioned though. Correct I have tripal in modules/tripal

laceysanderson commented 6 months ago

I'm closing this as it was related to the particular install.