Problem/Motivation
Following #3374405: Allow upload of zipped hospital price file the tests fail on d.o.
Drupal\Tests\hospital_price_transparency\Functional\HospitalPriceTransparencyTest
exception: [Other] Line 0 of sites/default/files/simpletest/phpunit-3.xml:
PHPUnit Test failed to complete; Error: PHPUnit 9.6.8 by Sebastian Bergmann and contributors.
Testing Drupal\Tests\hospital_price_transparency\Functional\HospitalPriceTransparencyTest
E 1 / 1 (100%)
Time: 00:03.092, Memory: 4.00 MB
There was 1 error:
1) Drupal\Tests\hospital_price_transparency\Functional\HospitalPriceTransparencyTest::testHospitalPriceTransparency
Behat\Mink\Exception\ExpectationException: Current response status code is 500, but 200 expected.
/var/www/html/vendor/behat/mink/src/WebAssert.php:794
/var/www/html/vendor/behat/mink/src/WebAssert.php:130
/var/www/html/modules/contrib/hospital_price_transparency/tests/src/Functional/HospitalPriceTransparencyTest.php:139
/var/www/html/vendor/phpunit/phpunit/src/Framework/TestResult.php:728
I found the browser output from Jenkins and the error looks like this:
Called from GuzzleHttp\Promise\FulfilledPromise::GuzzleHttp\Promise\{closure}() line 48
GET request to: http://php-apache-jenkins-drupal-contrib-719294/subdirectory/hpt/3
The website encountered an unexpected error. Please try again later.
Symfony\Component\HttpFoundation\File\Exception\FileNotFoundException: The file "public:/file.xml" does not exist in Symfony\Component\HttpFoundation\File\File->__construct() (line 36 of vendor/symfony/http-foundation/File/File.php).
Symfony\Component\HttpFoundation\BinaryFileResponse->setFile('public:/file.xml', NULL, , 1) (Line: 52)
Symfony\Component\HttpFoundation\BinaryFileResponse->__construct('public:/file.xml') (Line: 28)
Drupal\hospital_price_transparency\Controller\HospitalPriceTransparencyController->file(Object)
call_user_func_array(Array, Array) (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 592)
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 121)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array) (Line: 97)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 166)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 74)
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: 51)
Drupal\Core\StackMiddleware\StackedHttpKernel->handle(Object, 1, 1) (Line: 704)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)
Original Report
See https://www.drupal.org/pift-ci-job/2719405
It started on 18 Jul 2023 at 21:29 CDT
Steps to reproduce
Proposed resolution
Remaining tasks
User interface changes
API changes
Data model changes
| Comment | File | Size | Author |
|---|---|---|---|
| #12 | interdiff-11-12.txt | 2.53 KB | danflanagan8 |
| #12 | hpt-failing-tests-3380067-12.patch | 4.14 KB | danflanagan8 |
| #11 | hpt-failing-tests-3380067-11.patch | 1.61 KB | danflanagan8 |
| #6 | hpt-failing-tests-3380067-6.patch | 888 bytes | danflanagan8 |
Comments
Comment #2
danflanagan8I'm not reproducing this locally.
Comment #3
danflanagan8Oh, it's because of some changes that were made to the module and tests a few days earlier (July 14). See #3374405: Allow upload of zipped hospital price file
That's probably it. I couldn't run the new tests on d.o prior to committing since there were new binary files being added.
Comment #4
danflanagan8Comment #5
danflanagan8Comment #6
danflanagan8Is this a realpath thing?
Comment #7
danflanagan8Comment #9
danflanagan8That didn't work. The error changed to this in the html output:
Comment #10
danflanagan8Oh! There's a clue I missed. :)
There's a missing slash:
public:/file.xmlThat uri gets built here:
$file->getFileUri()givespublic://xml_zip.zipand$extract_to_dirresolves aspublic:.So then
$unzipped_file_urigets built with one slash instead of a double slash. That's what needs to be fixed, but I'm not sure exactly the best way.Comment #11
danflanagan8I think this does it.
Comment #12
danflanagan8Yay!
Here's a bit more test coverage though that focuses on the uri of the extracted zip files.
Comment #13
danflanagan8Phew! I guess some servers can deal with the malformed uri? Or some zip packages can do that? Regardless, this is better. My manual testing was positive as well. Let's commit it.
Comment #15
danflanagan8