mirror of
https://github.com/silverstripe/silverstripe-cms
synced 2024-10-22 08:05:56 +02:00
Merge pull request #1060 from stojg/pull/search-for-date
BUG: Narrowing site tree search to one date shows no pages
This commit is contained in:
commit
6a0366fb84
@ -153,12 +153,12 @@ abstract class CMSSiteTreeFilter extends Object {
|
||||
|
||||
case 'LastEditedFrom':
|
||||
$fromDate = new DateField(null, null, $val);
|
||||
$query = $query->filter("LastEdited:GreaterThanOrEqual", $fromDate->dataValue());
|
||||
$query = $query->filter("LastEdited:GreaterThanOrEqual", $fromDate->dataValue().' 00:00:00');
|
||||
break;
|
||||
|
||||
case 'LastEditedTo':
|
||||
$toDate = new DateField(null, null, $val);
|
||||
$query = $query->filter("LastEdited:LessThanOrEqual", $toDate->dataValue());
|
||||
$query = $query->filter("LastEdited:LessThanOrEqual", $toDate->dataValue().' 23:59:59');
|
||||
break;
|
||||
|
||||
case 'ClassName':
|
||||
|
@ -114,7 +114,19 @@ class CMSSiteTreeFilterTest extends SapphireTest {
|
||||
$f = new CMSSiteTreeFilter_StatusDraftPages();
|
||||
$draftPage->delete();
|
||||
$this->assertEmpty($f->isPageIncluded($draftPage));
|
||||
}
|
||||
}
|
||||
|
||||
public function testDateFromToLastSameDate() {
|
||||
$draftPage = $this->objFromFixture('Page', 'page4');
|
||||
// Grab the date
|
||||
$date = substr($draftPage->LastEdited, 0, 10);
|
||||
// Filter with that date
|
||||
$filter = New CMSSiteTreeFilter_Search(array(
|
||||
'LastEditedFrom' => $date,
|
||||
'LastEditedTo' => $date
|
||||
));
|
||||
$this->assertTrue($filter->isPageIncluded($draftPage), 'Using the same date for from and to should show find that page');
|
||||
}
|
||||
|
||||
public function testStatusRemovedFromDraftFilter() {
|
||||
$removedDraftPage = $this->objFromFixture('Page', 'page6');
|
||||
|
Loading…
Reference in New Issue
Block a user