Issue #3285230 by xjm, benjifisher, phenaproxima, mikelutz, quietone: Migrate's DownloadFunctionalTest:: testExceptionThrow() is failing on guzzlehttp/psr7 2.3.0
parent
740a7a8004
commit
c668a90a3f
|
@ -76,8 +76,11 @@ class DownloadFunctionalTest extends BrowserTestBase {
|
||||||
$this->assertCount(1, $messages);
|
$this->assertCount(1, $messages);
|
||||||
$message = reset($messages);
|
$message = reset($messages);
|
||||||
|
|
||||||
|
// Assert critical parts of the error message, but not the exact message,
|
||||||
|
// since it depends on Guzzle's internal implementation of PSR-7.
|
||||||
$id = $migration->getPluginId();
|
$id = $migration->getPluginId();
|
||||||
$this->assertEquals("$id:uri:download: Client error: `GET $invalid_url` resulted in a `404 Not Found` response ($invalid_url)", $message->message);
|
$this->assertStringContainsString("$id:uri:download:", $message->message);
|
||||||
|
$this->assertStringContainsString($invalid_url, $message->message);
|
||||||
$this->assertEquals(MigrationInterface::MESSAGE_ERROR, $message->level);
|
$this->assertEquals(MigrationInterface::MESSAGE_ERROR, $message->level);
|
||||||
|
|
||||||
// Check that the second row was migrated successfully.
|
// Check that the second row was migrated successfully.
|
||||||
|
|
|
@ -179,11 +179,14 @@ trait BrowserHtmlDebugTrait {
|
||||||
$html_output = 'Called from ' . $caller['function'] . ' line ' . $caller['line'];
|
$html_output = 'Called from ' . $caller['function'] . ' line ' . $caller['line'];
|
||||||
$html_output .= '<hr />' . $request->getMethod() . ' request to: ' . $request->getUri();
|
$html_output .= '<hr />' . $request->getMethod() . ' request to: ' . $request->getUri();
|
||||||
|
|
||||||
// Get the response body as a string. Any errors are silenced as
|
/* $var \Psr\Http\Message\StreamInterface $stream */
|
||||||
// tests should not fail if there is a problem. On PHP 7.4
|
$stream = $response->getBody();
|
||||||
// \Drupal\Tests\migrate\Functional\process\DownloadFunctionalTest
|
|
||||||
// fails without the usage of a silence operator.
|
// Get the response body as a string.
|
||||||
$body = @(string) $response->getBody();
|
$body = $stream->isReadable()
|
||||||
|
? (string) $stream
|
||||||
|
: 'Response is not readable.';
|
||||||
|
|
||||||
// On redirect responses (status code starting with '3') we need
|
// On redirect responses (status code starting with '3') we need
|
||||||
// to remove the meta tag that would do a browser refresh. We
|
// to remove the meta tag that would do a browser refresh. We
|
||||||
// don't want to redirect developers away when they look at the
|
// don't want to redirect developers away when they look at the
|
||||||
|
|
Loading…
Reference in New Issue