diff --git a/search/filters/SubstringFilter.php b/search/filters/SubstringFilter.php index 2c8e7df14..6d796cac3 100755 --- a/search/filters/SubstringFilter.php +++ b/search/filters/SubstringFilter.php @@ -6,11 +6,16 @@ /** * Uses a substring match against content in column rows. + * @deprecated Use PartialMatchFilter instead * * @package sapphire * @subpackage search */ -class SubstringFilter extends SearchFilter { +class SubstringFilter extends PartialMatchFilter { + function __construct($fullName, $value = false) { + Deprecation::notice('3.0', 'PartialMatchFilter instead.'); + SearchFilter::__construct($fullName, $value); + } public function apply(DataQuery $query) { $this->model = $query->applyRelation($this->relation); diff --git a/tests/model/DataListTest.php b/tests/model/DataListTest.php index beea23d05..6bc70ed58 100755 --- a/tests/model/DataListTest.php +++ b/tests/model/DataListTest.php @@ -326,14 +326,6 @@ class DataListTest extends SapphireTest { $this->assertEquals('Bob', $list->first()->Name, 'First comment should be from Bob'); } - public function testSimpleFilterSubstring() { - $list = DataList::create("DataObjectTest_TeamComment"); - $list->filter('Comment:SubString', 'team comment'); - $this->assertEquals(2, $list->count()); - $this->assertEquals('Joe', $list->first()->Name, 'First comment should be from Bob'); - $this->assertEquals('Bob', $list->last()->Name, 'First comment should be from Bob'); - } - public function testSimpleFilterWithNonExistingComparisator() { $this->setExpectedException('InvalidArgumentException'); $list = DataList::create("DataObjectTest_TeamComment"); diff --git a/tests/search/SearchContextTest.php b/tests/search/SearchContextTest.php index 9a2917c9f..cc7e0980b 100644 --- a/tests/search/SearchContextTest.php +++ b/tests/search/SearchContextTest.php @@ -253,7 +253,6 @@ class SearchContextTest_AllFilterTypes extends DataObject implements TestOnly { "ExactMatch" => "ExactMatchFilter", "PartialMatch" => "PartialMatchFilter", "Negation" => "NegationFilter", - "SubstringMatch" => "SubstringFilter", "CollectionMatch" => "ExactMatchMultiFilter", "StartsWith" => "StartsWithFilter", "EndsWith" => "EndsWithFilter",