function EntityUrlTest::assertUrl
Same name in other branches
- 8.9.x core/tests/Drupal/Tests/Core/Entity/EntityUrlTest.php \Drupal\Tests\Core\Entity\EntityUrlTest::assertUrl()
- 10 core/tests/Drupal/Tests/Core/Entity/EntityUrlTest.php \Drupal\Tests\Core\Entity\EntityUrlTest::assertUrl()
- 11.x core/tests/Drupal/Tests/Core/Entity/EntityUrlTest.php \Drupal\Tests\Core\Entity\EntityUrlTest::assertUrl()
Asserts that a given URL object matches the expectations.
@internal
Parameters
string $expected_route_name: The expected route name of the generated URL.
array $expected_route_parameters: The expected route parameters of the generated URL.
\Drupal\Core\Entity\Entity|\PHPUnit\Framework\MockObject\MockObject $entity: The entity that is expected to be set as a URL option.
bool $has_language: Whether or not the URL is expected to have a language option.
\Drupal\Core\Url $url: The URL option to make the assertions on.
5 calls to EntityUrlTest::assertUrl()
- EntityUrlTest::testToUrlLinkTemplateAddForm in core/
tests/ Drupal/ Tests/ Core/ Entity/ EntityUrlTest.php - Tests the toUrl() method with the 'revision' link template.
- EntityUrlTest::testToUrlLinkTemplateNoId in core/
tests/ Drupal/ Tests/ Core/ Entity/ EntityUrlTest.php - Tests the toUrl() method with link templates without an entity ID.
- EntityUrlTest::testToUrlLinkTemplateRevision in core/
tests/ Drupal/ Tests/ Core/ Entity/ EntityUrlTest.php - Tests the toUrl() method with the 'revision' link template.
- EntityUrlTest::testToUrlLinkTemplates in core/
tests/ Drupal/ Tests/ Core/ Entity/ EntityUrlTest.php - Tests the toUrl() method with simple link templates.
- EntityUrlTest::testToUrlUriCallback in core/
tests/ Drupal/ Tests/ Core/ Entity/ EntityUrlTest.php - Tests the toUrl() method with a URI callback.
File
-
core/
tests/ Drupal/ Tests/ Core/ Entity/ EntityUrlTest.php, line 466
Class
- EntityUrlTest
- Tests URL handling of the \Drupal\Core\Entity\EntityBase class.
Namespace
Drupal\Tests\Core\EntityCode
protected function assertUrl(string $expected_route_name, array $expected_route_parameters, $entity, bool $has_language, Url $url) : void {
$this->assertEquals($expected_route_name, $url->getRouteName());
$this->assertEquals($expected_route_parameters, $url->getRouteParameters());
$this->assertEquals($this->entityTypeId, $url->getOption('entity_type'));
$this->assertEquals($entity, $url->getOption('entity'));
if ($has_language) {
$this->assertEquals($this->langcode, $url->getOption('language')
->getId());
}
else {
$this->assertNull($url->getOption('language'));
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.