
| Current Path : /var/www/html/stolberg/web/core/tests/Drupal/FunctionalTests/Entity/ |
Linux ift1.ift-informatik.de 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64 |
| Current File : /var/www/html/stolberg/web/core/tests/Drupal/FunctionalTests/Entity/RevisionRouteProviderTest.php |
<?php
declare(strict_types=1);
namespace Drupal\FunctionalTests\Entity;
use Drupal\entity_test\Entity\EntityTestRev;
use Drupal\Tests\BrowserTestBase;
/**
* Tests revision route provider.
*
* @group Entity
* @coversDefaultClass \Drupal\Core\Entity\Routing\RevisionHtmlRouteProvider
*/
class RevisionRouteProviderTest extends BrowserTestBase {
/**
* {@inheritdoc}
*/
protected $defaultTheme = 'stark';
/**
* {@inheritdoc}
*/
protected static $modules = [
'block',
'entity_test',
];
/**
* {@inheritdoc}
*/
protected function setUp(): void {
parent::setUp();
$this->drupalPlaceBlock('page_title_block');
}
/**
* Tests title is from revision in context.
*/
public function testRevisionTitle(): void {
$entity = EntityTestRev::create();
$entity
->setName('first revision, view revision')
->setNewRevision();
$entity->save();
$revisionId = $entity->getRevisionId();
// A default revision is created to ensure it is not pulled from the
// non-revision entity parameter.
$entity
->setName('second revision, view revision')
->setNewRevision();
$entity->isDefaultRevision(TRUE);
$entity->save();
// Reload the object.
/** @var \Drupal\Core\Entity\RevisionableStorageInterface $storage */
$storage = \Drupal::entityTypeManager()->getStorage('entity_test_rev');
$revision = $storage->loadRevision($revisionId);
$this->drupalGet($revision->toUrl('revision'));
$this->assertSession()->responseContains('first revision');
$this->assertSession()->responseNotContains('second revision');
}
}