/** * Lists all models. */ public function actionIndex() { // Check that user is authorized to perform this action $this->checkAuthorization(null); $model = new Bug('search'); if (isset($_GET['q'])) { $model->filter = $_GET['q']; if (isset($_GET['status'])) { $model->bugStatusFilter = $_GET['status']; } } else { if (isset($_POST['Bug'])) { // Advanced search $model->isAdvancedSearch = true; // Fill form with data $model->attributes = $_POST['Bug']; } } $dataProvider = $model->search(); $this->render('index', array('dataProvider' => $dataProvider, 'model' => $model)); }
public function testAdvancedSearch() { // Login as root $model = new LoginForm('RegularLogin'); $model->username = "******"; $model->password = "******"; $this->assertTrue($model->login()); // Test advanced search $bug = new Bug('search'); $bug->isAdvancedSearch = true; $bug->status = Bug::STATUS_NEW; $bug->reported_by = 'root'; $bug->createdFrom = 1234567; $bug->createdTo = 123456789; $dataProvider = $bug->search(); $this->assertTrue(count($dataProvider->data) == 0); }