function UrlTest::getRequestConstraint

Same name in other branches
  1. 9 core/tests/Drupal/Tests/Core/UrlTest.php \Drupal\Tests\Core\UrlTest::getRequestConstraint()

This constraint checks whether a Request object has the right path.

Parameters

string $path: The path.

Return value

\PHPUnit\Framework\Constraint\Callback The constraint checks whether a Request object has the right path.

File

core/tests/Drupal/Tests/Core/UrlTest.php, line 166

Class

UrlTest
@coversDefaultClass \Drupal\Core\Url @group UrlTest

Namespace

Drupal\Tests\Core

Code

protected function getRequestConstraint($path) {
    return $this->callback(function (Request $request) use ($path) {
        return $request->getPathInfo() == $path;
    });
}

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