/** * @dataProvider sessionContestProvider */ public function testBadContextForRemoveContestRequest($sessionID, $contestID) { $sessionID = $sessionID == 'session_ok' ? $this->sessionID : $sessionID; $contestID = $contestID == 'contest_ok' ? $this->CDs[rand(0, sizeof($this->CDs) - 1)]->contestID : $contestID; $req = TestData::fillRequest('RemoveContestRequest', array('contestID' => $contestID, 'sessionID' => $sessionID)); $this->assertClassEquals(new RequestFailedResponse(), RequestSender::send($req)); }
protected function apiGetUsers() { $req = TestData::fillRequest('GetUsersRequest'); $req->sessionID = $this->sessionID; $req->contestID = $this->contestID; $res = RequestSender::send($req); $this->assertClassEquals(new GetUsersResponse(), $res); return $res->users; }
/** *@dataProvider pluginSideProvider */ public function testBadContextForPluginRequests($side) { $bad = array(null, '', 0, TestData::genASCIIStr(24)); foreach ($bad as $sessionID) { $req = TestData::fillRequest('AvailablePluginsRequest', array('pluginSide' => ucfirst($side), 'sessionID' => $sessionID)); $this->assertEquals(createFailRes(239), RequestSender::send($req)); $req = TestData::fillRequest('AdjustPluginRequest', array('sessionID' => $sessionID, 'side' => ucfirst($side), 'description' => TestData::genUnicodeStr(42), 'pluginAlias' => TestData::genFileName(12), 'pluginData' => TestData::genUnicodeStr(42))); $this->assertEquals(createFailRes(239), RequestSender::send($req)); $req = TestData::fillRequest('RemovePluginRequest', array('pluginAlias' => TestData::genFileName(12), 'sessionID' => $sessionID, 'side' => ucfirst($side))); $this->assertEquals(createFailRes(239), RequestSender::send($req)); $req = TestData::fillRequest('DownloadPluginRequest', array('pluginAlias' => TestData::genFileName(12), 'sessionID' => $sessionID, 'side' => ucfirst($side))); $this->assertEquals(createFailRes(239), RequestSender::send($req)); } }
/** * @dataProvider sessionUserProvider */ public function testBadContextForRemoveUserRequest($sessionID, $userID) { $sessionID = $sessionID == 'session_ok' ? $this->sessionID : $sessionID; $userID = $userID == 'user_ok' ? TestData::getRandomValue($this->curUsers)->userID : $userID; $req = TestData::fillRequest('RemoveUserRequest', array('sessionID' => $sessionID, 'userID' => $userID)); $this->assertClassEquals(new RequestFailedResponse(), RequestSender::send($req)); }