Skip to content

Commit

Permalink
Merge branch '2' into 3
Browse files Browse the repository at this point in the history
  • Loading branch information
Sabina Talipova committed Nov 21, 2022
2 parents ceec352 + 9802788 commit eba243d
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 4 deletions.
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
2 changes: 1 addition & 1 deletion templates/SilverStripe/Registry/Layout/RegistryPage.ss
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ $Content
</thead>
<tbody>
<% loop $RegistryEntries %>
<tr class="<% if FirstLast %>$FirstLast <% end_if %>$EvenOdd">
<tr class="<% if $FirstLast %>$FirstLast <% end_if %>$EvenOdd">
<% loop $Top.Columns($ID) %>
<td><% if Link %><a href="$Link">$Value</a><% else %>$Value<% end_if %></td>
<% end_loop %>
Expand Down
17 changes: 15 additions & 2 deletions tests/RegistryPageFunctionalTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand All @@ -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());

Expand All @@ -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'),
'?' .
Expand All @@ -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(
Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -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());

Expand All @@ -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(
Expand Down Expand Up @@ -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(
Expand All @@ -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(
Expand All @@ -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());
Expand All @@ -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(
Expand All @@ -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');
Expand All @@ -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(
Expand Down

0 comments on commit eba243d

Please sign in to comment.