public function FormatSpecificGetBcRouteTestTrait::testNoFormatSpecificGetBcRouteForOtherFormats in Drupal 8
@group legacy
See also
\Drupal\rest\Plugin\ResourceBase::routes
File
- core/
modules/ rest/ tests/ src/ Functional/ EntityResource/ FormatSpecificGetBcRouteTestTrait.php, line 37
Class
- FormatSpecificGetBcRouteTestTrait
- Provides test methods to assert BC on format-specific GET routes.
Namespace
Drupal\Tests\rest\Functional\EntityResourceCode
public function testNoFormatSpecificGetBcRouteForOtherFormats() {
$this
->expectException(RouteNotFoundException::class);
$this
->provisionEntityResource();
$url = $this
->getEntityResourceUrl();
// Verify no format-specific GET BC routes are created for other formats.
$other_format = static::$format === 'json' ? 'xml' : 'json';
$bc_route_other_format = Url::fromRoute('rest.entity.entity_test.GET.' . $other_format, $url
->getRouteParameters(), $url
->getOptions());
$bc_route_other_format
->setUrlGenerator($this->container
->get('url_generator'));
$bc_route_other_format
->toString(TRUE);
}