function TemplateProjectTestBase::makePackageManagerTestApiRequest

Gets a /package-manager-test-api response.

Parameters

string $url: The package manager test API URL to fetch.

array $query_data: The query data.

4 calls to TemplateProjectTestBase::makePackageManagerTestApiRequest()
PackageInstallDirectWriteTest::testPackageInstall in core/modules/package_manager/tests/src/Build/PackageInstallDirectWriteTest.php
Tests installing packages in a stage directory.
PackageInstallSubmoduleTest::testSubModules in core/modules/package_manager/tests/src/Build/PackageInstallSubmoduleTest.php
Tests installing a Drupal submodule.
PackageInstallTest::testPackageInstall in core/modules/package_manager/tests/src/Build/PackageInstallTest.php
Tests installing packages in a stage directory.
PackageUpdateTest::testPackageUpdate in core/modules/package_manager/tests/src/Build/PackageUpdateTest.php
Tests updating packages in a stage directory.

File

core/modules/package_manager/tests/src/Build/TemplateProjectTestBase.php, line 710

Class

TemplateProjectTestBase
Base class for tests which create a test site from a core project template.

Namespace

Drupal\Tests\package_manager\Build

Code

protected function makePackageManagerTestApiRequest(string $url, array $query_data) : void {
  $url .= '?' . http_build_query($query_data);
  $this->visit($url);
  $session = $this->getMink()
    ->getSession();
  // Ensure test failures provide helpful debug output when there's a fatal
  // PHP error: don't use \Behat\Mink\WebAssert::statusCodeEquals().
  $message = sprintf("Error response: %s\n\nHeaders: %s\n\nServer error log: %s", $session->getPage()
    ->getContent(), var_export($session->getResponseHeaders(), TRUE), $this->serverErrorLog);
  $this->assertSame(200, $session->getStatusCode(), $message);
  // Sometimes we get a 200 response after a PHP timeout or OOM error, so we
  // also check the page content to ensure it's what we expect.
  $this->assertSame('Finished', $session->getPage()
    ->getText());
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.