diff --git a/tests/Bot/Tests/DialogsTest.php b/tests/Bot/Tests/DialogsTest.php index e8e5312..08ee4d3 100644 --- a/tests/Bot/Tests/DialogsTest.php +++ b/tests/Bot/Tests/DialogsTest.php @@ -72,6 +72,42 @@ class DialogsTest extends TestCase self::assertTrue($response->getResponsible() instanceof Responsible); } + /** + * @group("dialogs") + * @throws \Exception + */ + public function testDialogUnassignError() + { + $this->expectException(\RuntimeException::class); + $client = self::getApiClient( + null, + null, + false, + $this->getErrorsResponse(400, "incorrect dialog_id") + ); + + $client->dialogUnassign(-1); + } + + /** + * @group("dialogs") + * @throws \Exception + */ + public function testDialogUnassign() + { + $client = self::getApiClient( + null, + null, + false, + $this->getJsonResponse('dialogUnassigned') + ); + + $response = $client->dialogUnassign(60); + + self::assertTrue($response->isSuccessful()); + self::assertTrue($response->getPreviousResponsible() instanceof Responsible); + } + /** * @group("dialogs") * @throws \Exception diff --git a/tests/Resources/dialogUnassigned.json b/tests/Resources/dialogUnassigned.json new file mode 100644 index 0000000..08d2c42 --- /dev/null +++ b/tests/Resources/dialogUnassigned.json @@ -0,0 +1 @@ +{"previous_responsible":{"type":"user","id":12,"assigned_at":"2019-06-11T12:49:34Z"}} \ No newline at end of file