/** * Tests the toUrl() method with a URI callback. * * @param array $bundle_info * An array of bundle info to register. * @param string $uri_callback * The entity type URI callback to register. * * @covers ::toUrl * @covers ::linkTemplates * * @dataProvider providerTestToUrlUriCallback */ public function testToUrlUriCallback(array $bundle_info, $uri_callback) { $entity = $this->getEntity(Entity::class, ['id' => $this->entityId, 'langcode' => $this->langcode]); $this->registerBundleInfo($bundle_info); $this->entityType->getUriCallback()->willReturn($uri_callback); /** @var \Drupal\Core\Url $url */ $url = $entity->toUrl('canonical'); $this->assertUrl('<none>', [], $entity, TRUE, $url); }