expectException(\RuntimeException::class); $client = self::getApiClient( null, null, false, $this->getErrorsResponse(400, "incorrect dialog_id") ); $request = new DialogAssignRequest(); $request->setDialogId(-1); $client->dialogAssign($request); } /** * @group("dialogs") * @throws \Exception */ public function testDialogAssign() { $client = self::getApiClient( null, null, false, $this->getJsonResponse('dialogReassigned') ); $request = new DialogAssignRequest(); $request->setDialogId(60); $request->setUserId(4); $response = $client->dialogAssign($request); self::assertTrue($response->isSuccessful()); self::assertTrue($response->getIsReassign()); self::assertTrue($response->getPreviousResponsible() instanceof Responsible); self::assertTrue($response->getResponsible() instanceof Responsible); } /** * @group("dialogs") * @throws \Exception */ public function testDialogCloseError() { self::expectException(NotFoundException::class); $client = self::getApiClient( null, null, false, $this->getErrorsResponse(404, "dialog #2131231231 not found") ); $client->dialogClose('2131231231'); } /** * @group("dialogs") * @throws \Exception */ public function testDialogClose() { $client = self::getApiClient( null, null, false, $this->getResponse('{}') ); $response = $client->dialogClose('62'); self::assertInstanceOF(ErrorOnlyResponse::class, $response); self::assertTrue($response->isSuccessful()); self::assertEmpty($response->getErrors()); } }