mirror of
https://github.com/silverstripe/silverstripe-reports
synced 2024-10-22 11:05:53 +02:00
ENHANCEMENT Testing new File.ShowInSearch flag, and adding it to AssetTableField view
This commit is contained in:
parent
ad88e28907
commit
2693f675db
@ -194,6 +194,13 @@ class AssetTableField extends ComplexTableField {
|
|||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(!($childData instanceof Folder)) {
|
||||||
|
$mainTab->addFieldToTab(
|
||||||
|
'BottomRoot.Main',
|
||||||
|
new CheckboxField("ShowInSearch", $childData->fieldLabel('ShowInSearch'))
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
if($childData && $childData->hasMethod('BackLinkTracking')) {
|
if($childData && $childData->hasMethod('BackLinkTracking')) {
|
||||||
if(class_exists('Subsite')) Subsite::disable_subsite_filter(true);
|
if(class_exists('Subsite')) Subsite::disable_subsite_filter(true);
|
||||||
|
@ -170,7 +170,7 @@ class SearchFormTest extends FunctionalTest {
|
|||||||
$member->logOut();
|
$member->logOut();
|
||||||
}
|
}
|
||||||
|
|
||||||
function testDisabledShowInSearchFlagNotIncluded() {
|
function testDisabledShowInSearchFlagNotIncludedForSiteTree() {
|
||||||
$sf = new SearchForm($this->mockController, 'SearchForm');
|
$sf = new SearchForm($this->mockController, 'SearchForm');
|
||||||
|
|
||||||
$page = $this->objFromFixture('SiteTree', 'dontShowInSearchPage');
|
$page = $this->objFromFixture('SiteTree', 'dontShowInSearchPage');
|
||||||
@ -181,6 +181,26 @@ class SearchFormTest extends FunctionalTest {
|
|||||||
'Page with "Show in Search" disabled doesnt show'
|
'Page with "Show in Search" disabled doesnt show'
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function testDisabledShowInSearchFlagNotIncludedForFiles() {
|
||||||
|
$sf = new SearchForm($this->mockController, 'SearchForm');
|
||||||
|
|
||||||
|
$dontShowInSearchFile = $this->objFromFixture('File', 'dontShowInSearchFile');
|
||||||
|
$showInSearchFile = $this->objFromFixture('File', 'showInSearchFile');
|
||||||
|
$results = $sf->getResults(null, array('Search'=>'dontShowInSearchFile'));
|
||||||
|
$this->assertNotContains(
|
||||||
|
$dontShowInSearchFile->ID,
|
||||||
|
$results->column('ID'),
|
||||||
|
'File with "Show in Search" disabled doesnt show'
|
||||||
|
);
|
||||||
|
|
||||||
|
$results = $sf->getResults(null, array('Search'=>'showInSearchFile'));
|
||||||
|
$this->assertContains(
|
||||||
|
$showInSearchFile->ID,
|
||||||
|
$results->column('ID'),
|
||||||
|
'File with "Show in Search" enabled can be found'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
function testSearchTitleAndContentWithSpecialCharacters() {
|
function testSearchTitleAndContentWithSpecialCharacters() {
|
||||||
$sf = new SearchForm($this->mockController, 'SearchForm');
|
$sf = new SearchForm($this->mockController, 'SearchForm');
|
||||||
|
@ -33,4 +33,11 @@ SiteTree:
|
|||||||
ShowInSearch: 0
|
ShowInSearch: 0
|
||||||
pageWithSpecialChars:
|
pageWithSpecialChars:
|
||||||
Title: Brötchen
|
Title: Brötchen
|
||||||
Content: Frisch vom Bäcker
|
Content: Frisch vom Bäcker
|
||||||
|
File:
|
||||||
|
showInSearchFile:
|
||||||
|
Title: showInSearchFile
|
||||||
|
ShowInSearch: 1
|
||||||
|
dontShowInSearchFile:
|
||||||
|
Title: dontShowInSearchFile
|
||||||
|
ShowInSearch: 0
|
Loading…
Reference in New Issue
Block a user