mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
b5776e0438
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@60207 467b73ca-7a2a-4603-9d3b-597d59a354a9
35 lines
800 B
PHP
35 lines
800 B
PHP
<?php
|
|
|
|
class SearchContextTest extends SapphireTest {
|
|
static $fixture_file = 'sapphire/tests/SearchContextTest.yml';
|
|
|
|
function testResultSetFilterReturnsExpectedCount() {
|
|
$person = singleton('PersonBubble');
|
|
$context = $person->getDefaultSearchContext();
|
|
|
|
$results = $context->getResultSet(array('Name'=>''));
|
|
$this->assertEquals(5, $results->Count());
|
|
|
|
$results = $context->getResultSet(array('EyeColor'=>'green'));
|
|
$this->assertEquals(2, $results->Count());
|
|
|
|
$results = $context->getResultSet(array('EyeColor'=>'green', 'HairColor'=>'black'));
|
|
$this->assertEquals(1, $results->Count());
|
|
}
|
|
|
|
//function
|
|
|
|
}
|
|
|
|
class PersonBubble extends DataObject {
|
|
|
|
static $db = array(
|
|
"Name" => "Text",
|
|
"Email" => "Text",
|
|
"HairColor" => "Text",
|
|
"EyeColor" => "Text"
|
|
);
|
|
|
|
}
|
|
|
|
?>
|