/** * Tests the menu of choices search function. * * @dataProvider menuofchoicesfilter_respond_dataprovider */ public function test_filter_menuofchoices_respond($filterdata, $expectedresponse) { global $DB; $expectedresponse = safe_json_encode($expectedresponse); $name = 'menu'; $label = 'Menu Of Choices'; $dataurl = 'test.php'; $filter = new deepsight_filter_menuofchoices($DB, $name, $label, array(), $dataurl); // Test setting/getting choices. $choices = array('Apple', 'Banana', 'Carrot', 'Deli'); $filter->set_choices($choices); $_POST['val'] = $filterdata; $response = $filter->respond_to_js(); $this->assertEquals($expectedresponse, $response); }