Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failing Test: DerivativeReactionTest #2061

Open
alxp opened this issue Mar 9, 2022 · 4 comments
Open

Failing Test: DerivativeReactionTest #2061

alxp opened this issue Mar 9, 2022 · 4 comments

Comments

@alxp
Copy link
Contributor

alxp commented Mar 9, 2022

The following test fails when running on a fresh Islandora installation:

ndor/bin/phpunit -c core/phpunit.xml modules/contrib/islandora/tests/src/Functional/DerivativeReactionTest.php 
PHPUnit 9.5.18 #StandWithUkraine

Warning:       Your XML configuration validates against a deprecated schema.
Suggestion:    Migrate your XML configuration using "--migrate-configuration"!

Testing Drupal\Tests\islandora\Functional\DerivativeReactionTest
E                                                                   1 / 1 (100%)

Time: 00:33.878, Memory: 10.00 MB

There was 1 error:

1) Drupal\Tests\islandora\Functional\DerivativeReactionTest::testExecuteDerivativeReaction
Behat\Mink\Exception\ResponseTextException: The text "Hello World!" was not found anywhere in the text of the current page.

/var/www/html/drupal/vendor/behat/mink/src/WebAssert.php:785
/var/www/html/drupal/vendor/behat/mink/src/WebAssert.php:262
/var/www/html/drupal/web/core/tests/Drupal/Tests/WebAssert.php:898
/var/www/html/drupal/web/modules/contrib/islandora/tests/src/Functional/DerivativeReactionTest.php:58
/var/www/html/drupal/vendor/phpunit/phpunit/src/Framework/TestResult.php:726

ERRORS!
Tests: 1, Assertions: 13, Errors: 1.

HTML outup:

ID #24 ([Previous](http://localhost:8000/sites/simpletest/browser_output/Drupal_Tests_islandora_Functional_DerivativeReactionTest-23-65409602.html) | [Next](http://localhost:8000/sites/simpletest/browser_output/Drupal_Tests_islandora_Functional_DerivativeReactionTest-25-65409602.html)) Called from GuzzleHttp\Promise\FulfilledPromise::GuzzleHttp\Promise\{closure}() line 41 POST request to: http://localhost:8000/media/add/test_media_type The website encountered an unexpected error. Please try again later.

Drupal\Core\Entity\EntityStorageException: SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'WHERE "fid" = '1'' at line 2: UPDATE "test65409602filehash" SET WHERE "fid" = :db_condition_placeholder_0; Array ( [:db_condition_placeholder_0] => 1 ) in Drupal\Core\Entity\Sql\SqlContentEntityStorage->save() (line 811 of core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php).
Drupal\Core\Database\StatementWrapper->execute(Array, Array) (Line: 152)
Drupal\Core\Database\Query\Update->execute() (Line: 408)
Drupal\Core\Database\Query\Merge->execute() (Line: 377)
filehash_merge(Object) (Line: 365)
filehash_save(Object) (Line: 136)
filehash_file_update(Object)
call_user_func_array('filehash_file_update', Array) (Line: 403)
Drupal\Core\Extension\ModuleHandler->invokeAll('file_update', Array) (Line: 249)
Drupal\Core\Entity\EntityStorageBase->invokeHook('update', Object) (Line: 897)
Drupal\Core\Entity\ContentEntityStorageBase->invokeHook('update', Object) (Line: 602)
Drupal\Core\Entity\EntityStorageBase->doPostSave(Object, 1) (Line: 782)
Drupal\Core\Entity\ContentEntityStorageBase->doPostSave(Object, 1) (Line: 527)
Drupal\Core\Entity\EntityStorageBase->save(Object) (Line: 802)
Drupal\Core\Entity\Sql\SqlContentEntityStorage->save(Object) (Line: 339)
Drupal\Core\Entity\EntityBase->save() (Line: 37)
Drupal\file\FileUsage\FileUsageBase->add(Object, 'file', 'media', '1', 1) (Line: 60)
Drupal\file\FileUsage\DatabaseFileUsageBackend->add(Object, 'file', 'media', '1') (Line: 27)
Drupal\file\Plugin\Field\FieldType\FileFieldItemList->postSave()
call_user_func_array(Array, Array) (Line: 935)
Drupal\Core\Entity\ContentEntityStorageBase->invokeFieldMethod('postSave', Object, ) (Line: 967)
Drupal\Core\Entity\ContentEntityStorageBase->invokeFieldPostSave(Object, ) (Line: 889)
Drupal\Core\Entity\ContentEntityStorageBase->invokeHook('insert', Object) (Line: 602)
Drupal\Core\Entity\EntityStorageBase->doPostSave(Object, ) (Line: 782)
Drupal\Core\Entity\ContentEntityStorageBase->doPostSave(Object, ) (Line: 527)
Drupal\Core\Entity\EntityStorageBase->save(Object) (Line: 802)
Drupal\Core\Entity\Sql\SqlContentEntityStorage->save(Object) (Line: 29)
Drupal\media\MediaStorage->save(Object) (Line: 339)
Drupal\Core\Entity\EntityBase->save() (Line: 285)
Drupal\Core\Entity\EntityForm->save(Array, Object) (Line: 61)
Drupal\media\MediaForm->save(Array, Object)
call_user_func_array(Array, Array) (Line: 114)
Drupal\Core\Form\FormSubmitter->executeSubmitHandlers(Array, Object) (Line: 52)
Drupal\Core\Form\FormSubmitter->doSubmitForm(Array, Object) (Line: 592)
Drupal\Core\Form\FormBuilder->processForm('media_test_media_type_add_form', Array, Object) (Line: 320)
Drupal\Core\Form\FormBuilder->buildForm(Object, Object) (Line: 73)
Drupal\Core\Controller\FormController->getContentResult(Object, Object)
call_user_func_array(Array, Array) (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber{closure}() (Line: 564)
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 124)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array) (Line: 97)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber{closure}() (Line: 158)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 80)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 58)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 48)
Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 106)
Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 85)
Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 48)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 51)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 23)
Stack\StackedHttpKernel->handle(Object, 1, 1) (Line: 709)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)
Headers:
array (
'Date' => 'Wed, 09 Mar 2022 19:56:34 GMT',
'Server' => 'Apache/2.4.41 (Ubuntu)',
'X-Powered-By' => 'PHP/7.4.28',
'X-Drupal-Assertion-0' => 'a%3A3%3A%7Bi%3A0%3BO%3A25%3A%22Drupal%5CCore%5CRender%5CMarkup%22%3A1%3A%7Bs%3A9%3A%22%00%2A%00string%22%3Bs%3A155%3A%22The%20%22Symfony%5CComponent%5CHttpFoundation%5CFile%5CMimeType%5CMimeTypeGuesser%22%20class%20is%20deprecated%20since%20Symfony%204.3%2C%20use%20%22Symfony%5CComponent%5CMime%5CMimeTypes%22%20instead.%22%3B%7Di%3A1%3Bs%3A24%3A%22User%20deprecated%20function%22%3Bi%3A2%3Ba%3A3%3A%7Bs%3A8%3A%22function%22%3Bs%3A9%3A%22include%28%29%22%3Bs%3A4%3A%22file%22%3Bs%3A85%3A%22%2Fvar%2Fwww%2Fhtml%2Fdrupal%2Fvendor%2Fsymfony%2Fhttp-foundation%2FFile%2FMimeType%2FMimeTypeGuesser.php%22%3Bs%3A4%3A%22line%22%3Bi%3A18%3B%7D%7D',
'X-Drupal-Assertion-1' => 'a%3A3%3A%7Bi%3A0%3BO%3A25%3A%22Drupal%5CCore%5CRender%5CMarkup%22%3A1%3A%7Bs%3A9%3A%22%00%2A%00string%22%3Bs%3A181%3A%22The%20%22Symfony%5CComponent%5CHttpFoundation%5CFile%5CMimeType%5CFileBinaryMimeTypeGuesser%22%20class%20is%20deprecated%20since%20Symfony%204.3%2C%20use%20%22Symfony%5CComponent%5CMime%5CFileBinaryMimeTypeGuesser%22%20instead.%22%3B%7Di%3A1%3Bs%3A24%3A%22User%20deprecated%20function%22%3Bi%3A2%3Ba%3A3%3A%7Bs%3A8%3A%22function%22%3Bs%3A9%3A%22include%28%29%22%3Bs%3A4%3A%22file%22%3Bs%3A95%3A%22%2Fvar%2Fwww%2Fhtml%2Fdrupal%2Fvendor%2Fsymfony%2Fhttp-foundation%2FFile%2FMimeType%2FFileBinaryMimeTypeGuesser.php%22%3Bs%3A4%3A%22line%22%3Bi%3A18%3B%7D%7D',
'X-Drupal-Assertion-2' => 'a%3A3%3A%7Bi%3A0%3BO%3A25%3A%22Drupal%5CCore%5CRender%5CMarkup%22%3A1%3A%7Bs%3A9%3A%22%00%2A%00string%22%3Bs%3A177%3A%22The%20%22Symfony%5CComponent%5CHttpFoundation%5CFile%5CMimeType%5CFileinfoMimeTypeGuesser%22%20class%20is%20deprecated%20since%20Symfony%204.3%2C%20use%20%22Symfony%5CComponent%5CMime%5CFileinfoMimeTypeGuesser%22%20instead.%22%3B%7Di%3A1%3Bs%3A24%3A%22User%20deprecated%20function%22%3Bi%3A2%3Ba%3A3%3A%7Bs%3A8%3A%22function%22%3Bs%3A9%3A%22include%28%29%22%3Bs%3A4%3A%22file%22%3Bs%3A93%3A%22%2Fvar%2Fwww%2Fhtml%2Fdrupal%2Fvendor%2Fsymfony%2Fhttp-foundation%2FFile%2FMimeType%2FFileinfoMimeTypeGuesser.php%22%3Bs%3A4%3A%22line%22%3Bi%3A18%3B%7D%7D',
'Cache-Control' => 'must-revalidate, no-cache, private',
'X-UA-Compatible' => 'IE=edge',
'Content-language' => 'en',
'X-Content-Type-Options' => 'nosniff',
'X-Frame-Options' => 'SAMEORIGIN',
'Permissions-Policy' => 'interest-cohort=()',
'Expires' => 'Sun, 19 Nov 1978 05:00:00 GMT',
'X-Generator' => 'Drupal 9 (https://www.drupal.org)',
'Content-Length' => '4717',
'Connection' => 'close',
'Content-Type' => 'text/html; charset=UTF-8',
)

@alxp
Copy link
Contributor Author

alxp commented Mar 10, 2022

Exception is being thrown from this function in the File Hash module:

function filehash_merge(FileInterface $file) {
  Drupal::database()
    ->merge('filehash')
    ->key(['fid' => $file->id()])
    ->fields($file->filehash)
    ->execute();
}

@alxp
Copy link
Contributor Author

alxp commented Mar 14, 2022

File Hash is adding an empty array to the 'fylehash' field but only when called by the unit test. If I add the same file using the GUI File Hash behaves normally. Rolling back from version 1.9 to 1.5 of fylehash doesn't change this.

@alxp
Copy link
Contributor Author

alxp commented Mar 16, 2022

Forced downgrade to Drupal 9.2, test still fails with the same error.

@alxp
Copy link
Contributor Author

alxp commented Mar 17, 2022

This seems to be a bug in the FIleHash module, but one that's hard to reproduce

FileHash is calling the global config service to get the active hashing algorithms, but when this is called from the test it's getting back an empty array. This is then causing FileHash to return an empty array that it tries to insert into the database, which results in the SQL syntax error.

Will try to make a minimal reproducing test to post to the module's bug queue and come up with a patch in the mean time.

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Development

No branches or pull requests

1 participant