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) { $audit = new Audit(); $audit->setAttributes($searchTerms); $results = $audit->search(); $data = $results->getData(); $expectedResults = array(); if (!empty($expectedKeys)) { foreach ($expectedKeys as $key) { $expectedResults[] = $this->audit($key); } } $this->assertEquals($numResults, $results->getItemCount()); $this->assertEquals($expectedResults, array('0' => $data[0])); }