function bug_by_search($name, $where = '', $msi_id = '0') { $seed = new Bug(); if (!$seed->ACLAccess('ListView')) { return array(); } if ($where == '') { $where = $seed->build_generic_where_clause($name); } $response = $seed->get_list("name", $where, 0); $list = $response['list']; $output_list = array(); // create a return array of names and email addresses. foreach ($list as $value) { $output_list[] = get_bean_array($value, $msi_id, 'Bug'); } return $output_list; }
public function testbuild_generic_where_clause() { $bug = new Bug(); //execute with blank parameters $expected = "bugs.name like '%'"; $actual = $bug->build_generic_where_clause(''); $this->assertSame($expected, $actual); //execute with numeric parameter $expected = "bugs.name like '1%' or bugs.bug_number like '1%'"; $actual = $bug->build_generic_where_clause(1); $this->assertSame($expected, $actual); }