diff --git a/tests/php/Controllers/CMSPageHistoryControllerTest.php b/tests/php/Controllers/CMSPageHistoryControllerTest.php index e8c5368f..c0f6fee5 100755 --- a/tests/php/Controllers/CMSPageHistoryControllerTest.php +++ b/tests/php/Controllers/CMSPageHistoryControllerTest.php @@ -4,8 +4,8 @@ namespace SilverStripe\CMS\Tests\Controllers; use Page; use SilverStripe\CMS\Controllers\CMSPageHistoryController; +use SilverStripe\CMS\Tests\Controllers\CMSPageHistoryControllerTest\HistoryController; use SilverStripe\Control\Controller; -use SilverStripe\Core\Config\Config; use SilverStripe\Core\Injector\Injector; use SilverStripe\Dev\FunctionalTest; use SilverStripe\Forms\FieldGroup; @@ -24,7 +24,11 @@ class CMSPageHistoryControllerTest extends FunctionalTest protected $versionPublishCheck2; protected $page; - public function setUp() + protected static $extra_controllers = [ + CMSPageHistoryControllerTest\HistoryController::class, + ]; + + protected function setUp() { parent::setUp(); @@ -33,9 +37,6 @@ class CMSPageHistoryControllerTest extends FunctionalTest CMSPageHistoryController::class ); - // Bump to avoid loading any customised controllers - Config::modify()->set(CMSPageHistoryController::class, 'url_priority', 50); - $this->loginWithPermission('ADMIN'); // creates a series of published, unpublished versions of a page @@ -107,7 +108,7 @@ class CMSPageHistoryControllerTest extends FunctionalTest */ public function testVersionsForm() { - $this->get('admin/pages/history/show/'. $this->page->ID); + $this->get('admin/pages/legacyhistory/show/'. $this->page->ID . '?flush'); $form = $this->cssParser()->getBySelector('#Form_VersionsForm'); $this->assertEquals(1, count($form)); @@ -125,7 +126,7 @@ class CMSPageHistoryControllerTest extends FunctionalTest public function testVersionsFormTableContainsInformation() { - $this->get('admin/pages/history/show/'. $this->page->ID); + $this->get('admin/pages/legacyhistory/show/'. $this->page->ID); $form = $this->cssParser()->getBySelector('#Form_VersionsForm'); $rows = $form[0]->xpath("fieldset/table/tbody/tr"); @@ -151,7 +152,7 @@ class CMSPageHistoryControllerTest extends FunctionalTest public function testVersionsFormSelectsUnpublishedCheckbox() { - $this->get('admin/pages/history/show/'. $this->page->ID); + $this->get('admin/pages/legacyhistory/show/'. $this->page->ID); $checkbox = $this->cssParser()->getBySelector('#Form_VersionsForm_ShowUnpublished'); $this->assertThat($checkbox[0], $this->logicalNot($this->isNull())); @@ -160,7 +161,7 @@ class CMSPageHistoryControllerTest extends FunctionalTest $this->assertThat($checked, $this->logicalNot($this->stringContains('checked'))); // viewing an unpublished - $this->get('admin/pages/history/show/'.$this->page->ID .'/'.$this->versionUnpublishedCheck); + $this->get('admin/pages/legacyhistory/show/'.$this->page->ID .'/'.$this->versionUnpublishedCheck); $checkbox = $this->cssParser()->getBySelector('#Form_VersionsForm_ShowUnpublished'); $this->assertThat($checkbox[0], $this->logicalNot($this->isNull())); diff --git a/tests/php/Controllers/CMSPageHistoryControllerTest/HistoryController.php b/tests/php/Controllers/CMSPageHistoryControllerTest/HistoryController.php new file mode 100644 index 00000000..f214f8fb --- /dev/null +++ b/tests/php/Controllers/CMSPageHistoryControllerTest/HistoryController.php @@ -0,0 +1,15 @@ +