From 4f4153c834a6628a7a738d95916734f93a0b03c9 Mon Sep 17 00:00:00 2001 From: Sam Minnee Date: Sat, 10 Nov 2018 12:42:35 +1300 Subject: [PATCH] MINOR: Test test to validate that multiple GreaterThan filters in a filterAny work. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Confirms https://github.com/silverstripe/silverstripe-framework/issues/3995 isn’t a bug. --- tests/php/ORM/DataListTest.php | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/tests/php/ORM/DataListTest.php b/tests/php/ORM/DataListTest.php index baecfeaf7..a00290c3f 100755 --- a/tests/php/ORM/DataListTest.php +++ b/tests/php/ORM/DataListTest.php @@ -11,6 +11,7 @@ use SilverStripe\ORM\DB; use SilverStripe\ORM\Filterable; use SilverStripe\ORM\Filters\ExactMatchFilter; use SilverStripe\Dev\SapphireTest; +use SilverStripe\ORM\Tests\DataObjectTest\Fixture; use SilverStripe\ORM\Tests\DataObjectTest\Bracket; use SilverStripe\ORM\Tests\DataObjectTest\EquipmentCompany; use SilverStripe\ORM\Tests\DataObjectTest\Fan; @@ -940,6 +941,27 @@ class DataListTest extends SapphireTest $this->assertCount(4, $list); } + public function testFilterAnyWithTwoGreaterThanFilters() + { + + for ($i=1; $i<=3; $i++) { + $f = new Fixture(); + $f->MyDecimal = $i; + $f->write(); + + $f = new Fixture(); + $f->MyInt = $i; + $f->write(); + } + + $list = Fixture::get()->filterAny([ + 'MyDecimal:GreaterThan' => 1, // 2 records + 'MyInt:GreaterThan' => 2, // 1 record + ]); + + $this->assertCount(3, $list); + } + public function testFilterAnyMultipleArray() { $list = TeamComment::get();