httpKernelHandle example

$route = $route_provider->getRouteByName('entity.entity_test_mul.delete_form');
    $this->assertEquals('entity_test_mul.delete', $route->getDefault('_entity_form'));
    $this->assertEquals('\Drupal\Core\Entity\Controller\EntityController::deleteTitle', $route->getDefault('_title_callback'));
    $this->assertEquals('entity_test_mul.delete', $route->getRequirement('_entity_access'));
    $this->assertFalse($route->hasOption('_admin_route'));

    $entity = EntityTestMul::create([
      'name' => 'Test title',
    ]);
    $entity->save();

    $this->setRawContent($this->httpKernelHandle($entity->toUrl()->toString()));
    $this->assertTitle('Test title | ');

    $this->setRawContent($this->httpKernelHandle($entity->toUrl('edit-form')->toString()));
    $this->assertTitle('Edit Test title | ');

    $this->setRawContent($this->httpKernelHandle($entity->toUrl('delete-form')->toString()));
    $this->assertTitle('Are you sure you want to delete the test entity - data table Test title? | ');
  }

  /** * @covers \Drupal\Core\Entity\Routing\AdminHtmlRouteProvider::getEditFormRoute * @covers \Drupal\Core\Entity\Routing\AdminHtmlRouteProvider::getDeleteFormRoute */
Home | Imprint | This part of the site doesn't use cookies.