/** * This is the default 'index' action that is invoked * when an action is not explicitly requested by users. */ public function actionIndex() { // Check if user is authorized to perform this action $this->checkAuthorization(null); // Create new model that will contain search options. $model = new DebugInfo('search'); // Fill model fields if (isset($_GET['q'])) { $model->isAdvancedSearch = false; $model->filter = $_GET['q']; } else { if (isset($_POST['DebugInfo'])) { $model->isAdvancedSearch = true; $model->attributes = $_POST['DebugInfo']; } } // Search $dataProvider = $model->search(); // Render view $this->render('index', array('dataProvider' => $dataProvider, 'model' => $model)); }
public function testAdvancedSearch() { // Login as root $loginForm = new LoginForm('RegularLogin'); $loginForm->username = "******"; $loginForm->password = "******"; $this->assertTrue($loginForm->login()); // Test advanced search $model = new DebugInfo('search'); $model->isAdvancedSearch = true; $model->status = DebugInfo::STATUS_PROCESSED; $model->guid = '6dbf5b63-6c53-4cc1-a9c4-5a97a7c66cad'; $model->dateFrom = date("m/d/Y", mktime(0, 0, 0, 4, 14, 2012)); $model->dateTo = date("m/d/Y", mktime(0, 0, 0, 4, 16, 2012)); // Perform search $dataProvider = $model->search(); // Ensure something found $this->assertTrue(count($dataProvider->data) != 0); }