public function testUserTypeahead_ExcludeProject_UserExcluded() { $environ = new MongoTestEnvironment(); $environ->clean(); $userId = $environ->createUser('projectuser', 'Project User', '*****@*****.**'); $project = $environ->createProject(SF_TESTPROJECT, SF_TESTPROJECTCODE); $projectId = $project->id->asString(); $user = new UserModel($userId); $user->addProject($projectId); $user->write(); $environ->createUser('someuser', 'Some User', '*****@*****.**'); $environ->createUser('anotheruser', 'Another User', '*****@*****.**'); $model = new UserTypeaheadModel('', $projectId, $environ->website); $model->read(); $this->assertEquals(2, $model->count); $this->assertNotNull($model->entries); $this->assertEquals('Some User', $model->entries[0]['name']); $this->assertEquals('Another User', $model->entries[1]['name']); $model = new UserTypeaheadModel('Some', $projectId, $environ->website); $model->read(); $this->assertEquals(1, $model->count); $this->assertNotNull($model->entries); $this->assertEquals('Some User', $model->entries[0]['name']); }
/** * @param string $term * @param string $projectIdToExclude * @param Website website * @return UserTypeaheadModel */ public static function userTypeaheadList($term, $projectIdToExclude = '', $website) { $list = new UserTypeaheadModel($term, $projectIdToExclude, $website); $list->read(); return $list; }