Loading core/tests/Drupal/FunctionalTests/Entity/RevisionRevertFormTest.php +19 −9 Original line number Diff line number Diff line Loading @@ -43,6 +43,19 @@ protected function setUp(): void { $this->drupalPlaceBlock('page_title_block'); } /** * Test form revision revert. */ public function testFormRevisionRevert(): void { foreach (self::providerPageTitle() as $page_title) { $this->testPageTitle($page_title[0], $page_title[1]); } $this->testAccessRevertLatestDefault(); $this->testAccessRevertLatestForwardRevision(); $this->testAccessRevertNonLatest(); $this->testPrepareRevision(); } /** * Tests title by whether entity supports revision creation dates. * Loading @@ -50,11 +63,8 @@ protected function setUp(): void { * The entity type to test. * @param string $expectedQuestion * The expected question/page title. * * @covers ::getQuestion * @dataProvider providerPageTitle */ public function testPageTitle(string $entityTypeId, string $expectedQuestion): void { protected function testPageTitle(string $entityTypeId, string $expectedQuestion): void { /** @var \Drupal\Core\Entity\RevisionableStorageInterface $storage */ $storage = \Drupal::entityTypeManager()->getStorage($entityTypeId); Loading Loading @@ -88,7 +98,7 @@ public function testPageTitle(string $entityTypeId, string $expectedQuestion): v /** * Data provider for testPageTitle. */ public static function providerPageTitle(): array { protected static function providerPageTitle(): array { return [ ['entity_test_rev', 'Are you sure you want to revert the revision?'], ['entity_test_revlog', 'Are you sure you want to revert to the revision from Sun, 01/11/2009 - 16:00?'], Loading @@ -100,7 +110,7 @@ public static function providerPageTitle(): array { * * @covers \Drupal\Core\Entity\EntityAccessControlHandler::checkAccess */ public function testAccessRevertLatestDefault(): void { protected function testAccessRevertLatestDefault(): void { /** @var \Drupal\entity_test\Entity\EntityTestRev $entity */ $entity = EntityTestRev::create(); $entity->setName('revert'); Loading @@ -119,7 +129,7 @@ public function testAccessRevertLatestDefault(): void { * * @covers \Drupal\Core\Entity\EntityAccessControlHandler::checkAccess */ public function testAccessRevertLatestForwardRevision(): void { protected function testAccessRevertLatestForwardRevision(): void { /** @var \Drupal\entity_test\Entity\EntityTestRev $entity */ $entity = EntityTestRevPub::create(); $entity->setName('revert'); Loading @@ -143,7 +153,7 @@ public function testAccessRevertLatestForwardRevision(): void { * * @covers \Drupal\Core\Entity\EntityAccessControlHandler::checkAccess */ public function testAccessRevertNonLatest(): void { protected function testAccessRevertNonLatest(): void { /** @var \Drupal\entity_test\Entity\EntityTestRev $entity */ $entity = EntityTestRev::create(); $entity->setName('revert'); Loading Loading @@ -276,7 +286,7 @@ public static function providerSubmitForm(): array { * * @covers ::prepareRevision */ public function testPrepareRevision(): void { protected function testPrepareRevision(): void { $user = $this->createUser(); $this->drupalLogin($user); Loading Loading
core/tests/Drupal/FunctionalTests/Entity/RevisionRevertFormTest.php +19 −9 Original line number Diff line number Diff line Loading @@ -43,6 +43,19 @@ protected function setUp(): void { $this->drupalPlaceBlock('page_title_block'); } /** * Test form revision revert. */ public function testFormRevisionRevert(): void { foreach (self::providerPageTitle() as $page_title) { $this->testPageTitle($page_title[0], $page_title[1]); } $this->testAccessRevertLatestDefault(); $this->testAccessRevertLatestForwardRevision(); $this->testAccessRevertNonLatest(); $this->testPrepareRevision(); } /** * Tests title by whether entity supports revision creation dates. * Loading @@ -50,11 +63,8 @@ protected function setUp(): void { * The entity type to test. * @param string $expectedQuestion * The expected question/page title. * * @covers ::getQuestion * @dataProvider providerPageTitle */ public function testPageTitle(string $entityTypeId, string $expectedQuestion): void { protected function testPageTitle(string $entityTypeId, string $expectedQuestion): void { /** @var \Drupal\Core\Entity\RevisionableStorageInterface $storage */ $storage = \Drupal::entityTypeManager()->getStorage($entityTypeId); Loading Loading @@ -88,7 +98,7 @@ public function testPageTitle(string $entityTypeId, string $expectedQuestion): v /** * Data provider for testPageTitle. */ public static function providerPageTitle(): array { protected static function providerPageTitle(): array { return [ ['entity_test_rev', 'Are you sure you want to revert the revision?'], ['entity_test_revlog', 'Are you sure you want to revert to the revision from Sun, 01/11/2009 - 16:00?'], Loading @@ -100,7 +110,7 @@ public static function providerPageTitle(): array { * * @covers \Drupal\Core\Entity\EntityAccessControlHandler::checkAccess */ public function testAccessRevertLatestDefault(): void { protected function testAccessRevertLatestDefault(): void { /** @var \Drupal\entity_test\Entity\EntityTestRev $entity */ $entity = EntityTestRev::create(); $entity->setName('revert'); Loading @@ -119,7 +129,7 @@ public function testAccessRevertLatestDefault(): void { * * @covers \Drupal\Core\Entity\EntityAccessControlHandler::checkAccess */ public function testAccessRevertLatestForwardRevision(): void { protected function testAccessRevertLatestForwardRevision(): void { /** @var \Drupal\entity_test\Entity\EntityTestRev $entity */ $entity = EntityTestRevPub::create(); $entity->setName('revert'); Loading @@ -143,7 +153,7 @@ public function testAccessRevertLatestForwardRevision(): void { * * @covers \Drupal\Core\Entity\EntityAccessControlHandler::checkAccess */ public function testAccessRevertNonLatest(): void { protected function testAccessRevertNonLatest(): void { /** @var \Drupal\entity_test\Entity\EntityTestRev $entity */ $entity = EntityTestRev::create(); $entity->setName('revert'); Loading Loading @@ -276,7 +286,7 @@ public static function providerSubmitForm(): array { * * @covers ::prepareRevision */ public function testPrepareRevision(): void { protected function testPrepareRevision(): void { $user = $this->createUser(); $this->drupalLogin($user); Loading