public search ( ) : CActiveDataProvider | ||
Résultat | CActiveDataProvider | the data provider that can return the models based on the search/filter conditions. |
public function search()
{
// Warning: Please modify the following code to remove attributes that
// should not be searched.
$criteria = new CDbCriteria();
$criteria->compare('id', $this->id, true);
$criteria->compare('fully_specified_name', $this->fully_specified_name, true);
$criteria->compare('term', $this->term, true);
return new CActiveDataProvider(get_class($this), array('criteria' => $criteria));
}
/** * @dataProvider dataProvider_Search */ public function testSearch_WithValidTerms_ReturnsExpectedResults($searchTerms, $numResults, $expectedKeys) { $this->model->setAttributes($searchTerms); $results = $this->model->search(); $data = $results->getData(); $expectedResults = array(); if (!empty($expectedKeys)) { foreach ($expectedKeys as $key) { $expectedResults[] = $this->disorders($key); } } $this->assertEquals($numResults, $results->getItemCount()); $this->assertEquals($expectedResults, $data); }