Retrieves a list of models based on the current search/filter conditions.
public search ( ) : CActiveDataProvider | ||
return | CActiveDataProvider | the data provider that can return the models based on the search/filter conditions. |
/** * @dataProvider dataProvider_Search */ public function testSearch_WithValidTerms_ReturnsExpectedResults($searchTerms, $numResults, $expectedKeys) { $allergy = new Allergy(); $allergy->setAttributes($searchTerms); $allergyresults = $allergy->search(); $allergydata = $allergyresults->getData(); $expectedResults = array(); if (!empty($expectedKeys)) { foreach ($expectedKeys as $key) { $expectedResults[] = $this->allergy($key); } } $this->assertEquals($numResults, $allergyresults->getItemCount()); $this->assertEquals($expectedResults, $allergydata); }