From b43e46de17d2666d9247da0542fb3967362c3ab7 Mon Sep 17 00:00:00 2001 From: Steve Boyd Date: Wed, 9 Nov 2022 10:19:38 +1300 Subject: [PATCH] API Stop using deprecated API --- composer.json | 3 ++- .../Registry/Layout/RegistryPage.ss | 2 +- tests/RegistryPageFunctionalTest.php | 17 +++++++++++++++-- 3 files changed, 18 insertions(+), 4 deletions(-) diff --git a/composer.json b/composer.json index ae3a45a..c0728a0 100644 --- a/composer.json +++ b/composer.json @@ -25,7 +25,8 @@ }, "require-dev": { "phpunit/phpunit": "^9.5", - "squizlabs/php_codesniffer": "^3.0" + "squizlabs/php_codesniffer": "^3.0", + "silverstripe/versioned": "^1.12" }, "autoload": { "psr-4": { diff --git a/templates/SilverStripe/Registry/Layout/RegistryPage.ss b/templates/SilverStripe/Registry/Layout/RegistryPage.ss index 1ef1dde..9ee1741 100644 --- a/templates/SilverStripe/Registry/Layout/RegistryPage.ss +++ b/templates/SilverStripe/Registry/Layout/RegistryPage.ss @@ -26,7 +26,7 @@ $Content <% loop $RegistryEntries %> - + <% loop $Top.Columns($ID) %> <% if Link %>$Value<% else %>$Value<% end_if %> <% end_loop %> diff --git a/tests/RegistryPageFunctionalTest.php b/tests/RegistryPageFunctionalTest.php index ab8cd09..bcc25a3 100644 --- a/tests/RegistryPageFunctionalTest.php +++ b/tests/RegistryPageFunctionalTest.php @@ -8,6 +8,8 @@ use SilverStripe\Registry\Tests\Stub\RegistryPageTestContact; use SilverStripe\Registry\Tests\Stub\RegistryPageTestContactExtra; use SilverStripe\Registry\Tests\Stub\RegistryPageTestPage; +use SilverStripe\Security\Member; +use SilverStripe\Security\Security; class RegistryPageFunctionalTest extends FunctionalTest { @@ -22,12 +24,12 @@ class RegistryPageFunctionalTest extends FunctionalTest RegistryPageTestPage::class ]; - protected static $use_draft_site = true; - public function testUseLink() { // Page with links $page = $this->objFromFixture(RegistryPageTestPage::class, 'contact-registrypage-extra'); + $page->publishRecursive(); + $response = $this->get($page->Link()); $parser = new CSSContentParser($response->getBody()); @@ -39,6 +41,7 @@ public function testUseLink() public function testFilteredSearchResults() { $page = $this->objFromFixture(RegistryPageTestPage::class, 'contact-registrypage'); + $page->publishRecursive(); $uri = Controller::join_links( $page->RelativeLink('RegistryFilterForm'), '?' . @@ -62,6 +65,7 @@ public function testFilteredSearchResults() public function testFilteredByRelationSearchResults() { $page = $this->objFromFixture(RegistryPageTestPage::class, 'contact-registrypage-extra'); + $page->publishRecursive(); $uri = Controller::join_links( $page->RelativeLink('RegistryFilterForm'), '?' . http_build_query(array( @@ -90,6 +94,7 @@ public function testFilteredByRelationSearchResults() public function testFilteredByRelationIDSearchResults() { $page = $this->objFromFixture(RegistryPageTestPage::class, 'contact-registrypage-extra'); + $page->publishRecursive(); $uri = Controller::join_links( $page->RelativeLink('RegistryFilterForm'), '?' . http_build_query(array( @@ -119,6 +124,7 @@ public function testFilteredByRelationIDSearchResults() public function testUserCustomSummaryField() { $page = $this->objFromFixture(RegistryPageTestPage::class, 'contact-registrypage-extra'); + $page->publishRecursive(); $response = $this->get($page->Link()); $parser = new CSSContentParser($response->getBody()); @@ -133,6 +139,7 @@ public function testUserCustomSummaryField() public function testSearchResultsLimitAndStart() { $page = $this->objFromFixture(RegistryPageTestPage::class, 'contact-registrypage-limit'); + $page->publishRecursive(); $uri = Controller::join_links( $page->RelativeLink('RegistryFilterForm'), '?' . http_build_query(array( @@ -162,6 +169,7 @@ public function testSearchResultsLimitAndStart() public function testGetParamsPopulatesSearchForm() { $page = $this->objFromFixture(RegistryPageTestPage::class, 'contact-registrypage'); + $page->publishRecursive(); $uri = Controller::join_links( $page->RelativeLink('RegistryFilterForm'), '?' . http_build_query(array( @@ -186,6 +194,7 @@ public function testGetParamsPopulatesSearchForm() public function testQueryLinks() { $page = $this->objFromFixture(RegistryPageTestPage::class, 'contact-registrypage'); + $page->publishRecursive(); $uri = Controller::join_links( $page->RelativeLink('RegistryFilterForm'), '?' . http_build_query(array( @@ -210,6 +219,7 @@ public function testShowExistingRecord() { $record = $this->objFromFixture(RegistryPageTestContact::class, 'alexander'); $page = $this->objFromFixture(RegistryPageTestPage::class, 'contact-registrypage'); + $page->publishRecursive(); $response = $this->get(Controller::join_links($page->RelativeLink(), 'show', $record->ID)); $this->assertStringContainsString('Alexander Bernie', $response->getBody()); @@ -225,6 +235,7 @@ public function testPageNotFoundNonExistantRecord() public function testColumnName() { $page = $this->objFromFixture(RegistryPageTestPage::class, 'contact-registrypage'); + $page->publishRecursive(); $uri = Controller::join_links( $page->RelativeLink('RegistryFilterForm'), '?' . http_build_query(array( @@ -243,6 +254,7 @@ public function testColumnName() public function testSortableColumns() { $page = $this->objFromFixture(RegistryPageTestPage::class, 'contact-registrypage-extra'); + $page->publishRecursive(); $response = $this->get($page->Link()); $parser = new CSSContentParser($response->getBody()); $columns = $parser->getBySelector('table.results thead tr th'); @@ -257,6 +269,7 @@ public function testSortableColumns() public function testExportLink() { $page = $this->objFromFixture(RegistryPageTestPage::class, 'contact-registrypage'); + $page->publishRecursive(); $uri = Controller::join_links( $page->RelativeLink('RegistryFilterForm'), '?' . http_build_query(array(