Exemplo n.º 1
0
 public function testSearchUser()
 {
     //add a user for search testing
     $class = new \CB\UsersGroups();
     $data = $class->addUser(['name' => 'searchtest', 'first_name' => 'Search', 'last_name' => 'Test', 'email' => '*****@*****.**']);
     $_SESSION['user']['id'] = $data['data']['id'];
     $datas = Data\Providers::searchQueriesData();
     $search = new \CB\Api\Search();
     foreach ($datas as $data) {
         $result = $search->query($data[0]['query']);
         $this->assertArraySubset($data[0]['result'], $result);
     }
     $_SESSION['user']['id'] = 1;
 }
 /**
  *  create an user with given data
  * @return int user id
  */
 public function createUser($data)
 {
     $class = new \CB\UsersGroups();
     $data = $class->addUser($data);
     return $data['data']['id'];
 }