API CHANGE: Deprecate SubstringFilter in favour of PartialMatchFilter.

This commit is contained in:
Sam Minnee 2011-12-17 16:29:02 +13:00
parent 9bf247cc33
commit 5a157a6365
3 changed files with 6 additions and 10 deletions

View File

@ -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);

View File

@ -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");

View File

@ -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",