From 2c5378f6ab3e46308febff24180fe8e41abf7491 Mon Sep 17 00:00:00 2001
From: Rhys Lees <43909932+RhysLees@users.noreply.github.com>
Date: Fri, 8 Sep 2023 00:18:36 +0100
Subject: [PATCH 01/17] WIP
---
src/Requests/CreateSingleTicketRequest.php | 14 ++++++-
.../CreateSingleTicketRequestTest.php | 42 +++++++++++++++++++
2 files changed, 55 insertions(+), 1 deletion(-)
diff --git a/src/Requests/CreateSingleTicketRequest.php b/src/Requests/CreateSingleTicketRequest.php
index a494d89..4e434f3 100644
--- a/src/Requests/CreateSingleTicketRequest.php
+++ b/src/Requests/CreateSingleTicketRequest.php
@@ -22,10 +22,22 @@ public function resolveEndpoint(): string
}
public function __construct(
- readonly protected array|SingleTicketDTO $createTicket
+ readonly protected array|SingleTicketDTO $createTicket,
+ readonly protected null|string $onBehalfOf = null,
) {
}
+ protected function defaultHeaders(): array
+ {
+ $headers = [];
+
+ if ($this->onBehalfOf) {
+ $headers['X-On-Behalf-Of'] = $this->onBehalfOf;
+ }
+
+ return $headers;
+ }
+
protected function defaultBody(): array
{
$body = $this->createTicket;
diff --git a/tests/Requests/CreateSingleTicketRequestTest.php b/tests/Requests/CreateSingleTicketRequestTest.php
index 22e8c43..13a53e7 100644
--- a/tests/Requests/CreateSingleTicketRequestTest.php
+++ b/tests/Requests/CreateSingleTicketRequestTest.php
@@ -44,3 +44,45 @@
->and($response->dto()->custom_fields[2]['id'])->toBe(17195752153741)
->and($response->dto()->custom_fields[2]['value'])->toBe('Check field works number 2');
});
+
+
+it('can get create a single ticket on behalf of a user', closure: function () {
+ $mockClient = new MockClient([
+ CreateSingleTicketRequest::class => MockResponse::fixture('create-single-ticket-request-on-behalf-of'),
+ ]);
+
+ $connector = new ZendeskConnector;
+ $connector->withMockClient($mockClient);
+
+ $response = $connector->send(new CreateSingleTicketRequest(
+ createTicket: [
+ 'comment' => CommentDTO::fromArray([
+ 'body' => 'The smoke is very colorful.',
+ ]),
+ 'priority' => TicketPriority::URGENT,
+ 'subject' => 'My printer is on fire!',
+ 'custom_fields' => [
+ [
+ 'id' => 17195718961677,
+ 'value' => 'Check field works',
+ ],
+ [
+ 'id' => 17195752153741,
+ 'value' => 'Check field works number 2',
+ ],
+ ],
+ ],
+ onBehalfOf: 'test@example.com'
+ ));
+
+ $mockClient->assertSent(CreateSingleTicketRequest::class);
+
+ expect($response->dto()->subject)->toBe('My printer is on fire!')
+ ->and($response->dto()->raw_subject)->toBe('My printer is on fire!')
+ ->and($response->dto()->description)->toBe('The smoke is very colorful.')
+ ->and($response->dto()->priority)->toBe(TicketPriority::URGENT)
+ ->and($response->dto()->custom_fields[1]['id'])->toBe(17195718961677)
+ ->and($response->dto()->custom_fields[1]['value'])->toBe('Check field works')
+ ->and($response->dto()->custom_fields[2]['id'])->toBe(17195752153741)
+ ->and($response->dto()->custom_fields[2]['value'])->toBe('Check field works number 2');
+});
From 6a6575df59a7da0a54323c40a8323771dc7d8558 Mon Sep 17 00:00:00 2001
From: Rhys Lees <43909932+RhysLees@users.noreply.github.com>
Date: Fri, 8 Sep 2023 23:34:28 +0100
Subject: [PATCH 02/17] WIP
---
phpunit.xml.dist | 2 +-
src/Requests/ShowUserRequest.php | 35 ++++++++++++++++
.../Saloon/count-tickets-request.json | 2 +-
.../Saloon/create-attachment-request.json | 41 +------------------
...te-single-ticket-request-on-behalf-of.json | 1 +
.../Saloon/create-single-ticket-request.json | 2 +-
.../Saloon/details-incorrect-request.json | 29 +------------
.../Saloon/single-ticket-request.json | 38 +----------------
tests/Pest.php | 16 ++++----
tests/Requests/AllTicketsRequestTest.php | 25 ++++-------
tests/Requests/CountTicketsRequestTest.php | 4 +-
.../Requests/CreateAttachmentRequestTest.php | 4 +-
tests/Requests/ShowUserRequestTest.php | 33 +++++++++++++++
tests/Requests/SingleTicketRequestTest.php | 4 +-
14 files changed, 96 insertions(+), 140 deletions(-)
create mode 100644 src/Requests/ShowUserRequest.php
create mode 100644 tests/Fixtures/Saloon/create-single-ticket-request-on-behalf-of.json
create mode 100644 tests/Requests/ShowUserRequestTest.php
diff --git a/phpunit.xml.dist b/phpunit.xml.dist
index feb4821..d6e3b1a 100644
--- a/phpunit.xml.dist
+++ b/phpunit.xml.dist
@@ -37,7 +37,7 @@
-
+
diff --git a/src/Requests/ShowUserRequest.php b/src/Requests/ShowUserRequest.php
new file mode 100644
index 0000000..c539c24
--- /dev/null
+++ b/src/Requests/ShowUserRequest.php
@@ -0,0 +1,35 @@
+userId = $userId;
+ }
+
+ public function resolveEndpoint(): string
+ {
+ return '/users/'.$this->userId.'.json';
+ }
+
+ public function createDtoFromResponse(Response $response): mixed
+ {
+ if (! $response->successful()) {
+ throw new Exception('Request was not successful. Unable to create DTO.');
+ }
+
+ return $response->json();
+ }
+}
diff --git a/tests/Fixtures/Saloon/count-tickets-request.json b/tests/Fixtures/Saloon/count-tickets-request.json
index ec31ab3..a93c8c9 100644
--- a/tests/Fixtures/Saloon/count-tickets-request.json
+++ b/tests/Fixtures/Saloon/count-tickets-request.json
@@ -1 +1 @@
-{"statusCode":200,"headers":{"Date":"Mon, 03 Jul 2023 13:19:53 GMT","Content-Type":"application\/json; charset=utf-8","Transfer-Encoding":"chunked","Connection":"keep-alive","x-zendesk-api-version":"v2","x-zendesk-application-version":"v17438","x-frame-options":"SAMEORIGIN","x-rate-limit":"400","rate-limit":"400","x-rate-limit-remaining":"399","rate-limit-remaining":"399","rate-limit-reset":"7","strict-transport-security":"max-age=31536000;","etag":"W\/\"dd5b53a4c6c7cd54d9e75cb4d51c3a8a\"","cache-control":"max-age=0, private, must-revalidate","x-zendesk-origin-server":"classic-app-server-6fc8db697c-msbrs","set-cookie":["_zendesk_cookie=BAhJIhl7ImRldmljZV90b2tlbnMiOnt9fQY6BkVU--0bf2100788cb010d0183feca16aaf88ccaf719ca; path=\/; expires=Wed, 03 Jul 2024 04:36:28 GMT; secure; HttpOnly; SameSite=None","__cfruid=0e155e55bd96d1d52b7c0b19c4c735ae1b2e0d93-1688390393; path=\/; domain=.codebarsolutionsag.zendesk.com; HttpOnly; Secure; SameSite=None"],"x-request-id":["7e0f6c36fb797735-LHR","7e0f6c36fb797735-LHR"],"x-runtime":"0.073519","X-Zendesk-Zorg":"yes","CF-Cache-Status":"DYNAMIC","Report-To":"{\"endpoints\":[{\"url\":\"https:\\\/\\\/a.nel.cloudflare.com\\\/report\\\/v3?s=bl0dv422vOkNLREKNLdaQy5qTMuOaeDMK0kHOBFaaHa6bdBul%2FWMn6KIhIC1GeWb8Z5cXJMcbSVQhZgHH4KjUiJYs%2FFPWcZQD7vYwvy7SWODBlcd6FSqwVYFnq8ghN8Vq6a45PZLHAy2EtL2BEFDqg%3D%3D\"}],\"group\":\"cf-nel\",\"max_age\":604800}","NEL":"{\"success_fraction\":0.01,\"report_to\":\"cf-nel\",\"max_age\":604800}","Server":"cloudflare","CF-RAY":"7e0f6c36fb797735-LHR"},"data":"{\"count\":{\"value\":4,\"refreshed_at\":\"2023-07-03T13:19:53+00:00\"}}"}
\ No newline at end of file
+{"statusCode":200,"headers":{"Date":"Fri, 08 Sep 2023 22:25:14 GMT","Content-Type":"application\/json; charset=utf-8","Transfer-Encoding":"chunked","Connection":"keep-alive","x-zendesk-api-version":"v2","x-zendesk-application-version":"v18303","x-frame-options":"SAMEORIGIN","x-rate-limit":"400","rate-limit":"400","x-rate-limit-remaining":"394","rate-limit-remaining":"394","rate-limit-reset":"46","strict-transport-security":"max-age=31536000; includeSubDomains","etag":"W\/\"04705c0fd9decaa6fa75efff5f56df4a\"","cache-control":"max-age=0, private, must-revalidate","set-cookie":["_zendesk_cookie=BAhJIhl7ImRldmljZV90b2tlbnMiOnt9fQY6BkVU--0bf2100788cb010d0183feca16aaf88ccaf719ca; path=\/; expires=Sun, 08 Sep 2024 19:27:40 GMT; secure; HttpOnly; SameSite=None","__cfruid=1adcc1a141e4dfe08bdbf099eaee019533c4cfbf-1694211914; path=\/; domain=.codebarsolutions.zendesk.com; HttpOnly; Secure; SameSite=None"],"x-zendesk-origin-server":"classic-app-server-55f8b9dd4b-bpwgb","x-request-id":["803a9b2e9cf34999-LHR","803a9b2e9cf34999-LHR"],"x-runtime":"0.079048","X-Zendesk-Zorg":"yes","CF-Cache-Status":"DYNAMIC","Report-To":"{\"endpoints\":[{\"url\":\"https:\\\/\\\/a.nel.cloudflare.com\\\/report\\\/v3?s=lPEYSDgbkIRug9oN1Cx4NPo3Tw08mROkY9gmf3u7Iue%2BcP7jVqub7f7uLGLcSlNcFQKCO25b6mumCTiR0UFhik9NqfNgzAKoLggfrHkqa%2BOcQdi8h7mKU3%2BhgDqhnXdDz%2BkkAuS4xCRIZcGEUNg%3D\"}],\"group\":\"cf-nel\",\"max_age\":604800}","NEL":"{\"success_fraction\":0.01,\"report_to\":\"cf-nel\",\"max_age\":604800}","Server":"cloudflare","CF-RAY":"803a9b2e9cf34999-LHR"},"data":"{\"count\":{\"value\":1,\"refreshed_at\":\"2023-09-08T22:25:14+00:00\"}}"}
\ No newline at end of file
diff --git a/tests/Fixtures/Saloon/create-attachment-request.json b/tests/Fixtures/Saloon/create-attachment-request.json
index ad47a59..9cd7a49 100644
--- a/tests/Fixtures/Saloon/create-attachment-request.json
+++ b/tests/Fixtures/Saloon/create-attachment-request.json
@@ -1,40 +1 @@
-{
- "statusCode": 201,
- "headers": {
- "Date": "Mon, 03 Jul 2023 13:33:16 GMT",
- "Content-Type": "application\/json; charset=utf-8",
- "Content-Length": "2293",
- "Connection": "keep-alive",
- "x-zendesk-api-version": "v2",
- "x-zendesk-application-version": "v17438",
- "x-frame-options": "SAMEORIGIN",
- "location": "https:\/\/codebarsolutionsag.zendesk.com\/api\/v2\/attachments\/17278923683597.json",
- "access-control-allow-origin": "*",
- "access-control-expose-headers": "X-Zendesk-API-Warn,X-Zendesk-User-Id,X-Zendesk-User-Session-Expires-At",
- "x-rate-limit": "400",
- "rate-limit": "400",
- "x-rate-limit-remaining": "399",
- "rate-limit-remaining": "399",
- "rate-limit-reset": "44",
- "strict-transport-security": "max-age=31536000;",
- "etag": "W\/\"387b535ca927c3e885bc4ebf45675c64\"",
- "cache-control": "max-age=0, private, must-revalidate",
- "x-zendesk-origin-server": "classic-app-server-6fc8db697c-lbxfk",
- "set-cookie": [
- "_zendesk_cookie=BAhJIhl7ImRldmljZV90b2tlbnMiOnt9fQY6BkVU--0bf2100788cb010d0183feca16aaf88ccaf719ca; path=\/; expires=Wed, 03 Jul 2024 07:05:39 GMT; secure; HttpOnly; SameSite=None",
- "__cfruid=9a71e3de0932ad74b42e7fcf2ed091e67ad18b84-1688391196; path=\/; domain=.codebarsolutionsag.zendesk.com; HttpOnly; Secure; SameSite=None"
- ],
- "x-request-id": [
- "7e0f7fcbdbec7545-LHR",
- "7e0f7fcbdbec7545-LHR"
- ],
- "x-runtime": "0.374089",
- "X-Zendesk-Zorg": "yes",
- "CF-Cache-Status": "DYNAMIC",
- "Report-To": "{\"endpoints\":[{\"url\":\"https:\\\/\\\/a.nel.cloudflare.com\\\/report\\\/v3?s=TL6Q7BjsnUmgl8FO0vyKlypUJhEHM8ywbUzWFRH46niQLknkM8iDggX2mC7pWJJ8V8iBHBrGs0U8%2FGwAQEyClKMQMHTIDmcs%2Bl%2BlOH339vU0XQ%2FSAlPzIG1WkX6vs5k%2FCZCmES8PcDYJ0I44ZqeZIg%3D%3D\"}],\"group\":\"cf-nel\",\"max_age\":604800}",
- "NEL": "{\"success_fraction\":0.01,\"report_to\":\"cf-nel\",\"max_age\":604800}",
- "Server": "cloudflare",
- "CF-RAY": "7e0f7fcbdbec7545-LHR"
- },
- "data": "{\"upload\":{\"token\":\"OPvgMbfg5Der4DYn66hTC31in\",\"expires_at\":\"2023-07-06T13:33:15Z\",\"attachments\":[{\"url\":\"https:\/\/codebarsolutionsag.zendesk.com\/api\/v2\/attachments\/17278923683597.json\",\"id\":17278923683597,\"file_name\":\"test.png\",\"content_url\":\"https:\/\/codebarsolutionsag.zendesk.com\/attachments\/token\/52HCaRgRZM38MvaUuUQsYzhUA\/?name=test.png\",\"mapped_content_url\":\"https:\/\/codebarsolutionsag.zendesk.com\/attachments\/token\/52HCaRgRZM38MvaUuUQsYzhUA\/?name=test.png\",\"content_type\":\"image\/png\",\"size\":26271,\"width\":640,\"height\":360,\"inline\":false,\"deleted\":false,\"malware_access_override\":false,\"malware_scan_result\":\"not_scanned\",\"thumbnails\":[{\"url\":\"https:\/\/codebarsolutionsag.zendesk.com\/api\/v2\/attachments\/17278921757709.json\",\"id\":17278921757709,\"file_name\":\"test_thumb.png\",\"content_url\":\"https:\/\/codebarsolutionsag.zendesk.com\/attachments\/token\/gvLU5FyT7CoKakThdKaxHwVNg\/?name=test_thumb.png\",\"mapped_content_url\":\"https:\/\/codebarsolutionsag.zendesk.com\/attachments\/token\/gvLU5FyT7CoKakThdKaxHwVNg\/?name=test_thumb.png\",\"content_type\":\"image\/png\",\"size\":1823,\"width\":80,\"height\":45,\"inline\":false,\"deleted\":false,\"malware_access_override\":false,\"malware_scan_result\":\"not_scanned\"}]}],\"attachment\":{\"url\":\"https:\/\/codebarsolutionsag.zendesk.com\/api\/v2\/attachments\/17278923683597.json\",\"id\":17278923683597,\"file_name\":\"test.png\",\"content_url\":\"https:\/\/codebarsolutionsag.zendesk.com\/attachments\/token\/52HCaRgRZM38MvaUuUQsYzhUA\/?name=test.png\",\"mapped_content_url\":\"https:\/\/codebarsolutionsag.zendesk.com\/attachments\/token\/52HCaRgRZM38MvaUuUQsYzhUA\/?name=test.png\",\"content_type\":\"image\/png\",\"size\":26271,\"width\":640,\"height\":360,\"inline\":false,\"deleted\":false,\"malware_access_override\":false,\"malware_scan_result\":\"not_scanned\",\"thumbnails\":[{\"url\":\"https:\/\/codebarsolutionsag.zendesk.com\/api\/v2\/attachments\/17278921757709.json\",\"id\":17278921757709,\"file_name\":\"test_thumb.png\",\"content_url\":\"https:\/\/codebarsolutionsag.zendesk.com\/attachments\/token\/gvLU5FyT7CoKakThdKaxHwVNg\/?name=test_thumb.png\",\"mapped_content_url\":\"https:\/\/codebarsolutionsag.zendesk.com\/attachments\/token\/gvLU5FyT7CoKakThdKaxHwVNg\/?name=test_thumb.png\",\"content_type\":\"image\/png\",\"size\":1823,\"width\":80,\"height\":45,\"inline\":false,\"deleted\":false,\"malware_access_override\":false,\"malware_scan_result\":\"not_scanned\"}]}}}"
-}
+{"statusCode":201,"headers":{"Date":"Fri, 08 Sep 2023 22:25:11 GMT","Content-Type":"application\/json; charset=utf-8","Content-Length":"2269","Connection":"keep-alive","x-zendesk-api-version":"v2","x-zendesk-application-version":"v18303","x-frame-options":"SAMEORIGIN","location":"https:\/\/codebarsolutions.zendesk.com\/api\/v2\/attachments\/10346616943260.json","access-control-allow-origin":"*","access-control-expose-headers":"X-Zendesk-API-Warn,X-Zendesk-User-Id,X-Zendesk-User-Session-Expires-At","x-rate-limit":"400","rate-limit":"400","x-rate-limit-remaining":"399","rate-limit-remaining":"399","rate-limit-reset":"49","strict-transport-security":"max-age=31536000; includeSubDomains","etag":"W\/\"d7f35d3e23d9e589b10dd300abf153d1\"","cache-control":"max-age=0, private, must-revalidate","set-cookie":["_zendesk_cookie=BAhJIhl7ImRldmljZV90b2tlbnMiOnt9fQY6BkVU--0bf2100788cb010d0183feca16aaf88ccaf719ca; path=\/; expires=Sat, 07 Sep 2024 22:49:54 GMT; secure; HttpOnly; SameSite=None","__cfruid=8a343d2b8219d5ed68ae654e458790b82e86af94-1694211911; path=\/; domain=.codebarsolutions.zendesk.com; HttpOnly; Secure; SameSite=None"],"x-zendesk-origin-server":"classic-app-server-55f8b9dd4b-9qs56","x-request-id":["803a9b1a8aca7196-LHR","803a9b1a8aca7196-LHR"],"x-runtime":"0.362019","X-Zendesk-Zorg":"yes","CF-Cache-Status":"DYNAMIC","Report-To":"{\"endpoints\":[{\"url\":\"https:\\\/\\\/a.nel.cloudflare.com\\\/report\\\/v3?s=HLwQljGBdekV1CgV9fJaQk7xrssbg%2F5yAsyhDHE02hJJz0w4hmfBx9MCfnU6armidLUqgxOmlLEgQDy4lzbih9RgFgYwbbUZYgu58dXUGx%2BHFZ2icnL5zn2V2V6e89ggeZDk7daR5s0P2qWwAaw%3D\"}],\"group\":\"cf-nel\",\"max_age\":604800}","NEL":"{\"success_fraction\":0.01,\"report_to\":\"cf-nel\",\"max_age\":604800}","Server":"cloudflare","CF-RAY":"803a9b1a8aca7196-LHR"},"data":"{\"upload\":{\"token\":\"QyLNkTdFhrpxXu7JzlZcJWLat\",\"expires_at\":\"2023-09-11T22:25:11Z\",\"attachments\":[{\"url\":\"https:\/\/codebarsolutions.zendesk.com\/api\/v2\/attachments\/10346616943260.json\",\"id\":10346616943260,\"file_name\":\"test.png\",\"content_url\":\"https:\/\/codebarsolutions.zendesk.com\/attachments\/token\/bClC0CjrndApmHI1aO9lKT80C\/?name=test.png\",\"mapped_content_url\":\"https:\/\/codebarsolutions.zendesk.com\/attachments\/token\/bClC0CjrndApmHI1aO9lKT80C\/?name=test.png\",\"content_type\":\"image\/png\",\"size\":26271,\"width\":640,\"height\":360,\"inline\":false,\"deleted\":false,\"malware_access_override\":false,\"malware_scan_result\":\"not_scanned\",\"thumbnails\":[{\"url\":\"https:\/\/codebarsolutions.zendesk.com\/api\/v2\/attachments\/10346602773276.json\",\"id\":10346602773276,\"file_name\":\"test_thumb.png\",\"content_url\":\"https:\/\/codebarsolutions.zendesk.com\/attachments\/token\/5pstEWeJh6l5KhRNHeUreauly\/?name=test_thumb.png\",\"mapped_content_url\":\"https:\/\/codebarsolutions.zendesk.com\/attachments\/token\/5pstEWeJh6l5KhRNHeUreauly\/?name=test_thumb.png\",\"content_type\":\"image\/png\",\"size\":1821,\"width\":80,\"height\":45,\"inline\":false,\"deleted\":false,\"malware_access_override\":false,\"malware_scan_result\":\"not_scanned\"}]}],\"attachment\":{\"url\":\"https:\/\/codebarsolutions.zendesk.com\/api\/v2\/attachments\/10346616943260.json\",\"id\":10346616943260,\"file_name\":\"test.png\",\"content_url\":\"https:\/\/codebarsolutions.zendesk.com\/attachments\/token\/bClC0CjrndApmHI1aO9lKT80C\/?name=test.png\",\"mapped_content_url\":\"https:\/\/codebarsolutions.zendesk.com\/attachments\/token\/bClC0CjrndApmHI1aO9lKT80C\/?name=test.png\",\"content_type\":\"image\/png\",\"size\":26271,\"width\":640,\"height\":360,\"inline\":false,\"deleted\":false,\"malware_access_override\":false,\"malware_scan_result\":\"not_scanned\",\"thumbnails\":[{\"url\":\"https:\/\/codebarsolutions.zendesk.com\/api\/v2\/attachments\/10346602773276.json\",\"id\":10346602773276,\"file_name\":\"test_thumb.png\",\"content_url\":\"https:\/\/codebarsolutions.zendesk.com\/attachments\/token\/5pstEWeJh6l5KhRNHeUreauly\/?name=test_thumb.png\",\"mapped_content_url\":\"https:\/\/codebarsolutions.zendesk.com\/attachments\/token\/5pstEWeJh6l5KhRNHeUreauly\/?name=test_thumb.png\",\"content_type\":\"image\/png\",\"size\":1821,\"width\":80,\"height\":45,\"inline\":false,\"deleted\":false,\"malware_access_override\":false,\"malware_scan_result\":\"not_scanned\"}]}}}"}
\ No newline at end of file
diff --git a/tests/Fixtures/Saloon/create-single-ticket-request-on-behalf-of.json b/tests/Fixtures/Saloon/create-single-ticket-request-on-behalf-of.json
new file mode 100644
index 0000000..54b3aac
--- /dev/null
+++ b/tests/Fixtures/Saloon/create-single-ticket-request-on-behalf-of.json
@@ -0,0 +1 @@
+{"statusCode":400,"headers":{"Date":"Fri, 08 Sep 2023 22:25:13 GMT","Content-Type":"text\/plain; charset=utf-8","Content-Length":"85","Connection":"keep-alive","x-zendesk-api-version":"v2","x-zendesk-application-version":"v18303","x-zendesk-api-warn":"{:allowed_parameters=>{:controller=>\"tickets\", :action=>\"create\", :unpermitted_keys=>[\"ticket.allow_attachments\", \"ticket.allow_channelback\", \"ticket.comment.attachments\", \"ticket.comment.audit_id\", \"ticket.comment.created_at\", \"ticket.comment.id\", \"ticket.comment.metadata\", \"ticket.comment.plain_body\", \"ticket.comment.type\", \"ticket.comment.via\", \"ticket.created_at\", \"ticket.email_cc_ids\", \"ticket.follower_ids\", \"ticket.followup_ids\", \"ticket.from_messaging_channel\", \"ticket.has_incidents\", \"ticket.id\", \"ticket.is_public\", \"ticket.self_update\", \"ticket.satisfaction_rating\", \"ticket.updated_at\"], :invalid_values=>[]}}","x-rate-limit":"400","rate-limit":"400","x-rate-limit-remaining":"396","rate-limit-remaining":"396","rate-limit-reset":"47","strict-transport-security":"max-age=31536000; includeSubDomains","cache-control":"no-cache","set-cookie":["_zendesk_cookie=BAhJIhl7ImRldmljZV90b2tlbnMiOnt9fQY6BkVU--0bf2100788cb010d0183feca16aaf88ccaf719ca; path=\/; expires=Sat, 07 Sep 2024 22:47:32 GMT; secure; HttpOnly; SameSite=None","__cfruid=0876246d6b37a4b1886f92df7b9c30efeb3bc181-1694211913; path=\/; domain=.codebarsolutions.zendesk.com; HttpOnly; Secure; SameSite=None"],"x-zendesk-origin-server":"classic-app-server-55f8b9dd4b-tpv7k","x-request-id":["803a9b27c93e7308-LHR","803a9b27c93e7308-LHR"],"x-runtime":"0.049878","X-Zendesk-Zorg":"yes","CF-Cache-Status":"DYNAMIC","Report-To":"{\"endpoints\":[{\"url\":\"https:\\\/\\\/a.nel.cloudflare.com\\\/report\\\/v3?s=KidFVeIIuRY2CUjPKQDOYc%2Bq2giL5TsouLwvdX0JVdDRX6rfSmhcC9g9N0ko5EGj0UxPdqLKz1ZX4M0vTb8pxp4xSM8wVSdITdYF31ohIJZcjnUemQ%2BVmk3lVDlPN7NWMQlsL7upAOJfDBOJDg0%3D\"}],\"group\":\"cf-nel\",\"max_age\":604800}","NEL":"{\"success_fraction\":0.01,\"report_to\":\"cf-nel\",\"max_age\":604800}","Server":"cloudflare","CF-RAY":"803a9b27c93e7308-LHR"},"data":"This API version does not support the X-On-Behalf-Of header. Please use an API token."}
\ No newline at end of file
diff --git a/tests/Fixtures/Saloon/create-single-ticket-request.json b/tests/Fixtures/Saloon/create-single-ticket-request.json
index 237fda8..f91c06b 100644
--- a/tests/Fixtures/Saloon/create-single-ticket-request.json
+++ b/tests/Fixtures/Saloon/create-single-ticket-request.json
@@ -1 +1 @@
-{"statusCode":201,"headers":{"Date":"Mon, 03 Jul 2023 13:16:35 GMT","Content-Type":"application\/json; charset=utf-8","Content-Length":"3197","Connection":"keep-alive","x-zendesk-api-version":"v2","x-zendesk-application-version":"v17438","x-zendesk-api-warn":"{:allowed_parameters=>{:controller=>\"tickets\", :action=>\"create\", :unpermitted_keys=>[\"ticket.allow_attachments\", \"ticket.allow_channelback\", \"ticket.comment.attachments\", \"ticket.comment.audit_id\", \"ticket.comment.created_at\", \"ticket.comment.id\", \"ticket.comment.metadata\", \"ticket.comment.plain_body\", \"ticket.comment.type\", \"ticket.comment.via\", \"ticket.created_at\", \"ticket.email_cc_ids\", \"ticket.follower_ids\", \"ticket.followup_ids\", \"ticket.from_messaging_channel\", \"ticket.has_incidents\", \"ticket.id\", \"ticket.is_public\", \"ticket.self_update\", \"ticket.satisfaction_rating\", \"ticket.updated_at\"], :invalid_values=>[]}}","x-frame-options":"SAMEORIGIN","zendesk-ep":"-22","location":"https:\/\/codebarsolutionsag.zendesk.com\/api\/v2\/tickets\/83.json","x-rate-limit":"400","rate-limit":"400","x-rate-limit-remaining":"399","rate-limit-remaining":"399","rate-limit-reset":"25","strict-transport-security":"max-age=31536000;","etag":"W\/\"3f19ce42212521a313aba3506dabd849\"","cache-control":"max-age=0, private, must-revalidate","x-zendesk-origin-server":"classic-app-server-6fc8db697c-vp95d","set-cookie":["_zendesk_cookie=BAhJIhl7ImRldmljZV90b2tlbnMiOnt9fQY6BkVU--0bf2100788cb010d0183feca16aaf88ccaf719ca; path=\/; expires=Wed, 03 Jul 2024 07:05:25 GMT; secure; HttpOnly; SameSite=None","__cfruid=212285535bde6012c576e4f7e5897005b752ea29-1688390195; path=\/; domain=.codebarsolutionsag.zendesk.com; HttpOnly; Secure; SameSite=None"],"x-request-id":["7e0f675b4829d168-LHR","7e0f675b4829d168-LHR"],"x-runtime":"0.490684","X-Zendesk-Zorg":"yes","CF-Cache-Status":"DYNAMIC","Report-To":"{\"endpoints\":[{\"url\":\"https:\\\/\\\/a.nel.cloudflare.com\\\/report\\\/v3?s=WhPNGryN2lnTT63PGIv4jkoAL%2BCJfcUd9U1L%2B%2F6RBPPdiAz7EXz0y4Oj84xA9dyzvnJHh4SVHLzJ9asKpj7DJczwb9mXhXY5Q8BverBn44Bu9RmF8gitXsMkSpAbWkL9gBwsgUTzlEcW4sPwEYwwSw%3D%3D\"}],\"group\":\"cf-nel\",\"max_age\":604800}","NEL":"{\"success_fraction\":0.01,\"report_to\":\"cf-nel\",\"max_age\":604800}","Server":"cloudflare","CF-RAY":"7e0f675b4829d168-LHR"},"data":"{\"ticket\":{\"url\":\"https:\/\/codebarsolutionsag.zendesk.com\/api\/v2\/tickets\/83.json\",\"id\":83,\"external_id\":null,\"via\":{\"channel\":\"api\",\"source\":{\"from\":{},\"to\":{},\"rel\":null}},\"created_at\":\"2023-07-03T13:16:35Z\",\"updated_at\":\"2023-07-03T13:16:35Z\",\"type\":null,\"subject\":\"My printer is on fire!\",\"raw_subject\":\"My printer is on fire!\",\"description\":\"The smoke is very colorful.\",\"priority\":\"urgent\",\"status\":\"open\",\"recipient\":null,\"requester_id\":17145664265741,\"submitter_id\":17145664265741,\"assignee_id\":17145664265741,\"organization_id\":17145651654157,\"group_id\":17145664762125,\"collaborator_ids\":[],\"follower_ids\":[],\"email_cc_ids\":[],\"forum_topic_id\":null,\"problem_id\":null,\"has_incidents\":false,\"is_public\":true,\"due_at\":null,\"tags\":[],\"custom_fields\":[{\"id\":17146061349901,\"value\":null},{\"id\":17195718961677,\"value\":\"Check field works\"},{\"id\":17195752153741,\"value\":\"Check field works number 2\"}],\"satisfaction_rating\":null,\"sharing_agreement_ids\":[],\"custom_status_id\":17145678334989,\"fields\":[{\"id\":17146061349901,\"value\":null},{\"id\":17195718961677,\"value\":\"Check field works\"},{\"id\":17195752153741,\"value\":\"Check field works number 2\"}],\"followup_ids\":[],\"ticket_form_id\":17145664563725,\"brand_id\":17145651602957,\"allow_channelback\":false,\"allow_attachments\":true,\"from_messaging_channel\":false},\"audit\":{\"id\":17278400133517,\"ticket_id\":83,\"created_at\":\"2023-07-03T13:16:35Z\",\"author_id\":17145664265741,\"metadata\":{\"system\":{\"client\":\"GuzzleHttp\/7\",\"ip_address\":\"94.101.151.181\",\"location\":\"Herne Bay, ENG, United Kingdom\",\"latitude\":51.3724,\"longitude\":1.1561},\"custom\":{}},\"events\":[{\"id\":17278400133645,\"type\":\"Comment\",\"author_id\":17145664265741,\"body\":\"The smoke is very colorful.\",\"html_body\":\"
The smoke is very colorful.<\/p><\/div>\",\"plain_body\":\"The smoke is very colorful.\",\"public\":true,\"attachments\":[],\"audit_id\":17278400133517},{\"id\":17278400133773,\"type\":\"Create\",\"value\":\"urgent\",\"field_name\":\"priority\"},{\"id\":17278400133901,\"type\":\"Create\",\"value\":\"My printer is on fire!\",\"field_name\":\"subject\"},{\"id\":17278400134029,\"type\":\"Create\",\"value\":\"17145664265741\",\"field_name\":\"requester_id\"},{\"id\":17278400134157,\"type\":\"Create\",\"value\":\"Check field works\",\"field_name\":\"17195718961677\"},{\"id\":17278400134285,\"type\":\"Create\",\"value\":\"Check field works number 2\",\"field_name\":\"17195752153741\"},{\"id\":17278400134413,\"type\":\"Create\",\"value\":null,\"field_name\":\"type\"},{\"id\":17278400134541,\"type\":\"Create\",\"value\":\"open\",\"field_name\":\"status\"},{\"id\":17278400134669,\"type\":\"Create\",\"value\":\"17145664265741\",\"field_name\":\"assignee_id\"},{\"id\":17278400134797,\"type\":\"Create\",\"value\":\"17145664762125\",\"field_name\":\"group_id\"},{\"id\":17278400134925,\"type\":\"Create\",\"value\":\"17145651654157\",\"field_name\":\"organization_id\"},{\"id\":17278400135053,\"type\":\"Create\",\"value\":\"17145651602957\",\"field_name\":\"brand_id\"},{\"id\":17278400135181,\"type\":\"Create\",\"value\":\"17145664563725\",\"field_name\":\"ticket_form_id\"},{\"id\":17278400135309,\"type\":\"Create\",\"value\":\"17145678334989\",\"field_name\":\"custom_status_id\"},{\"id\":17278414083597,\"type\":\"AssociateAttValsEvent\",\"attribute_values\":[]}],\"via\":{\"channel\":\"api\",\"source\":{\"from\":{},\"to\":{},\"rel\":null}}}}"} \ No newline at end of file +{"statusCode":201,"headers":{"Date":"Fri, 08 Sep 2023 22:25:13 GMT","Content-Type":"application\/json; charset=utf-8","Content-Length":"3718","Connection":"keep-alive","x-zendesk-api-version":"v2","x-zendesk-application-version":"v18303","x-zendesk-api-warn":"{:allowed_parameters=>{:controller=>\"tickets\", :action=>\"create\", :unpermitted_keys=>[\"ticket.allow_attachments\", \"ticket.allow_channelback\", \"ticket.comment.attachments\", \"ticket.comment.audit_id\", \"ticket.comment.created_at\", \"ticket.comment.id\", \"ticket.comment.metadata\", \"ticket.comment.plain_body\", \"ticket.comment.type\", \"ticket.comment.via\", \"ticket.created_at\", \"ticket.email_cc_ids\", \"ticket.follower_ids\", \"ticket.followup_ids\", \"ticket.from_messaging_channel\", \"ticket.has_incidents\", \"ticket.id\", \"ticket.is_public\", \"ticket.self_update\", \"ticket.satisfaction_rating\", \"ticket.updated_at\"], :invalid_values=>[]}}","x-frame-options":"SAMEORIGIN","zendesk-ep":"-22","location":"https:\/\/codebarsolutions.zendesk.com\/api\/v2\/tickets\/15.json","x-rate-limit":"400","rate-limit":"400","x-rate-limit-remaining":"395","rate-limit-remaining":"395","rate-limit-reset":"47","strict-transport-security":"max-age=31536000; includeSubDomains","etag":"W\/\"88e369704b5bb18840a3353325fd804d\"","cache-control":"max-age=0, private, must-revalidate","set-cookie":["_zendesk_cookie=BAhJIhl7ImRldmljZV90b2tlbnMiOnt9fQY6BkVU--0bf2100788cb010d0183feca16aaf88ccaf719ca; path=\/; expires=Sun, 08 Sep 2024 21:05:57 GMT; secure; HttpOnly; SameSite=None","__cfruid=0876246d6b37a4b1886f92df7b9c30efeb3bc181-1694211913; path=\/; domain=.codebarsolutions.zendesk.com; HttpOnly; Secure; SameSite=None"],"x-zendesk-origin-server":"classic-app-server-55f8b9dd4b-m9tfc","x-request-id":["803a9b291fd12407-LHR","803a9b291fd12407-LHR"],"x-runtime":"0.698416","X-Zendesk-Zorg":"yes","CF-Cache-Status":"DYNAMIC","Report-To":"{\"endpoints\":[{\"url\":\"https:\\\/\\\/a.nel.cloudflare.com\\\/report\\\/v3?s=ZbwoBMRWktLkBw%2FD0ykKSahwK4YnDh2%2BG49dROV9ndR%2BZGWskECZHmCZd3HuPTn20svQyTi0naCXuyBxQz8O61izrFIj8wmI%2FXmnw03htHI%2Fqs6y%2Bu4X%2FrzgwkYN4I%2BijHzzI8MZlZ9GsVFmk4Q%3D\"}],\"group\":\"cf-nel\",\"max_age\":604800}","NEL":"{\"success_fraction\":0.01,\"report_to\":\"cf-nel\",\"max_age\":604800}","Server":"cloudflare","CF-RAY":"803a9b291fd12407-LHR"},"data":"{\"ticket\":{\"url\":\"https:\/\/codebarsolutions.zendesk.com\/api\/v2\/tickets\/15.json\",\"id\":15,\"external_id\":null,\"via\":{\"channel\":\"api\",\"source\":{\"from\":{},\"to\":{},\"rel\":null}},\"created_at\":\"2023-09-08T22:25:13Z\",\"updated_at\":\"2023-09-08T22:25:13Z\",\"type\":null,\"subject\":\"My printer is on fire!\",\"raw_subject\":\"My printer is on fire!\",\"description\":\"The smoke is very colorful.\",\"priority\":\"urgent\",\"status\":\"open\",\"recipient\":null,\"requester_id\":10344275987996,\"submitter_id\":10344275987996,\"assignee_id\":10344275987996,\"organization_id\":10344276178204,\"group_id\":10344307646492,\"collaborator_ids\":[],\"follower_ids\":[],\"email_cc_ids\":[],\"forum_topic_id\":null,\"problem_id\":null,\"has_incidents\":false,\"is_public\":true,\"due_at\":null,\"tags\":[],\"custom_fields\":[{\"id\":10344329458332,\"value\":null}],\"satisfaction_rating\":null,\"sharing_agreement_ids\":[],\"custom_status_id\":10344313751708,\"fields\":[{\"id\":10344329458332,\"value\":null}],\"followup_ids\":[],\"ticket_form_id\":10344290972956,\"brand_id\":10344297007388,\"allow_channelback\":false,\"allow_attachments\":true,\"from_messaging_channel\":false},\"audit\":{\"id\":10346619307292,\"ticket_id\":15,\"created_at\":\"2023-09-08T22:25:13Z\",\"author_id\":10344275987996,\"metadata\":{\"system\":{\"client\":\"GuzzleHttp\/7\",\"ip_address\":\"92.233.100.169\",\"location\":\"Ilford, ENG, United Kingdom\",\"latitude\":51.5749,\"longitude\":0.0869},\"custom\":{}},\"events\":[{\"id\":10346619307420,\"type\":\"Comment\",\"author_id\":10344275987996,\"body\":\"The smoke is very colorful.\",\"html_body\":\"
The smoke is very colorful.<\/p><\/div>\",\"plain_body\":\"The smoke is very colorful.\",\"public\":true,\"attachments\":[],\"audit_id\":10346619307292},{\"id\":10346619307548,\"type\":\"Create\",\"value\":\"urgent\",\"field_name\":\"priority\"},{\"id\":10346619307676,\"type\":\"Create\",\"value\":\"My printer is on fire!\",\"field_name\":\"subject\"},{\"id\":10346619307804,\"type\":\"Create\",\"value\":\"10344275987996\",\"field_name\":\"requester_id\"},{\"id\":10346619307932,\"type\":\"Create\",\"value\":null,\"field_name\":\"type\"},{\"id\":10346619308060,\"type\":\"Create\",\"value\":\"open\",\"field_name\":\"status\"},{\"id\":10346619308188,\"type\":\"Create\",\"value\":\"10344275987996\",\"field_name\":\"assignee_id\"},{\"id\":10346619308316,\"type\":\"Create\",\"value\":\"10344307646492\",\"field_name\":\"group_id\"},{\"id\":10346619308444,\"type\":\"Create\",\"value\":\"10344276178204\",\"field_name\":\"organization_id\"},{\"id\":10346619308572,\"type\":\"Create\",\"value\":\"10344297007388\",\"field_name\":\"brand_id\"},{\"id\":10346619308700,\"type\":\"Create\",\"value\":\"10344290972956\",\"field_name\":\"ticket_form_id\"},{\"id\":10346619308828,\"type\":\"Create\",\"value\":\"10344313751708\",\"field_name\":\"custom_status_id\"},{\"id\":10346619308956,\"type\":\"Notification\",\"via\":{\"channel\":\"rule\",\"source\":{\"from\":{\"deleted\":false,\"title\":\"Anfragenden \u00fcber neues proaktives Ticket benachrichtigen\",\"id\":10344280371100},\"rel\":\"trigger\"}},\"subject\":\"{{ticket.title}}\",\"body\":\"Dieses Ticket wurde in Ihrem Namen erstellt.\\n\\nUm weitere Kommentare hinzuzuf\u00fcgen, antworten Sie auf diese E-Mail.\\n\\n{{ticket.latest_public_comment_html}}\",\"recipients\":[10344275987996]},{\"id\":10346619309084,\"type\":\"Notification\",\"via\":{\"channel\":\"rule\",\"source\":{\"from\":{\"deleted\":false,\"title\":\"Alle Agenten \u00fcber eingegangene Anfrage benachrichtigen\",\"id\":10344280378780},\"rel\":\"trigger\"}},\"subject\":\"[{{ticket.account}}] {{ticket.title}}\",\"body\":\"Ein Ticket (#{{ticket.id}}) von {{ticket.requester.name}} ist eingegangen. Es ist momentan niemandem zugewiesen.\\n\\n{{ticket.latest_comment_html}}\",\"recipients\":[10344275987996]},{\"id\":10346644508572,\"type\":\"AssociateAttValsEvent\",\"attribute_values\":[]}],\"via\":{\"channel\":\"api\",\"source\":{\"from\":{},\"to\":{\"name\":\"Sebastian B\u00fcrgin\",\"address\":\"sebastian.buergin@codebar.ch\"},\"rel\":null}}}}"} \ No newline at end of file diff --git a/tests/Fixtures/Saloon/details-incorrect-request.json b/tests/Fixtures/Saloon/details-incorrect-request.json index b0205e8..01b7572 100644 --- a/tests/Fixtures/Saloon/details-incorrect-request.json +++ b/tests/Fixtures/Saloon/details-incorrect-request.json @@ -1,28 +1 @@ -{ - "statusCode": 404, - "headers": { - "Date": "Tue, 08 Aug 2023 13:18:12 GMT", - "Content-Type": "application\/json; charset=utf-8", - "Transfer-Encoding": "chunked", - "Connection": "keep-alive", - "strict-transport-security": "max-age=0;", - "cache-control": "no-cache", - "x-zendesk-origin-server": "classic-app-server-759558d96c-8dfnl", - "x-request-id": [ - "7f380b3dda7803b9-LHR", - "7f380b3dda7803b9-LHR" - ], - "x-runtime": "0.022401", - "X-Zendesk-Zorg": "yes", - "CF-Cache-Status": "DYNAMIC", - "Set-Cookie": [ - "__cf_bm=oWgCGqj6tmJCV2tMr88g2GQEQAgQMOP2NxPrl.BGPGU-1691500692-0-AbZ4KZWi7MBVu5Kwo+FdPjZadDlf45E5fnGBMQ178FSegJupgGFsza+v0R5EOfn\/1YjMO58G5tROfJBVKC3QVG1QGgKuQLo\/LGyTrHwPfFdu; path=\/; expires=Tue, 08-Aug-23 13:48:12 GMT; domain=.zendesk.com; HttpOnly; Secure; SameSite=None", - "__cfruid=5549c1de53c611e745835a36b2ba231e201d856d-1691500692; path=\/; domain=.zendesk.com; HttpOnly; Secure; SameSite=None" - ], - "Report-To": "{\"endpoints\":[{\"url\":\"https:\\\/\\\/a.nel.cloudflare.com\\\/report\\\/v3?s=uwn7TtPaAUhwgPUZpwt32SiUOotc6%2FpIY4bkdsZzJUSM3ARWKjcnoi8yji1Yw34Rgx5Sd6t57EEqr29B8CKIgUywW2OtO6FIApa1%2BmjX5nmbn8ZX6Nm1I3RmUfny03lM2xuQdkTa2%2BL5pkuW9prNT8UQKCzS\"}],\"group\":\"cf-nel\",\"max_age\":604800}", - "NEL": "{\"success_fraction\":0,\"report_to\":\"cf-nel\",\"max_age\":604800}", - "Server": "cloudflare", - "CF-RAY": "7f380b3dda7803b9-LHR" - }, - "data": "{\n \"error\": {\n \"title\": \"No help desk at codebarsolutionsagwrong.zendesk.com\",\n \"message\": \"There is no help desk configured at this address. This means that the address is available and that you can claim it at http:\/\/www.zendesk.com\/signup\"\n }\n}\n" -} +{"statusCode":404,"headers":{"Date":"Fri, 08 Sep 2023 22:25:14 GMT","Content-Type":"application\/json; charset=utf-8","Transfer-Encoding":"chunked","Connection":"keep-alive","strict-transport-security":"max-age=0;","cache-control":"no-cache","x-zendesk-origin-server":"classic-app-server-6b56fbdf4b-44445","x-request-id":["803a9b300a3575d7-LHR","803a9b300a3575d7-LHR"],"x-runtime":"0.012599","X-Zendesk-Zorg":"yes","CF-Cache-Status":"DYNAMIC","Set-Cookie":["__cf_bm=pVzUlgfK281lnisjjbGHWi4lRs5znek8y2WwsMw9wy8-1694211914-0-AYjbMqxpVM2LUHyRzpD3fAOXqWWegD1siCjnJTE7AK6nenL53SaCY+FtbsMxwWICfowsecbETOZQMW3DVX+1NwC3NSGHl9nJJHg\/XtR9IhBL; path=\/; expires=Fri, 08-Sep-23 22:55:14 GMT; domain=.zendesk.com; HttpOnly; Secure; SameSite=None","__cfruid=69818a20caf2c2ea7dceff21af7d00256667759b-1694211914; path=\/; domain=.zendesk.com; HttpOnly; Secure; SameSite=None"],"Report-To":"{\"endpoints\":[{\"url\":\"https:\\\/\\\/a.nel.cloudflare.com\\\/report\\\/v3?s=rBvCe8hC%2FL4CuzILpj%2B3bs6TPq3E%2FNjNqamBuTHy2%2FfwfxNC18955D5kckd%2BFwbfcM7Ouk8mtxKWXihcfzaqwJiXu0%2BVvY%2Bu%2FSvAXroTRzU2EpwhsWAy%2Bf%2F4RmXbHMSac%2BRiTVQpi9KcptcLCFOsUEUZ2RdM\"}],\"group\":\"cf-nel\",\"max_age\":604800}","NEL":"{\"success_fraction\":0,\"report_to\":\"cf-nel\",\"max_age\":604800}","Server":"cloudflare","CF-RAY":"803a9b300a3575d7-LHR"},"data":"{\n \"error\": {\n \"title\": \"No help desk at codebarsolutionsagwrong.zendesk.com\",\n \"message\": \"There is no help desk configured at this address. This means that the address is available and that you can claim it at http:\/\/www.zendesk.com\/signup\"\n }\n}\n"} \ No newline at end of file diff --git a/tests/Fixtures/Saloon/single-ticket-request.json b/tests/Fixtures/Saloon/single-ticket-request.json index 7ec8913..3ea3db5 100644 --- a/tests/Fixtures/Saloon/single-ticket-request.json +++ b/tests/Fixtures/Saloon/single-ticket-request.json @@ -1,37 +1 @@ -{ - "statusCode": 200, - "headers": { - "Date": "Mon, 03 Jul 2023 11:31:04 GMT", - "Content-Type": "application\/json; charset=utf-8", - "Transfer-Encoding": "chunked", - "Connection": "keep-alive", - "x-zendesk-api-version": "v2", - "x-zendesk-application-version": "v17438", - "x-frame-options": "SAMEORIGIN", - "x-rate-limit": "400", - "rate-limit": "400", - "x-rate-limit-remaining": "398", - "rate-limit-remaining": "398", - "rate-limit-reset": "56", - "strict-transport-security": "max-age=31536000;", - "etag": "W\/\"f6a375c66420a3a7c52a087aa0f3bb47\"", - "cache-control": "max-age=0, private, must-revalidate", - "x-zendesk-origin-server": "classic-app-server-6fc8db697c-js56h", - "set-cookie": [ - "_zendesk_cookie=BAhJIhl7ImRldmljZV90b2tlbnMiOnt9fQY6BkVU--0bf2100788cb010d0183feca16aaf88ccaf719ca; path=\/; expires=Wed, 03 Jul 2024 07:05:41 GMT; secure; HttpOnly; SameSite=None", - "__cfruid=b15e262f7b806ba2db1221699a831cc39e74cd44-1688383864; path=\/; domain=.codebarsolutionsag.zendesk.com; HttpOnly; Secure; SameSite=None" - ], - "x-request-id": [ - "7e0ecccb0ef7414d-LHR", - "7e0ecccb0ef7414d-LHR" - ], - "x-runtime": "0.086786", - "X-Zendesk-Zorg": "yes", - "CF-Cache-Status": "DYNAMIC", - "Report-To": "{\"endpoints\":[{\"url\":\"https:\\\/\\\/a.nel.cloudflare.com\\\/report\\\/v3?s=7lMEsubYh03mZhbyhOB7legoUvkomiPxbsQOg0HD6GL0OxkjWkOR0%2BYeSVdaW9J2uI%2FTZdGSdesx8628LQHv%2BSSghfw776Er2QMrCaswrMMD6WyL4RTiVF5m%2F20KZSDfwoR4VeTsATquzrBuUeD0Gg%3D%3D\"}],\"group\":\"cf-nel\",\"max_age\":604800}", - "NEL": "{\"success_fraction\":0.01,\"report_to\":\"cf-nel\",\"max_age\":604800}", - "Server": "cloudflare", - "CF-RAY": "7e0ecccb0ef7414d-LHR" - }, - "data": "{\"ticket\":{\"url\":\"https:\/\/codebarsolutionsag.zendesk.com\/api\/v2\/tickets\/81.json\",\"id\":81,\"external_id\":null,\"via\":{\"channel\":\"api\",\"source\":{\"from\":{},\"to\":{},\"rel\":null}},\"created_at\":\"2023-07-03T11:16:03Z\",\"updated_at\":\"2023-07-03T11:16:05Z\",\"type\":null,\"subject\":\"My printer is on fire!\",\"raw_subject\":\"My printer is on fire!\",\"description\":\"The smoke is very colorful.\",\"priority\":\"urgent\",\"status\":\"open\",\"recipient\":null,\"requester_id\":17145664265741,\"submitter_id\":17145664265741,\"assignee_id\":17145664265741,\"organization_id\":17145651654157,\"group_id\":17145664762125,\"collaborator_ids\":[],\"follower_ids\":[],\"email_cc_ids\":[],\"forum_topic_id\":null,\"problem_id\":null,\"has_incidents\":false,\"is_public\":true,\"due_at\":null,\"tags\":[],\"custom_fields\":[{\"id\":17146061349901,\"value\":null},{\"id\":17195718961677,\"value\":\"Check field works\"},{\"id\":17195752153741,\"value\":\"Check field works number 2\"}],\"satisfaction_rating\":null,\"sharing_agreement_ids\":[],\"custom_status_id\":17145678334989,\"fields\":[{\"id\":17146061349901,\"value\":null},{\"id\":17195718961677,\"value\":\"Check field works\"},{\"id\":17195752153741,\"value\":\"Check field works number 2\"}],\"followup_ids\":[],\"ticket_form_id\":17145664563725,\"brand_id\":17145651602957,\"allow_channelback\":false,\"allow_attachments\":true,\"from_messaging_channel\":false}}" -} +{"statusCode":200,"headers":{"Date":"Fri, 08 Sep 2023 22:27:33 GMT","Content-Type":"application\/json; charset=utf-8","Transfer-Encoding":"chunked","Connection":"keep-alive","x-zendesk-api-version":"v2","x-zendesk-application-version":"v18303","x-frame-options":"SAMEORIGIN","x-rate-limit":"400","rate-limit":"400","x-rate-limit-remaining":"399","rate-limit-remaining":"399","rate-limit-reset":"27","strict-transport-security":"max-age=31536000; includeSubDomains","etag":"W\/\"c9dbc9b2c6d7be31c4aea90682a55143\"","cache-control":"max-age=0, private, must-revalidate","set-cookie":["_zendesk_cookie=BAhJIhl7ImRldmljZV90b2tlbnMiOnt9fQY6BkVU--0bf2100788cb010d0183feca16aaf88ccaf719ca; path=\/; expires=Sat, 07 Sep 2024 22:49:54 GMT; secure; HttpOnly; SameSite=None","__cfruid=4a250fcac281106e9e27a70f8b47605a03319695-1694212053; path=\/; domain=.codebarsolutions.zendesk.com; HttpOnly; Secure; SameSite=None"],"x-zendesk-origin-server":"classic-app-server-55f8b9dd4b-9qs56","x-request-id":["803a9e95cd23240d-LHR","803a9e95cd23240d-LHR"],"x-runtime":"0.092172","X-Zendesk-Zorg":"yes","CF-Cache-Status":"DYNAMIC","Report-To":"{\"endpoints\":[{\"url\":\"https:\\\/\\\/a.nel.cloudflare.com\\\/report\\\/v3?s=JfpGwpTPAnVUVQDIuLNwVv4YmLCFBy3dB00V1gHPqeksNx9eWMyMFfF8A8q04yf2BujKFY0xTxVEo1x2yHvGnkmHNlYcGaClghr9JHtpZGeSqIiVSUsCW%2Bmijh91e8YZ5zr9XB5pYyNmzhQ7q2o%3D\"}],\"group\":\"cf-nel\",\"max_age\":604800}","NEL":"{\"success_fraction\":0.01,\"report_to\":\"cf-nel\",\"max_age\":604800}","Server":"cloudflare","CF-RAY":"803a9e95cd23240d-LHR"},"data":"{\"ticket\":{\"url\":\"https:\/\/codebarsolutions.zendesk.com\/api\/v2\/tickets\/15.json\",\"id\":15,\"external_id\":null,\"via\":{\"channel\":\"api\",\"source\":{\"from\":{},\"to\":{},\"rel\":null}},\"created_at\":\"2023-09-08T22:25:13Z\",\"updated_at\":\"2023-09-08T22:25:13Z\",\"type\":null,\"subject\":\"My printer is on fire!\",\"raw_subject\":\"My printer is on fire!\",\"description\":\"The smoke is very colorful.\",\"priority\":\"urgent\",\"status\":\"open\",\"recipient\":null,\"requester_id\":10344275987996,\"submitter_id\":10344275987996,\"assignee_id\":10344275987996,\"organization_id\":10344276178204,\"group_id\":10344307646492,\"collaborator_ids\":[],\"follower_ids\":[],\"email_cc_ids\":[],\"forum_topic_id\":null,\"problem_id\":null,\"has_incidents\":false,\"is_public\":true,\"due_at\":null,\"tags\":[],\"custom_fields\":[{\"id\":10344329458332,\"value\":null}],\"satisfaction_rating\":null,\"sharing_agreement_ids\":[],\"custom_status_id\":10344313751708,\"fields\":[{\"id\":10344329458332,\"value\":null}],\"followup_ids\":[],\"ticket_form_id\":10344290972956,\"brand_id\":10344297007388,\"allow_channelback\":false,\"allow_attachments\":true,\"from_messaging_channel\":false}}"} \ No newline at end of file diff --git a/tests/Pest.php b/tests/Pest.php index b07669c..4cd9205 100644 --- a/tests/Pest.php +++ b/tests/Pest.php @@ -9,11 +9,11 @@ Event::fake(); })->in(__DIR__); -uses()->beforeEach(function () { - config([ - 'zendesk.subdomain' => 'subdomain', - 'zendesk.auth.method' => 'token', - 'zendesk.auth.email_address' => 'test@example.com', - 'zendesk.auth.api_token' => 'token', - ]); -})->in(__DIR__.'/Requests'); +//uses()->beforeEach(function () { +// config([ +// 'zendesk.subdomain' => 'subdomain', +// 'zendesk.auth.method' => 'token', +// 'zendesk.auth.email_address' => 'test@example.com', +// 'zendesk.auth.api_token' => 'token', +// ]); +//})->in(__DIR__.'/Requests'); diff --git a/tests/Requests/AllTicketsRequestTest.php b/tests/Requests/AllTicketsRequestTest.php index c64683f..e4910cd 100644 --- a/tests/Requests/AllTicketsRequestTest.php +++ b/tests/Requests/AllTicketsRequestTest.php @@ -18,25 +18,14 @@ $mockClient->assertSent(AllTicketsRequest::class); - expect($response->dto()->count)->toBe(2) - ->and($response->dto()->tickets[1]['id'])->toBe(81) - ->and($response->dto()->tickets[1]['subject'])->toBe('My printer is on fire!') - ->and($response->dto()->tickets[1]['raw_subject'])->toBe('My printer is on fire!') - ->and($response->dto()->tickets[1]['description'])->toBe('The smoke is very colorful.') - ->and($response->dto()->tickets[1]['priority'])->toBe(TicketPriority::URGENT) - ->and($response->dto()->tickets[1]['custom_fields'][1]['id'])->toBe(17195718961677) - ->and($response->dto()->tickets[1]['custom_fields'][1]['value'])->toBe('Check field works') - ->and($response->dto()->tickets[1]['custom_fields'][2]['id'])->toBe(17195752153741) - ->and($response->dto()->tickets[1]['custom_fields'][2]['value'])->toBe('Check field works number 2') - ->and($response->dto()->tickets[0]['id'])->toBe(79) - ->and($response->dto()->tickets[0]['subject'])->toBe('Eine neue Anfrage der Bärtschi ist eingetroffen: Projekt #1.') - ->and($response->dto()->tickets[0]['raw_subject'])->toBe('Eine neue Anfrage der Bärtschi ist eingetroffen: Projekt #1.') - ->and($response->dto()->tickets[0]['description']) - ->toBe("Eine neue Anfrage der Bärtschi ist eingetroffen.\n\nAnfrage\nIdentifikation 1\nBemerkung asdasd\nURL https://app.pv.test/nova/resources/inquiries/1\nErstellt am 01.07.2023 14:21 Uhr\n**Kunde**\nKunden Bärtschi\nKunden ID 437046\nBenutzer ID 437046_ralph\nBenutzername Ralph Senn\n**Konfiguration**\nName Projekt #1\nDachform Sattel-/Pultdach\nMontage Aufdach\nHerkunft Asiatisch\nWechselrichter Typ String\n**Adresse**\nStrasse Mühlematten 12\nPLZ 4455\nOrt Zunzgen\nLand CH") + expect($response->dto()->count)->toBe(1) + ->and($response->dto()->tickets[0]['id'])->toBe(15) + ->and($response->dto()->tickets[0]['subject'])->toBe('My printer is on fire!') + ->and($response->dto()->tickets[0]['raw_subject'])->toBe('My printer is on fire!') + ->and($response->dto()->tickets[0]['description'])->toBe('The smoke is very colorful.') ->and($response->dto()->tickets[0]['priority'])->toBe(TicketPriority::URGENT) ->and($response->dto()->tickets[0]['custom_fields'][1]['id'])->toBe(17195718961677) - ->and($response->dto()->tickets[0]['custom_fields'][1]['value'])->toBe(null) + ->and($response->dto()->tickets[0]['custom_fields'][1]['value'])->toBe('Check field works') ->and($response->dto()->tickets[0]['custom_fields'][2]['id'])->toBe(17195752153741) - ->and($response->dto()->tickets[0]['custom_fields'][2]['value'])->toBe(null); - + ->and($response->dto()->tickets[0]['custom_fields'][2]['value'])->toBe('Check field works number 2'); }); diff --git a/tests/Requests/CountTicketsRequestTest.php b/tests/Requests/CountTicketsRequestTest.php index 86feb66..8368a0b 100644 --- a/tests/Requests/CountTicketsRequestTest.php +++ b/tests/Requests/CountTicketsRequestTest.php @@ -17,6 +17,6 @@ $mockClient->assertSent(CountTicketsRequest::class); - expect($response->dto()->value)->toBe(4) - ->and($response->dto()->refreshed_at->toDateTimeString())->toBe('2023-07-03 13:19:53'); + expect($response->dto()->value)->toBe(1) + ->and($response->dto()->refreshed_at->toDateTimeString())->toBe('2023-09-08 22:25:14'); }); diff --git a/tests/Requests/CreateAttachmentRequestTest.php b/tests/Requests/CreateAttachmentRequestTest.php index 0c7a590..4f6d375 100644 --- a/tests/Requests/CreateAttachmentRequestTest.php +++ b/tests/Requests/CreateAttachmentRequestTest.php @@ -23,11 +23,11 @@ $mockClient->assertSent(CreateAttachmentRequest::class); - expect($response->dto()->token)->toBe('OPvgMbfg5Der4DYn66hTC31in') + expect($response->dto()->token)->toBe('QyLNkTdFhrpxXu7JzlZcJWLat') ->and($response->dto()->attachment->content_type)->toBe('image/png') ->and($response->dto()->attachment->size)->toBe(26271) ->and($response->dto()->attachment->file_name)->toBe('test.png') ->and($response->dto()->attachment->width)->toBe('640') ->and($response->dto()->attachment->height)->toBe('360') - ->and($response->dto()->attachment->content_url)->toBe('https://codebarsolutionsag.zendesk.com/attachments/token/52HCaRgRZM38MvaUuUQsYzhUA/?name=test.png'); + ->and($response->dto()->attachment->content_url)->toBe('https://codebarsolutions.zendesk.com/attachments/token/bClC0CjrndApmHI1aO9lKT80C/?name=test.png'); }); diff --git a/tests/Requests/ShowUserRequestTest.php b/tests/Requests/ShowUserRequestTest.php new file mode 100644 index 0000000..ad4e85a --- /dev/null +++ b/tests/Requests/ShowUserRequestTest.php @@ -0,0 +1,33 @@ + MockResponse::fixture('single-ticket-request'), +// ]); + + $connector = new ZendeskConnector; +// $connector->withMockClient($mockClient); + + $response = $connector->send(new ShowUserRequest(81)); + + ray($response->json()); + +// $mockClient->assertSent(SingleTicketRequest::class); + + expect($response->dto()->id)->toBe(81) + ->and($response->dto()->subject)->toBe('My printer is on fire!') + ->and($response->dto()->raw_subject)->toBe('My printer is on fire!') + ->and($response->dto()->description)->toBe('The smoke is very colorful.') + ->and($response->dto()->priority)->toBe(TicketPriority::URGENT) + ->and($response->dto()->custom_fields[1]['id'])->toBe(17195718961677) + ->and($response->dto()->custom_fields[1]['value'])->toBe('Check field works') + ->and($response->dto()->custom_fields[2]['id'])->toBe(17195752153741) + ->and($response->dto()->custom_fields[2]['value'])->toBe('Check field works number 2'); +})->skip(); diff --git a/tests/Requests/SingleTicketRequestTest.php b/tests/Requests/SingleTicketRequestTest.php index 23c32f7..a7f8003 100644 --- a/tests/Requests/SingleTicketRequestTest.php +++ b/tests/Requests/SingleTicketRequestTest.php @@ -14,11 +14,11 @@ $connector = new ZendeskConnector; $connector->withMockClient($mockClient); - $response = $connector->send(new SingleTicketRequest(81)); + $response = $connector->send(new SingleTicketRequest(15)); $mockClient->assertSent(SingleTicketRequest::class); - expect($response->dto()->id)->toBe(81) + expect($response->dto()->id)->toBe(15) ->and($response->dto()->subject)->toBe('My printer is on fire!') ->and($response->dto()->raw_subject)->toBe('My printer is on fire!') ->and($response->dto()->description)->toBe('The smoke is very colorful.') From 28b9e6e946ab9d66c18c67e8e42c30837c67a394 Mon Sep 17 00:00:00 2001 From: Sebastian Fix
Date: Sat, 9 Sep 2023 14:05:06 +0200
Subject: [PATCH 03/17] WIP
---
.github/workflows/run-tests.yml | 9 ++++-----
src/Dto/Tickets/AllTicketsDTO.php | 4 ++++
src/Dto/Tickets/CountTicketsDTO.php | 10 ++++------
src/Dto/Tickets/SingleTicketDTO.php | 9 ++++-----
tests/Connectors/ZendeskConnectorTest.php | 1 -
5 files changed, 16 insertions(+), 17 deletions(-)
diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml
index 9f9a31c..83e352e 100644
--- a/.github/workflows/run-tests.yml
+++ b/.github/workflows/run-tests.yml
@@ -17,7 +17,7 @@ jobs:
php: [ 8.2 ]
laravel: [ 10.* ]
#stability: [ prefer-lowest, prefer-stable ]
- stability: [ prefer-stable ]
+ stability: [ prefer-lowest, prefer-stable ]
include:
- laravel: 10.*
testbench: 8.*
@@ -45,12 +45,11 @@ jobs:
composer require "laravel/framework:${{ matrix.laravel }}" "orchestra/testbench:${{ matrix.testbench }}" --no-interaction --no-update
composer update --${{ matrix.stability }} --prefer-dist --no-interaction
+ - name: Set phpunit.xml
+ run: cp phpunit.xml.dist phpunit.xml
+
- name: Execute tests
run: vendor/bin/pest
- env:
- ZAMMAD_URL: ${{ secrets.ZAMMAD_URL }}
- ZAMMAD_TOKEN: ${{ secrets.ZAMMAD_TOKEN }}
- ZAMMAD_OBJECT_REFERENCE_ERROR_IGNORE: true
- name: Store test reports
uses: actions/upload-artifact@v2
diff --git a/src/Dto/Tickets/AllTicketsDTO.php b/src/Dto/Tickets/AllTicketsDTO.php
index aeb9672..0e04158 100644
--- a/src/Dto/Tickets/AllTicketsDTO.php
+++ b/src/Dto/Tickets/AllTicketsDTO.php
@@ -19,6 +19,10 @@ public function __construct(
public static function fromResponse(Response $response): self
{
+ if ($response->failed()) {
+ throw new \Exception('Failed to get all tickets', $response->status());
+ }
+
$data = $response->json();
if (! $data) {
diff --git a/src/Dto/Tickets/CountTicketsDTO.php b/src/Dto/Tickets/CountTicketsDTO.php
index 53de431..9c0b895 100644
--- a/src/Dto/Tickets/CountTicketsDTO.php
+++ b/src/Dto/Tickets/CountTicketsDTO.php
@@ -2,8 +2,6 @@
namespace CodebarAg\Zendesk\Dto\Tickets;
-use Exception;
-use Illuminate\Support\Arr;
use Illuminate\Support\Carbon;
use Saloon\Http\Response;
use Spatie\LaravelData\Data;
@@ -18,12 +16,12 @@ public function __construct(
public static function fromResponse(Response $response): self
{
- $data = Arr::get($response->json(), 'count');
-
- if (! $data) {
- throw new Exception('Unable to create DTO. Data missing from response.');
+ if ($response->failed()) {
+ throw new \Exception('Failed to get tickets count', $response->status());
}
+ $data = $response->json()['count'];
+
return new self(
value: $data['value'],
refreshed_at: Carbon::parse($data['refreshed_at']),
diff --git a/src/Dto/Tickets/SingleTicketDTO.php b/src/Dto/Tickets/SingleTicketDTO.php
index 8ec53ec..c66d85e 100644
--- a/src/Dto/Tickets/SingleTicketDTO.php
+++ b/src/Dto/Tickets/SingleTicketDTO.php
@@ -5,7 +5,6 @@
use CodebarAg\Zendesk\Dto\Tickets\Comments\CommentDTO;
use CodebarAg\Zendesk\Enums\TicketPriority;
use CodebarAg\Zendesk\Enums\TicketType;
-use Exception;
use Illuminate\Support\Arr;
use Illuminate\Support\Carbon;
use Saloon\Http\Response;
@@ -70,12 +69,12 @@ public function __construct(
public static function fromResponse(Response $response): self
{
- $data = Arr::get($response->json(), 'ticket');
-
- if (! $data) {
- throw new Exception('Unable to create DTO. Data missing from response.');
+ if ($response->failed()) {
+ throw new \Exception('Failed to get a single ticket', $response->status());
}
+ $data = $response->json()['ticket'];
+
return self::fromArray($data);
}
diff --git a/tests/Connectors/ZendeskConnectorTest.php b/tests/Connectors/ZendeskConnectorTest.php
index 413adf1..92a3db5 100644
--- a/tests/Connectors/ZendeskConnectorTest.php
+++ b/tests/Connectors/ZendeskConnectorTest.php
@@ -165,7 +165,6 @@
expect($token)->toBe('test@example.com:test-password');
});
-
it('will throw and authentication error when details are incorrect', function () {
config([
'zendesk.subdomain' => 'codebarsolutionsagwrong',
From 58a13fa87310622eca64906d8d5e92dd4f24adda Mon Sep 17 00:00:00 2001
From: Sebastian Fix
Date: Wed, 20 Sep 2023 13:33:27 +0200
Subject: [PATCH 04/17] Updated Saloon
---
composer.json | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/composer.json b/composer.json
index 6a50ef4..aa86424 100644
--- a/composer.json
+++ b/composer.json
@@ -22,8 +22,8 @@
"guzzlehttp/guzzle": "^7.2",
"illuminate/contracts": "^10.0",
"saloonphp/cache-plugin": "^2.1",
- "sammyjo20/saloon": "^2.0",
- "sammyjo20/saloon-laravel": "^2.0",
+ "saloonphp/laravel-plugin": "^2.0",
+ "saloonphp/saloon": "^2.0",
"spatie/laravel-data": "^3.6",
"spatie/laravel-package-tools": "^1.9.2"
},
From 8d9d7b4402d18be6650b2d81625087b838b8f991 Mon Sep 17 00:00:00 2001
From: Sebastian Fix
Date: Wed, 20 Sep 2023 13:37:39 +0200
Subject: [PATCH 05/17] WIP
---
tests/Core/ArchTest.php | 6 ++++++
tests/Pest.php | 18 +++++++++---------
tests/Requests/ShowUserRequestTest.php | 12 +++++-------
3 files changed, 20 insertions(+), 16 deletions(-)
create mode 100644 tests/Core/ArchTest.php
diff --git a/tests/Core/ArchTest.php b/tests/Core/ArchTest.php
new file mode 100644
index 0000000..bdb6d11
--- /dev/null
+++ b/tests/Core/ArchTest.php
@@ -0,0 +1,6 @@
+expect(['dd', 'ray', 'dump'])
+ ->not()
+ ->toBeUsed();
diff --git a/tests/Pest.php b/tests/Pest.php
index 4cd9205..112de34 100644
--- a/tests/Pest.php
+++ b/tests/Pest.php
@@ -6,14 +6,14 @@
uses(TestCase::class)->in(__DIR__);
uses()->beforeEach(function () {
- Event::fake();
+ Event::fake();
})->in(__DIR__);
-//uses()->beforeEach(function () {
-// config([
-// 'zendesk.subdomain' => 'subdomain',
-// 'zendesk.auth.method' => 'token',
-// 'zendesk.auth.email_address' => 'test@example.com',
-// 'zendesk.auth.api_token' => 'token',
-// ]);
-//})->in(__DIR__.'/Requests');
+uses()->beforeEach(function () {
+ config([
+ 'zendesk.subdomain' => 'subdomain',
+ 'zendesk.auth.method' => 'token',
+ 'zendesk.auth.email_address' => 'test@example.com',
+ 'zendesk.auth.api_token' => 'token',
+ ]);
+})->in(__DIR__ . '/Requests');
diff --git a/tests/Requests/ShowUserRequestTest.php b/tests/Requests/ShowUserRequestTest.php
index ad4e85a..16af43a 100644
--- a/tests/Requests/ShowUserRequestTest.php
+++ b/tests/Requests/ShowUserRequestTest.php
@@ -8,18 +8,16 @@
use Saloon\Laravel\Http\Faking\MockClient;
it('can show a user', closure: function () {
-// $mockClient = new MockClient([
-// SingleTicketRequest::class => MockResponse::fixture('single-ticket-request'),
-// ]);
+ $mockClient = new MockClient([
+ SingleTicketRequest::class => MockResponse::fixture('single-ticket-request'),
+ ]);
$connector = new ZendeskConnector;
-// $connector->withMockClient($mockClient);
+ $connector->withMockClient($mockClient);
$response = $connector->send(new ShowUserRequest(81));
- ray($response->json());
-
-// $mockClient->assertSent(SingleTicketRequest::class);
+ $mockClient->assertSent(SingleTicketRequest::class);
expect($response->dto()->id)->toBe(81)
->and($response->dto()->subject)->toBe('My printer is on fire!')
From f4a64d94f35f596ec666cd9e8850efb9192793f2 Mon Sep 17 00:00:00 2001
From: Sebastian Fix
Date: Wed, 20 Sep 2023 13:39:19 +0200
Subject: [PATCH 06/17] wip
---
phpunit.xml.dist | 34 +++++--------------
src/Requests/CreateSingleTicketRequest.php | 2 +-
src/Requests/ShowUserRequest.php | 1 -
tests/Pest.php | 16 ++++-----
.../CreateSingleTicketRequestTest.php | 1 -
tests/Requests/ShowUserRequestTest.php | 4 +--
6 files changed, 20 insertions(+), 38 deletions(-)
diff --git a/phpunit.xml.dist b/phpunit.xml.dist
index d6e3b1a..1ed0a7d 100644
--- a/phpunit.xml.dist
+++ b/phpunit.xml.dist
@@ -1,32 +1,11 @@
-
+
tests
-
- ./src
-
@@ -37,8 +16,13 @@
-
-
-
+
+
+
+
diff --git a/src/Requests/CreateSingleTicketRequest.php b/src/Requests/CreateSingleTicketRequest.php
index 4e434f3..de890af 100644
--- a/src/Requests/CreateSingleTicketRequest.php
+++ b/src/Requests/CreateSingleTicketRequest.php
@@ -23,7 +23,7 @@ public function resolveEndpoint(): string
public function __construct(
readonly protected array|SingleTicketDTO $createTicket,
- readonly protected null|string $onBehalfOf = null,
+ readonly protected ?string $onBehalfOf = null,
) {
}
diff --git a/src/Requests/ShowUserRequest.php b/src/Requests/ShowUserRequest.php
index c539c24..681b8ec 100644
--- a/src/Requests/ShowUserRequest.php
+++ b/src/Requests/ShowUserRequest.php
@@ -2,7 +2,6 @@
namespace CodebarAg\Zendesk\Requests;
-use CodebarAg\Zendesk\Dto\Tickets\SingleTicketDTO;
use Exception;
use Saloon\Contracts\Response;
use Saloon\Enums\Method;
diff --git a/tests/Pest.php b/tests/Pest.php
index 112de34..b07669c 100644
--- a/tests/Pest.php
+++ b/tests/Pest.php
@@ -6,14 +6,14 @@
uses(TestCase::class)->in(__DIR__);
uses()->beforeEach(function () {
- Event::fake();
+ Event::fake();
})->in(__DIR__);
uses()->beforeEach(function () {
- config([
- 'zendesk.subdomain' => 'subdomain',
- 'zendesk.auth.method' => 'token',
- 'zendesk.auth.email_address' => 'test@example.com',
- 'zendesk.auth.api_token' => 'token',
- ]);
-})->in(__DIR__ . '/Requests');
+ config([
+ 'zendesk.subdomain' => 'subdomain',
+ 'zendesk.auth.method' => 'token',
+ 'zendesk.auth.email_address' => 'test@example.com',
+ 'zendesk.auth.api_token' => 'token',
+ ]);
+})->in(__DIR__.'/Requests');
diff --git a/tests/Requests/CreateSingleTicketRequestTest.php b/tests/Requests/CreateSingleTicketRequestTest.php
index 13a53e7..a8d1c07 100644
--- a/tests/Requests/CreateSingleTicketRequestTest.php
+++ b/tests/Requests/CreateSingleTicketRequestTest.php
@@ -45,7 +45,6 @@
->and($response->dto()->custom_fields[2]['value'])->toBe('Check field works number 2');
});
-
it('can get create a single ticket on behalf of a user', closure: function () {
$mockClient = new MockClient([
CreateSingleTicketRequest::class => MockResponse::fixture('create-single-ticket-request-on-behalf-of'),
diff --git a/tests/Requests/ShowUserRequestTest.php b/tests/Requests/ShowUserRequestTest.php
index 16af43a..c074afc 100644
--- a/tests/Requests/ShowUserRequestTest.php
+++ b/tests/Requests/ShowUserRequestTest.php
@@ -10,14 +10,14 @@
it('can show a user', closure: function () {
$mockClient = new MockClient([
SingleTicketRequest::class => MockResponse::fixture('single-ticket-request'),
- ]);
+ ]);
$connector = new ZendeskConnector;
$connector->withMockClient($mockClient);
$response = $connector->send(new ShowUserRequest(81));
- $mockClient->assertSent(SingleTicketRequest::class);
+ $mockClient->assertSent(SingleTicketRequest::class);
expect($response->dto()->id)->toBe(81)
->and($response->dto()->subject)->toBe('My printer is on fire!')
From 79bd83dde2275bd6615e7f652e825e932bf68558 Mon Sep 17 00:00:00 2001
From: Sebastian Fix
Date: Wed, 20 Sep 2023 13:39:46 +0200
Subject: [PATCH 07/17] wip
---
todo.md | 144 --------------------------------------------------------
1 file changed, 144 deletions(-)
delete mode 100644 todo.md
diff --git a/todo.md b/todo.md
deleted file mode 100644
index f56f14c..0000000
--- a/todo.md
+++ /dev/null
@@ -1,144 +0,0 @@
-## POST /api/v2/tickets
-
-Takes a ticket object that specifies the ticket properties. The only required property is comment. See Ticket Comments.
-
-### Body
-
-```
-//Markdown formatting is supported in body but not in html_body. Example:
-
-{
-"ticket": {
-"comment": {
-"body": "The smoke is very colorful."
-},
-"priority": "urgent",
-"subject": "My printer is on fire!"
-}
-}
-```
-
-### Response
-
-```
-// Status 201 Created
-
-{
- "ticket": {
- "assignee_id": 235323,
- "collaborator_ids": [
- 35334,
- 234
- ],
- "created_at": "2009-07-20T22:55:29Z",
- "custom_fields": [
- {
- "id": 27642,
- "value": "745"
- },
- {
- "id": 27648,
- "value": "yes"
- }
- ],
- "custom_status_id": 123,
- "description": "The fire is very colorful.",
- "due_at": null,
- "external_id": "ahg35h3jh",
- "follower_ids": [
- 35334,
- 234
- ],
- "from_messaging_channel": false,
- "group_id": 98738,
- "has_incidents": false,
- "id": 35436,
- "organization_id": 509974,
- "priority": "high",
- "problem_id": 9873764,
- "raw_subject": "{{dc.printer_on_fire}}",
- "recipient": "support@company.com",
- "requester_id": 20978392,
- "satisfaction_rating": {
- "comment": "Great support!",
- "id": 1234,
- "score": "good"
- },
- "sharing_agreement_ids": [
- 84432
- ],
- "status": "open",
- "subject": "Help, my printer is on fire!",
- "submitter_id": 76872,
- "tags": [
- "enterprise",
- "other_tag"
- ],
- "type": "incident",
- "updated_at": "2011-05-05T10:38:52Z",
- "url": "https://company.zendesk.com/api/v2/tickets/35436.json",
- "via": {
- "channel": "web"
- }
- }
-}
-```
-
-## POST /api/v2/uploads
-
-### DTO
-
-```
-{
- "content_type": "image/png",
- "content_url": "https://company.zendesk.com/attachments/my_funny_profile_pic.png",
- "file_name": "my_funny_profile_pic.png",
- "id": 928374,
- "size": 166144,
- "thumbnails": [
- {
- "content_type": "image/png",
- "content_url": "https://company.zendesk.com/attachments/my_funny_profile_pic_thumb.png",
- "file_name": "my_funny_profile_pic_thumb.png",
- "id": 928375,
- "size": 58298
- }
- ]
-}
-```
-
-### Response
-
-```
-{
- "upload": {
- "token": "4bLLKSOU63CPqaIeOMXYyXzUh",
- "expires_at": "2021-05-08T22:50:18Z",
- "attachment": {
- "url": "https://example.zendesk.com/api/v2/attachments/1503194928902.json",
- "id":1503194928902,
- "file_name": "order_issue.png",
- "content_url": "https://example.zendesk.com/attachments/token/vp7DnuiSvehLZtK2yrPjqJ1l6/?name=order_issue.png",
- "content_type": "image/png"
- },
- "attachments": [
- {
- "url": "https://example.zendesk.com/api/v2/attachments/1503194928902.json",
- "id":1503194928902,
- "file_name": "order_issue.png",
- "content_url": "https://example.zendesk.com/attachments/token/vp7DnuiSvehLZtK2yrPjqJ1l6/?name=order_issue.png",
- "content_type": "image/png"
- }
- ]
- }
-}
-```
-
-## PUT /api/v2/tickets/45135
-
-```
-curl https://example.zendesk.com/api/v2/tickets/45135 \
--d '{"ticket": {"comment": {"body": "Press play", "uploads": ["4bLLKSOU63CPqaIeOMXYyXzUh"]}}}' \
--H "Content-Type: application/json" \
--v -u {email_address}:{password} -X PUT
-```
From c220980c7bb29109cc9331cb31bf85b06a215e8f Mon Sep 17 00:00:00 2001
From: Sebastian Fix
Date: Wed, 20 Sep 2023 17:31:27 +0200
Subject: [PATCH 08/17] Updated .github workflows
---
.github/workflows/phpstan.yml | 5 ++++-
.github/workflows/run-tests.yml | 4 +---
src/Dto/Tickets/CountTicketsDTO.php | 7 ++++---
src/Dto/Tickets/SingleTicketDTO.php | 2 +-
4 files changed, 10 insertions(+), 8 deletions(-)
diff --git a/.github/workflows/phpstan.yml b/.github/workflows/phpstan.yml
index 900f541..8776e8f 100644
--- a/.github/workflows/phpstan.yml
+++ b/.github/workflows/phpstan.yml
@@ -1,6 +1,9 @@
name: PHPStan
on:
+ pull_request:
+ - '**.php'
+ - 'phpstan.neon.dist'
push:
paths:
- '**.php'
@@ -23,4 +26,4 @@ jobs:
uses: ramsey/composer-install@v2
- name: Run PHPStan
- run: ./vendor/bin/phpstan --error-format=github
+ run: ./vendor/bin/phpstan analyse src --error-format=github
diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml
index 83e352e..44dcd90 100644
--- a/.github/workflows/run-tests.yml
+++ b/.github/workflows/run-tests.yml
@@ -12,11 +12,9 @@ jobs:
strategy:
fail-fast: true
matrix:
- # os: [ ubuntu-latest, windows-latest ]
- os: [ ubuntu-latest ]
+ os: [ ubuntu-latest, windows-latest ]
php: [ 8.2 ]
laravel: [ 10.* ]
- #stability: [ prefer-lowest, prefer-stable ]
stability: [ prefer-lowest, prefer-stable ]
include:
- laravel: 10.*
diff --git a/src/Dto/Tickets/CountTicketsDTO.php b/src/Dto/Tickets/CountTicketsDTO.php
index 9c0b895..28260df 100644
--- a/src/Dto/Tickets/CountTicketsDTO.php
+++ b/src/Dto/Tickets/CountTicketsDTO.php
@@ -2,6 +2,7 @@
namespace CodebarAg\Zendesk\Dto\Tickets;
+use Illuminate\Support\Arr;
use Illuminate\Support\Carbon;
use Saloon\Http\Response;
use Spatie\LaravelData\Data;
@@ -20,11 +21,11 @@ public static function fromResponse(Response $response): self
throw new \Exception('Failed to get tickets count', $response->status());
}
- $data = $response->json()['count'];
+ $data = Arr::get($response->json(), 'count');
return new self(
- value: $data['value'],
- refreshed_at: Carbon::parse($data['refreshed_at']),
+ value: Arr::get($data, 'value'),
+ refreshed_at: Carbon::parse(Arr::get($data, 'refreshed_at')),
);
}
}
diff --git a/src/Dto/Tickets/SingleTicketDTO.php b/src/Dto/Tickets/SingleTicketDTO.php
index c66d85e..fccd446 100644
--- a/src/Dto/Tickets/SingleTicketDTO.php
+++ b/src/Dto/Tickets/SingleTicketDTO.php
@@ -73,7 +73,7 @@ public static function fromResponse(Response $response): self
throw new \Exception('Failed to get a single ticket', $response->status());
}
- $data = $response->json()['ticket'];
+ $data = Arr::get($response->json(), 'ticket');
return self::fromArray($data);
}
From a64725dbdf3eb7c6013801a9ac93184366c419d4 Mon Sep 17 00:00:00 2001
From: Sebastian Fix
Date: Wed, 20 Sep 2023 20:11:49 +0200
Subject: [PATCH 09/17] wip
---
phpunit.xml.dist | 2 +-
src/Requests/CreateSingleTicketRequest.php | 14 +--------
src/Requests/ShowUserRequest.php | 34 ----------------------
tests/Connectors/ZendeskConnectorTest.php | 2 ++
tests/Requests/ShowUserRequestTest.php | 31 --------------------
5 files changed, 4 insertions(+), 79 deletions(-)
delete mode 100644 src/Requests/ShowUserRequest.php
delete mode 100644 tests/Requests/ShowUserRequestTest.php
diff --git a/phpunit.xml.dist b/phpunit.xml.dist
index 1ed0a7d..39e9b20 100644
--- a/phpunit.xml.dist
+++ b/phpunit.xml.dist
@@ -16,7 +16,7 @@
-
+
diff --git a/src/Requests/CreateSingleTicketRequest.php b/src/Requests/CreateSingleTicketRequest.php
index de890af..a494d89 100644
--- a/src/Requests/CreateSingleTicketRequest.php
+++ b/src/Requests/CreateSingleTicketRequest.php
@@ -22,22 +22,10 @@ public function resolveEndpoint(): string
}
public function __construct(
- readonly protected array|SingleTicketDTO $createTicket,
- readonly protected ?string $onBehalfOf = null,
+ readonly protected array|SingleTicketDTO $createTicket
) {
}
- protected function defaultHeaders(): array
- {
- $headers = [];
-
- if ($this->onBehalfOf) {
- $headers['X-On-Behalf-Of'] = $this->onBehalfOf;
- }
-
- return $headers;
- }
-
protected function defaultBody(): array
{
$body = $this->createTicket;
diff --git a/src/Requests/ShowUserRequest.php b/src/Requests/ShowUserRequest.php
deleted file mode 100644
index 681b8ec..0000000
--- a/src/Requests/ShowUserRequest.php
+++ /dev/null
@@ -1,34 +0,0 @@
-userId = $userId;
- }
-
- public function resolveEndpoint(): string
- {
- return '/users/'.$this->userId.'.json';
- }
-
- public function createDtoFromResponse(Response $response): mixed
- {
- if (! $response->successful()) {
- throw new Exception('Request was not successful. Unable to create DTO.');
- }
-
- return $response->json();
- }
-}
diff --git a/tests/Connectors/ZendeskConnectorTest.php b/tests/Connectors/ZendeskConnectorTest.php
index 92a3db5..c335ca8 100644
--- a/tests/Connectors/ZendeskConnectorTest.php
+++ b/tests/Connectors/ZendeskConnectorTest.php
@@ -2,10 +2,12 @@
use CodebarAg\Zendesk\Requests\SingleTicketRequest;
use CodebarAg\Zendesk\ZendeskConnector;
+use Illuminate\Support\Facades\Config;
use Saloon\Http\Faking\MockResponse;
use Saloon\Laravel\Http\Faking\MockClient;
it('will throw an exception if a subdomain is not set', closure: function () {
+ Config::set('zendesk.subdomain');
$connector = new ZendeskConnector;
$connector->resolveBaseUrl();
diff --git a/tests/Requests/ShowUserRequestTest.php b/tests/Requests/ShowUserRequestTest.php
deleted file mode 100644
index c074afc..0000000
--- a/tests/Requests/ShowUserRequestTest.php
+++ /dev/null
@@ -1,31 +0,0 @@
- MockResponse::fixture('single-ticket-request'),
- ]);
-
- $connector = new ZendeskConnector;
- $connector->withMockClient($mockClient);
-
- $response = $connector->send(new ShowUserRequest(81));
-
- $mockClient->assertSent(SingleTicketRequest::class);
-
- expect($response->dto()->id)->toBe(81)
- ->and($response->dto()->subject)->toBe('My printer is on fire!')
- ->and($response->dto()->raw_subject)->toBe('My printer is on fire!')
- ->and($response->dto()->description)->toBe('The smoke is very colorful.')
- ->and($response->dto()->priority)->toBe(TicketPriority::URGENT)
- ->and($response->dto()->custom_fields[1]['id'])->toBe(17195718961677)
- ->and($response->dto()->custom_fields[1]['value'])->toBe('Check field works')
- ->and($response->dto()->custom_fields[2]['id'])->toBe(17195752153741)
- ->and($response->dto()->custom_fields[2]['value'])->toBe('Check field works number 2');
-})->skip();
From fd43b7d1c10beaadd8af26c7904f273b74745f8c Mon Sep 17 00:00:00 2001
From: Sebastian Fix
Date: Wed, 20 Sep 2023 20:18:46 +0200
Subject: [PATCH 10/17] WIP
---
.../CreateSingleTicketRequestTest.php | 41 -------------------
1 file changed, 41 deletions(-)
diff --git a/tests/Requests/CreateSingleTicketRequestTest.php b/tests/Requests/CreateSingleTicketRequestTest.php
index a8d1c07..22e8c43 100644
--- a/tests/Requests/CreateSingleTicketRequestTest.php
+++ b/tests/Requests/CreateSingleTicketRequestTest.php
@@ -44,44 +44,3 @@
->and($response->dto()->custom_fields[2]['id'])->toBe(17195752153741)
->and($response->dto()->custom_fields[2]['value'])->toBe('Check field works number 2');
});
-
-it('can get create a single ticket on behalf of a user', closure: function () {
- $mockClient = new MockClient([
- CreateSingleTicketRequest::class => MockResponse::fixture('create-single-ticket-request-on-behalf-of'),
- ]);
-
- $connector = new ZendeskConnector;
- $connector->withMockClient($mockClient);
-
- $response = $connector->send(new CreateSingleTicketRequest(
- createTicket: [
- 'comment' => CommentDTO::fromArray([
- 'body' => 'The smoke is very colorful.',
- ]),
- 'priority' => TicketPriority::URGENT,
- 'subject' => 'My printer is on fire!',
- 'custom_fields' => [
- [
- 'id' => 17195718961677,
- 'value' => 'Check field works',
- ],
- [
- 'id' => 17195752153741,
- 'value' => 'Check field works number 2',
- ],
- ],
- ],
- onBehalfOf: 'test@example.com'
- ));
-
- $mockClient->assertSent(CreateSingleTicketRequest::class);
-
- expect($response->dto()->subject)->toBe('My printer is on fire!')
- ->and($response->dto()->raw_subject)->toBe('My printer is on fire!')
- ->and($response->dto()->description)->toBe('The smoke is very colorful.')
- ->and($response->dto()->priority)->toBe(TicketPriority::URGENT)
- ->and($response->dto()->custom_fields[1]['id'])->toBe(17195718961677)
- ->and($response->dto()->custom_fields[1]['value'])->toBe('Check field works')
- ->and($response->dto()->custom_fields[2]['id'])->toBe(17195752153741)
- ->and($response->dto()->custom_fields[2]['value'])->toBe('Check field works number 2');
-});
From 753b5655fffd3b8ea38055fe45793bf588431ede Mon Sep 17 00:00:00 2001
From: Rhys Lees <43909932+RhysLees@users.noreply.github.com>
Date: Wed, 20 Sep 2023 23:23:58 +0100
Subject: [PATCH 11/17] WIP
---
phpunit.xml.bak | 44 +++++++++++++++++++
.../Fixtures/Saloon/all-tickets-request.json | 39 +---------------
.../Saloon/count-tickets-request.json | 2 +-
.../Saloon/create-attachment-request.json | 2 +-
...te-single-ticket-request-on-behalf-of.json | 1 -
.../Saloon/create-single-ticket-request.json | 2 +-
.../Saloon/details-incorrect-request.json | 2 +-
.../Saloon/single-ticket-request.json | 2 +-
tests/Pest.php | 9 ----
tests/Requests/AllTicketsRequestTest.php | 10 +++--
tests/Requests/CountTicketsRequestTest.php | 4 +-
.../Requests/CreateAttachmentRequestTest.php | 4 +-
.../CreateSingleTicketRequestTest.php | 8 ++--
tests/Requests/SingleTicketRequestTest.php | 8 ++--
14 files changed, 68 insertions(+), 69 deletions(-)
create mode 100644 phpunit.xml.bak
delete mode 100644 tests/Fixtures/Saloon/create-single-ticket-request-on-behalf-of.json
diff --git a/phpunit.xml.bak b/phpunit.xml.bak
new file mode 100644
index 0000000..5ae6cef
--- /dev/null
+++ b/phpunit.xml.bak
@@ -0,0 +1,44 @@
+
+
+
+
+ tests
+
+
+
+
+ ./src
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/tests/Fixtures/Saloon/all-tickets-request.json b/tests/Fixtures/Saloon/all-tickets-request.json
index 9b1059f..49dcc85 100644
--- a/tests/Fixtures/Saloon/all-tickets-request.json
+++ b/tests/Fixtures/Saloon/all-tickets-request.json
@@ -1,38 +1 @@
-{
- "statusCode": 200,
- "headers": {
- "Date": "Mon, 03 Jul 2023 11:31:03 GMT",
- "Content-Type": "application\/json; charset=utf-8",
- "Transfer-Encoding": "chunked",
- "Connection": "keep-alive",
- "x-zendesk-api-version": "v2",
- "x-zendesk-application-version": "v17438",
- "x-frame-options": "SAMEORIGIN",
- "zendesk-rate-limit-tickets-index": "total=100; remaining=99; resets=57",
- "x-rate-limit": "400",
- "rate-limit": "400",
- "x-rate-limit-remaining": "399",
- "rate-limit-remaining": "399",
- "rate-limit-reset": "57",
- "strict-transport-security": "max-age=31536000;",
- "etag": "W\/\"8cdd07d5c75ffd1b225da69dee7e9985\"",
- "cache-control": "max-age=0, private, must-revalidate",
- "x-zendesk-origin-server": "classic-app-server-6fc8db697c-cgrcj",
- "set-cookie": [
- "_zendesk_cookie=BAhJIhl7ImRldmljZV90b2tlbnMiOnt9fQY6BkVU--0bf2100788cb010d0183feca16aaf88ccaf719ca; path=\/; expires=Wed, 03 Jul 2024 04:36:17 GMT; secure; HttpOnly; SameSite=None",
- "__cfruid=96c8e6e12fd2ae1a1fb6295fcc3d95a8a1bb0890-1688383863; path=\/; domain=.codebarsolutionsag.zendesk.com; HttpOnly; Secure; SameSite=None"
- ],
- "x-request-id": [
- "7e0eccc609fa7692-LHR",
- "7e0eccc609fa7692-LHR"
- ],
- "x-runtime": "0.124075",
- "X-Zendesk-Zorg": "yes",
- "CF-Cache-Status": "DYNAMIC",
- "Report-To": "{\"endpoints\":[{\"url\":\"https:\\\/\\\/a.nel.cloudflare.com\\\/report\\\/v3?s=FrrIioe8zsDqyeop5JgV0cpPiCkfW62wcV7EiVd%2F0fYtWuHvzB5RW1ln%2FfyR4Zbuk7fIcfkLKjUQ8qj%2Fpi5htVqKXZJKY%2FMxVXu4YyHBaDW3pp6%2BIDFYAOAwYHwKH2cz1D0car5EemABOXu9BrdQog%3D%3D\"}],\"group\":\"cf-nel\",\"max_age\":604800}",
- "NEL": "{\"success_fraction\":0.01,\"report_to\":\"cf-nel\",\"max_age\":604800}",
- "Server": "cloudflare",
- "CF-RAY": "7e0eccc609fa7692-LHR"
- },
- "data": "{\"tickets\":[{\"url\":\"https:\/\/codebarsolutionsag.zendesk.com\/api\/v2\/tickets\/79.json\",\"id\":79,\"external_id\":null,\"via\":{\"channel\":\"api\",\"source\":{\"from\":{},\"to\":{},\"rel\":null}},\"created_at\":\"2023-07-01T12:50:02Z\",\"updated_at\":\"2023-07-01T13:05:54Z\",\"type\":null,\"subject\":\"Eine neue Anfrage der B\u00e4rtschi ist eingetroffen: Projekt #1.\",\"raw_subject\":\"Eine neue Anfrage der B\u00e4rtschi ist eingetroffen: Projekt #1.\",\"description\":\"Eine neue Anfrage der B\u00e4rtschi ist eingetroffen.\\n\\nAnfrage\\nIdentifikation 1\\nBemerkung asdasd\\nURL https:\/\/app.pv.test\/nova\/resources\/inquiries\/1\\nErstellt am 01.07.2023 14:21 Uhr\\n**Kunde**\\nKunden B\u00e4rtschi\\nKunden ID 437046\\nBenutzer ID 437046_ralph\\nBenutzername Ralph Senn\\n**Konfiguration**\\nName Projekt #1\\nDachform Sattel-\/Pultdach\\nMontage Aufdach\\nHerkunft Asiatisch\\nWechselrichter Typ String\\n**Adresse**\\nStrasse M\u00fchlematten 12\\nPLZ 4455\\nOrt Zunzgen\\nLand CH\",\"priority\":\"urgent\",\"status\":\"open\",\"recipient\":null,\"requester_id\":17145664265741,\"submitter_id\":17145664265741,\"assignee_id\":17145664265741,\"organization_id\":17145651654157,\"group_id\":17145664762125,\"collaborator_ids\":[],\"follower_ids\":[],\"email_cc_ids\":[],\"forum_topic_id\":null,\"problem_id\":null,\"has_incidents\":false,\"is_public\":true,\"due_at\":null,\"tags\":[],\"custom_fields\":[{\"id\":17146061349901,\"value\":null},{\"id\":17195718961677,\"value\":null},{\"id\":17195752153741,\"value\":null}],\"satisfaction_rating\":null,\"sharing_agreement_ids\":[],\"custom_status_id\":17145678334989,\"fields\":[{\"id\":17146061349901,\"value\":null},{\"id\":17195718961677,\"value\":null},{\"id\":17195752153741,\"value\":null}],\"followup_ids\":[],\"ticket_form_id\":17145664563725,\"brand_id\":17145651602957,\"allow_channelback\":false,\"allow_attachments\":true,\"from_messaging_channel\":false},{\"url\":\"https:\/\/codebarsolutionsag.zendesk.com\/api\/v2\/tickets\/81.json\",\"id\":81,\"external_id\":null,\"via\":{\"channel\":\"api\",\"source\":{\"from\":{},\"to\":{},\"rel\":null}},\"created_at\":\"2023-07-03T11:16:03Z\",\"updated_at\":\"2023-07-03T11:16:05Z\",\"type\":null,\"subject\":\"My printer is on fire!\",\"raw_subject\":\"My printer is on fire!\",\"description\":\"The smoke is very colorful.\",\"priority\":\"urgent\",\"status\":\"open\",\"recipient\":null,\"requester_id\":17145664265741,\"submitter_id\":17145664265741,\"assignee_id\":17145664265741,\"organization_id\":17145651654157,\"group_id\":17145664762125,\"collaborator_ids\":[],\"follower_ids\":[],\"email_cc_ids\":[],\"forum_topic_id\":null,\"problem_id\":null,\"has_incidents\":false,\"is_public\":true,\"due_at\":null,\"tags\":[],\"custom_fields\":[{\"id\":17146061349901,\"value\":null},{\"id\":17195718961677,\"value\":\"Check field works\"},{\"id\":17195752153741,\"value\":\"Check field works number 2\"}],\"satisfaction_rating\":null,\"sharing_agreement_ids\":[],\"custom_status_id\":17145678334989,\"fields\":[{\"id\":17146061349901,\"value\":null},{\"id\":17195718961677,\"value\":\"Check field works\"},{\"id\":17195752153741,\"value\":\"Check field works number 2\"}],\"followup_ids\":[],\"ticket_form_id\":17145664563725,\"brand_id\":17145651602957,\"allow_channelback\":false,\"allow_attachments\":true,\"from_messaging_channel\":false}],\"next_page\":null,\"previous_page\":null,\"count\":2}"
-}
+{"statusCode":200,"headers":{"Date":"Wed, 20 Sep 2023 22:21:41 GMT","Content-Type":"application\/json; charset=utf-8","Transfer-Encoding":"chunked","Connection":"keep-alive","x-zendesk-api-version":"v2","x-zendesk-application-version":"v18422","x-frame-options":"SAMEORIGIN","zendesk-rate-limit-tickets-index":"total=100; remaining=99; resets=19","x-rate-limit":"400","rate-limit":"400","x-rate-limit-remaining":"399","rate-limit-remaining":"399","rate-limit-reset":"19","strict-transport-security":"max-age=31536000; includeSubDomains","etag":"W\/\"9b88057efb21c69589a8c164b8ae7d20\"","cache-control":"max-age=0, private, must-revalidate","set-cookie":["_zendesk_cookie=BAhJIhl7ImRldmljZV90b2tlbnMiOnt9fQY6BkVU--0bf2100788cb010d0183feca16aaf88ccaf719ca; path=\/; expires=Fri, 20 Sep 2024 14:02:57 GMT; secure; HttpOnly; SameSite=None","__cfruid=a3c0e86e6216ba161e6c7241e25e9297311d2de1-1695248501; path=\/; domain=.codebarsolutions.zendesk.com; HttpOnly; Secure; SameSite=None"],"x-zendesk-origin-server":"classic-app-server-9dcbdc8c6-ptzxr","x-request-id":["809d767bcfb13696-LHR","809d767bcfb13696-LHR"],"x-runtime":"0.152626","X-Zendesk-Zorg":"yes","CF-Cache-Status":"DYNAMIC","Report-To":"{\"endpoints\":[{\"url\":\"https:\\\/\\\/a.nel.cloudflare.com\\\/report\\\/v3?s=%2FTQTOFOLOWJmuBaYP3rEpvl%2B4QDR23JRa36bhMtq6yJfzIrxK2RYpBgYiBP3gRwfiqVdFYjJSADwYGrNE0mQIHLxAp2mCOLm051cPCz26Bwqn%2Fks3OLbKpjID%2B2e8EX5QOkXYQADzB6stcc%2BC94%3D\"}],\"group\":\"cf-nel\",\"max_age\":604800}","NEL":"{\"success_fraction\":0.01,\"report_to\":\"cf-nel\",\"max_age\":604800}","Server":"cloudflare","CF-RAY":"809d767bcfb13696-LHR"},"data":"{\"tickets\":[{\"url\":\"https:\/\/codebarsolutions.zendesk.com\/api\/v2\/tickets\/21.json\",\"id\":21,\"external_id\":null,\"via\":{\"channel\":\"api\",\"source\":{\"from\":{},\"to\":{},\"rel\":null}},\"created_at\":\"2023-09-11T21:08:16Z\",\"updated_at\":\"2023-09-20T22:21:36Z\",\"type\":null,\"subject\":\"My printer is on fire!\",\"raw_subject\":\"My printer is on fire!\",\"description\":\"The smoke is very colorful.\",\"priority\":\"urgent\",\"status\":\"open\",\"recipient\":null,\"requester_id\":10344275987996,\"submitter_id\":10344275987996,\"assignee_id\":10344275987996,\"organization_id\":10344276178204,\"group_id\":10344307646492,\"collaborator_ids\":[],\"follower_ids\":[],\"email_cc_ids\":[],\"forum_topic_id\":null,\"problem_id\":null,\"has_incidents\":false,\"is_public\":true,\"due_at\":null,\"tags\":[],\"custom_fields\":[{\"id\":10344329458332,\"value\":null},{\"id\":10350920893084,\"value\":\"Check field works\"},{\"id\":10350942541980,\"value\":\"Check field works number 2\"}],\"satisfaction_rating\":null,\"sharing_agreement_ids\":[],\"custom_status_id\":10344313751708,\"fields\":[{\"id\":10344329458332,\"value\":null},{\"id\":10350920893084,\"value\":\"Check field works\"},{\"id\":10350942541980,\"value\":\"Check field works number 2\"}],\"followup_ids\":[],\"ticket_form_id\":10344290972956,\"brand_id\":10344297007388,\"allow_channelback\":false,\"allow_attachments\":true,\"from_messaging_channel\":false},{\"url\":\"https:\/\/codebarsolutions.zendesk.com\/api\/v2\/tickets\/22.json\",\"id\":22,\"external_id\":null,\"via\":{\"channel\":\"api\",\"source\":{\"from\":{},\"to\":{},\"rel\":null}},\"created_at\":\"2023-09-11T21:08:43Z\",\"updated_at\":\"2023-09-11T21:08:43Z\",\"type\":null,\"subject\":\"My printer is on fire!\",\"raw_subject\":\"My printer is on fire!\",\"description\":\"The smoke is very colorful.\",\"priority\":null,\"status\":\"open\",\"recipient\":null,\"requester_id\":10344275987996,\"submitter_id\":10344275987996,\"assignee_id\":10344275987996,\"organization_id\":10344276178204,\"group_id\":10344307646492,\"collaborator_ids\":[],\"follower_ids\":[],\"email_cc_ids\":[],\"forum_topic_id\":null,\"problem_id\":null,\"has_incidents\":false,\"is_public\":true,\"due_at\":null,\"tags\":[],\"custom_fields\":[{\"id\":10344329458332,\"value\":null},{\"id\":10350920893084,\"value\":null},{\"id\":10350942541980,\"value\":null}],\"satisfaction_rating\":null,\"sharing_agreement_ids\":[],\"custom_status_id\":10344313751708,\"fields\":[{\"id\":10344329458332,\"value\":null},{\"id\":10350920893084,\"value\":null},{\"id\":10350942541980,\"value\":null}],\"followup_ids\":[],\"ticket_form_id\":10344290972956,\"brand_id\":10344297007388,\"allow_channelback\":false,\"allow_attachments\":true,\"from_messaging_channel\":false},{\"url\":\"https:\/\/codebarsolutions.zendesk.com\/api\/v2\/tickets\/23.json\",\"id\":23,\"external_id\":null,\"via\":{\"channel\":\"api\",\"source\":{\"from\":{},\"to\":{},\"rel\":null}},\"created_at\":\"2023-09-11T21:09:47Z\",\"updated_at\":\"2023-09-11T21:09:47Z\",\"type\":null,\"subject\":\"My printer is on fire!\",\"raw_subject\":\"My printer is on fire!\",\"description\":\"The smoke is very colorful.\",\"priority\":null,\"status\":\"open\",\"recipient\":null,\"requester_id\":10378857061020,\"submitter_id\":10378857061020,\"assignee_id\":10344275987996,\"organization_id\":null,\"group_id\":10344307646492,\"collaborator_ids\":[],\"follower_ids\":[],\"email_cc_ids\":[],\"forum_topic_id\":null,\"problem_id\":null,\"has_incidents\":false,\"is_public\":true,\"due_at\":null,\"tags\":[],\"custom_fields\":[{\"id\":10344329458332,\"value\":null},{\"id\":10350920893084,\"value\":null},{\"id\":10350942541980,\"value\":null}],\"satisfaction_rating\":null,\"sharing_agreement_ids\":[],\"custom_status_id\":10344313751708,\"fields\":[{\"id\":10344329458332,\"value\":null},{\"id\":10350920893084,\"value\":null},{\"id\":10350942541980,\"value\":null}],\"followup_ids\":[],\"ticket_form_id\":10344290972956,\"brand_id\":10344297007388,\"allow_channelback\":false,\"allow_attachments\":true,\"from_messaging_channel\":false},{\"url\":\"https:\/\/codebarsolutions.zendesk.com\/api\/v2\/tickets\/24.json\",\"id\":24,\"external_id\":null,\"via\":{\"channel\":\"api\",\"source\":{\"from\":{},\"to\":{},\"rel\":null}},\"created_at\":\"2023-09-11T21:12:31Z\",\"updated_at\":\"2023-09-11T21:12:31Z\",\"type\":null,\"subject\":\"My printer is on fire!\",\"raw_subject\":\"My printer is on fire!\",\"description\":\"The smoke is very colorful.\",\"priority\":null,\"status\":\"open\",\"recipient\":null,\"requester_id\":10344300001820,\"submitter_id\":10344300001820,\"assignee_id\":10344275987996,\"organization_id\":null,\"group_id\":10344307646492,\"collaborator_ids\":[],\"follower_ids\":[],\"email_cc_ids\":[],\"forum_topic_id\":null,\"problem_id\":null,\"has_incidents\":false,\"is_public\":true,\"due_at\":null,\"tags\":[],\"custom_fields\":[{\"id\":10344329458332,\"value\":null},{\"id\":10350920893084,\"value\":null},{\"id\":10350942541980,\"value\":null}],\"satisfaction_rating\":null,\"sharing_agreement_ids\":[],\"custom_status_id\":10344313751708,\"fields\":[{\"id\":10344329458332,\"value\":null},{\"id\":10350920893084,\"value\":null},{\"id\":10350942541980,\"value\":null}],\"followup_ids\":[],\"ticket_form_id\":10344290972956,\"brand_id\":10344297007388,\"allow_channelback\":false,\"allow_attachments\":true,\"from_messaging_channel\":false},{\"url\":\"https:\/\/codebarsolutions.zendesk.com\/api\/v2\/tickets\/25.json\",\"id\":25,\"external_id\":null,\"via\":{\"channel\":\"api\",\"source\":{\"from\":{},\"to\":{},\"rel\":null}},\"created_at\":\"2023-09-20T22:08:47Z\",\"updated_at\":\"2023-09-20T22:19:39Z\",\"type\":null,\"subject\":\"My printer is on fire!\",\"raw_subject\":\"My printer is on fire!\",\"description\":\"The smoke is very colorful.\",\"priority\":\"urgent\",\"status\":\"open\",\"recipient\":null,\"requester_id\":10344275987996,\"submitter_id\":10344275987996,\"assignee_id\":10344275987996,\"organization_id\":10344276178204,\"group_id\":10344307646492,\"collaborator_ids\":[],\"follower_ids\":[],\"email_cc_ids\":[],\"forum_topic_id\":null,\"problem_id\":null,\"has_incidents\":false,\"is_public\":true,\"due_at\":null,\"tags\":[],\"custom_fields\":[{\"id\":10344329458332,\"value\":null},{\"id\":10350920893084,\"value\":\"Check field works\"},{\"id\":10350942541980,\"value\":\"Check field works number 2\"}],\"satisfaction_rating\":null,\"sharing_agreement_ids\":[],\"custom_status_id\":10344313751708,\"fields\":[{\"id\":10344329458332,\"value\":null},{\"id\":10350920893084,\"value\":\"Check field works\"},{\"id\":10350942541980,\"value\":\"Check field works number 2\"}],\"followup_ids\":[],\"ticket_form_id\":10344290972956,\"brand_id\":10344297007388,\"allow_channelback\":false,\"allow_attachments\":true,\"from_messaging_channel\":false},{\"url\":\"https:\/\/codebarsolutions.zendesk.com\/api\/v2\/tickets\/26.json\",\"id\":26,\"external_id\":null,\"via\":{\"channel\":\"api\",\"source\":{\"from\":{},\"to\":{},\"rel\":null}},\"created_at\":\"2023-09-20T22:19:51Z\",\"updated_at\":\"2023-09-20T22:19:51Z\",\"type\":null,\"subject\":\"My printer is on fire!\",\"raw_subject\":\"My printer is on fire!\",\"description\":\"The smoke is very colorful.\",\"priority\":\"urgent\",\"status\":\"open\",\"recipient\":null,\"requester_id\":10344275987996,\"submitter_id\":10344275987996,\"assignee_id\":10344275987996,\"organization_id\":10344276178204,\"group_id\":10344307646492,\"collaborator_ids\":[],\"follower_ids\":[],\"email_cc_ids\":[],\"forum_topic_id\":null,\"problem_id\":null,\"has_incidents\":false,\"is_public\":true,\"due_at\":null,\"tags\":[],\"custom_fields\":[{\"id\":10344329458332,\"value\":null},{\"id\":10350920893084,\"value\":\"Check field works\"},{\"id\":10350942541980,\"value\":\"Check field works number 2\"}],\"satisfaction_rating\":null,\"sharing_agreement_ids\":[],\"custom_status_id\":10344313751708,\"fields\":[{\"id\":10344329458332,\"value\":null},{\"id\":10350920893084,\"value\":\"Check field works\"},{\"id\":10350942541980,\"value\":\"Check field works number 2\"}],\"followup_ids\":[],\"ticket_form_id\":10344290972956,\"brand_id\":10344297007388,\"allow_channelback\":false,\"allow_attachments\":true,\"from_messaging_channel\":false}],\"next_page\":null,\"previous_page\":null,\"count\":6}"}
\ No newline at end of file
diff --git a/tests/Fixtures/Saloon/count-tickets-request.json b/tests/Fixtures/Saloon/count-tickets-request.json
index a93c8c9..49e859d 100644
--- a/tests/Fixtures/Saloon/count-tickets-request.json
+++ b/tests/Fixtures/Saloon/count-tickets-request.json
@@ -1 +1 @@
-{"statusCode":200,"headers":{"Date":"Fri, 08 Sep 2023 22:25:14 GMT","Content-Type":"application\/json; charset=utf-8","Transfer-Encoding":"chunked","Connection":"keep-alive","x-zendesk-api-version":"v2","x-zendesk-application-version":"v18303","x-frame-options":"SAMEORIGIN","x-rate-limit":"400","rate-limit":"400","x-rate-limit-remaining":"394","rate-limit-remaining":"394","rate-limit-reset":"46","strict-transport-security":"max-age=31536000; includeSubDomains","etag":"W\/\"04705c0fd9decaa6fa75efff5f56df4a\"","cache-control":"max-age=0, private, must-revalidate","set-cookie":["_zendesk_cookie=BAhJIhl7ImRldmljZV90b2tlbnMiOnt9fQY6BkVU--0bf2100788cb010d0183feca16aaf88ccaf719ca; path=\/; expires=Sun, 08 Sep 2024 19:27:40 GMT; secure; HttpOnly; SameSite=None","__cfruid=1adcc1a141e4dfe08bdbf099eaee019533c4cfbf-1694211914; path=\/; domain=.codebarsolutions.zendesk.com; HttpOnly; Secure; SameSite=None"],"x-zendesk-origin-server":"classic-app-server-55f8b9dd4b-bpwgb","x-request-id":["803a9b2e9cf34999-LHR","803a9b2e9cf34999-LHR"],"x-runtime":"0.079048","X-Zendesk-Zorg":"yes","CF-Cache-Status":"DYNAMIC","Report-To":"{\"endpoints\":[{\"url\":\"https:\\\/\\\/a.nel.cloudflare.com\\\/report\\\/v3?s=lPEYSDgbkIRug9oN1Cx4NPo3Tw08mROkY9gmf3u7Iue%2BcP7jVqub7f7uLGLcSlNcFQKCO25b6mumCTiR0UFhik9NqfNgzAKoLggfrHkqa%2BOcQdi8h7mKU3%2BhgDqhnXdDz%2BkkAuS4xCRIZcGEUNg%3D\"}],\"group\":\"cf-nel\",\"max_age\":604800}","NEL":"{\"success_fraction\":0.01,\"report_to\":\"cf-nel\",\"max_age\":604800}","Server":"cloudflare","CF-RAY":"803a9b2e9cf34999-LHR"},"data":"{\"count\":{\"value\":1,\"refreshed_at\":\"2023-09-08T22:25:14+00:00\"}}"}
\ No newline at end of file
+{"statusCode":200,"headers":{"Date":"Wed, 20 Sep 2023 22:08:07 GMT","Content-Type":"application\/json; charset=utf-8","Transfer-Encoding":"chunked","Connection":"keep-alive","x-zendesk-api-version":"v2","x-zendesk-application-version":"v18422","x-frame-options":"SAMEORIGIN","x-rate-limit":"400","rate-limit":"400","x-rate-limit-remaining":"399","rate-limit-remaining":"399","rate-limit-reset":"53","strict-transport-security":"max-age=31536000; includeSubDomains","etag":"W\/\"dc4647e0d7a49e37365b577c831c9151\"","cache-control":"max-age=0, private, must-revalidate","set-cookie":["_zendesk_cookie=BAhJIhl7ImRldmljZV90b2tlbnMiOnt9fQY6BkVU--0bf2100788cb010d0183feca16aaf88ccaf719ca; path=\/; expires=Fri, 20 Sep 2024 14:02:45 GMT; secure; HttpOnly; SameSite=None","__cfruid=97cce5cd3df835b82947cd178097448542836049-1695247687; path=\/; domain=.codebarsolutions.zendesk.com; HttpOnly; Secure; SameSite=None"],"x-zendesk-origin-server":"classic-app-server-9dcbdc8c6-n4vvg","x-request-id":["809d629b0d0c385e-LHR","809d629b0d0c385e-LHR"],"x-runtime":"0.077118","X-Zendesk-Zorg":"yes","CF-Cache-Status":"DYNAMIC","Report-To":"{\"endpoints\":[{\"url\":\"https:\\\/\\\/a.nel.cloudflare.com\\\/report\\\/v3?s=vQntbEMWZwnf1DXVKZzlHP24L3SJuXpNwpCGtzFcPa5GqFM94JcdjVesTsi7Xg21gppgk%2FMj3X2U%2F4RvGO%2FeqOI340nDVMvF%2FTHCt7OmmQVcoRr7AS31Dnt2uU%2BiJ7paBFaf6M4TE4Cp0A%2F4tUY%3D\"}],\"group\":\"cf-nel\",\"max_age\":604800}","NEL":"{\"success_fraction\":0.01,\"report_to\":\"cf-nel\",\"max_age\":604800}","Server":"cloudflare","CF-RAY":"809d629b0d0c385e-LHR"},"data":"{\"count\":{\"value\":4,\"refreshed_at\":\"2023-09-20T22:08:07+00:00\"}}"}
\ No newline at end of file
diff --git a/tests/Fixtures/Saloon/create-attachment-request.json b/tests/Fixtures/Saloon/create-attachment-request.json
index 9cd7a49..ee861c7 100644
--- a/tests/Fixtures/Saloon/create-attachment-request.json
+++ b/tests/Fixtures/Saloon/create-attachment-request.json
@@ -1 +1 @@
-{"statusCode":201,"headers":{"Date":"Fri, 08 Sep 2023 22:25:11 GMT","Content-Type":"application\/json; charset=utf-8","Content-Length":"2269","Connection":"keep-alive","x-zendesk-api-version":"v2","x-zendesk-application-version":"v18303","x-frame-options":"SAMEORIGIN","location":"https:\/\/codebarsolutions.zendesk.com\/api\/v2\/attachments\/10346616943260.json","access-control-allow-origin":"*","access-control-expose-headers":"X-Zendesk-API-Warn,X-Zendesk-User-Id,X-Zendesk-User-Session-Expires-At","x-rate-limit":"400","rate-limit":"400","x-rate-limit-remaining":"399","rate-limit-remaining":"399","rate-limit-reset":"49","strict-transport-security":"max-age=31536000; includeSubDomains","etag":"W\/\"d7f35d3e23d9e589b10dd300abf153d1\"","cache-control":"max-age=0, private, must-revalidate","set-cookie":["_zendesk_cookie=BAhJIhl7ImRldmljZV90b2tlbnMiOnt9fQY6BkVU--0bf2100788cb010d0183feca16aaf88ccaf719ca; path=\/; expires=Sat, 07 Sep 2024 22:49:54 GMT; secure; HttpOnly; SameSite=None","__cfruid=8a343d2b8219d5ed68ae654e458790b82e86af94-1694211911; path=\/; domain=.codebarsolutions.zendesk.com; HttpOnly; Secure; SameSite=None"],"x-zendesk-origin-server":"classic-app-server-55f8b9dd4b-9qs56","x-request-id":["803a9b1a8aca7196-LHR","803a9b1a8aca7196-LHR"],"x-runtime":"0.362019","X-Zendesk-Zorg":"yes","CF-Cache-Status":"DYNAMIC","Report-To":"{\"endpoints\":[{\"url\":\"https:\\\/\\\/a.nel.cloudflare.com\\\/report\\\/v3?s=HLwQljGBdekV1CgV9fJaQk7xrssbg%2F5yAsyhDHE02hJJz0w4hmfBx9MCfnU6armidLUqgxOmlLEgQDy4lzbih9RgFgYwbbUZYgu58dXUGx%2BHFZ2icnL5zn2V2V6e89ggeZDk7daR5s0P2qWwAaw%3D\"}],\"group\":\"cf-nel\",\"max_age\":604800}","NEL":"{\"success_fraction\":0.01,\"report_to\":\"cf-nel\",\"max_age\":604800}","Server":"cloudflare","CF-RAY":"803a9b1a8aca7196-LHR"},"data":"{\"upload\":{\"token\":\"QyLNkTdFhrpxXu7JzlZcJWLat\",\"expires_at\":\"2023-09-11T22:25:11Z\",\"attachments\":[{\"url\":\"https:\/\/codebarsolutions.zendesk.com\/api\/v2\/attachments\/10346616943260.json\",\"id\":10346616943260,\"file_name\":\"test.png\",\"content_url\":\"https:\/\/codebarsolutions.zendesk.com\/attachments\/token\/bClC0CjrndApmHI1aO9lKT80C\/?name=test.png\",\"mapped_content_url\":\"https:\/\/codebarsolutions.zendesk.com\/attachments\/token\/bClC0CjrndApmHI1aO9lKT80C\/?name=test.png\",\"content_type\":\"image\/png\",\"size\":26271,\"width\":640,\"height\":360,\"inline\":false,\"deleted\":false,\"malware_access_override\":false,\"malware_scan_result\":\"not_scanned\",\"thumbnails\":[{\"url\":\"https:\/\/codebarsolutions.zendesk.com\/api\/v2\/attachments\/10346602773276.json\",\"id\":10346602773276,\"file_name\":\"test_thumb.png\",\"content_url\":\"https:\/\/codebarsolutions.zendesk.com\/attachments\/token\/5pstEWeJh6l5KhRNHeUreauly\/?name=test_thumb.png\",\"mapped_content_url\":\"https:\/\/codebarsolutions.zendesk.com\/attachments\/token\/5pstEWeJh6l5KhRNHeUreauly\/?name=test_thumb.png\",\"content_type\":\"image\/png\",\"size\":1821,\"width\":80,\"height\":45,\"inline\":false,\"deleted\":false,\"malware_access_override\":false,\"malware_scan_result\":\"not_scanned\"}]}],\"attachment\":{\"url\":\"https:\/\/codebarsolutions.zendesk.com\/api\/v2\/attachments\/10346616943260.json\",\"id\":10346616943260,\"file_name\":\"test.png\",\"content_url\":\"https:\/\/codebarsolutions.zendesk.com\/attachments\/token\/bClC0CjrndApmHI1aO9lKT80C\/?name=test.png\",\"mapped_content_url\":\"https:\/\/codebarsolutions.zendesk.com\/attachments\/token\/bClC0CjrndApmHI1aO9lKT80C\/?name=test.png\",\"content_type\":\"image\/png\",\"size\":26271,\"width\":640,\"height\":360,\"inline\":false,\"deleted\":false,\"malware_access_override\":false,\"malware_scan_result\":\"not_scanned\",\"thumbnails\":[{\"url\":\"https:\/\/codebarsolutions.zendesk.com\/api\/v2\/attachments\/10346602773276.json\",\"id\":10346602773276,\"file_name\":\"test_thumb.png\",\"content_url\":\"https:\/\/codebarsolutions.zendesk.com\/attachments\/token\/5pstEWeJh6l5KhRNHeUreauly\/?name=test_thumb.png\",\"mapped_content_url\":\"https:\/\/codebarsolutions.zendesk.com\/attachments\/token\/5pstEWeJh6l5KhRNHeUreauly\/?name=test_thumb.png\",\"content_type\":\"image\/png\",\"size\":1821,\"width\":80,\"height\":45,\"inline\":false,\"deleted\":false,\"malware_access_override\":false,\"malware_scan_result\":\"not_scanned\"}]}}}"}
\ No newline at end of file
+{"statusCode":201,"headers":{"Date":"Wed, 20 Sep 2023 22:08:48 GMT","Content-Type":"application\/json; charset=utf-8","Content-Length":"2269","Connection":"keep-alive","x-zendesk-api-version":"v2","x-zendesk-application-version":"v18422","x-frame-options":"SAMEORIGIN","location":"https:\/\/codebarsolutions.zendesk.com\/api\/v2\/attachments\/10509414461596.json","access-control-allow-origin":"*","access-control-expose-headers":"X-Zendesk-API-Warn,X-Zendesk-User-Id,X-Zendesk-User-Session-Expires-At","x-rate-limit":"400","rate-limit":"400","x-rate-limit-remaining":"395","rate-limit-remaining":"395","rate-limit-reset":"12","strict-transport-security":"max-age=31536000; includeSubDomains","etag":"W\/\"a529c7a7a8044640f150613173817709\"","cache-control":"max-age=0, private, must-revalidate","set-cookie":["_zendesk_cookie=BAhJIhl7ImRldmljZV90b2tlbnMiOnt9fQY6BkVU--0bf2100788cb010d0183feca16aaf88ccaf719ca; path=\/; expires=Fri, 20 Sep 2024 19:01:54 GMT; secure; HttpOnly; SameSite=None","__cfruid=c20ec30c8712bb9a230d9934459006d82b72963f-1695247728; path=\/; domain=.codebarsolutions.zendesk.com; HttpOnly; Secure; SameSite=None"],"x-zendesk-origin-server":"classic-app-server-9dcbdc8c6-85tjz","x-request-id":["809d639f1afb0716-LHR","809d639f1afb0716-LHR"],"x-runtime":"0.385767","X-Zendesk-Zorg":"yes","CF-Cache-Status":"DYNAMIC","Report-To":"{\"endpoints\":[{\"url\":\"https:\\\/\\\/a.nel.cloudflare.com\\\/report\\\/v3?s=X4UCYoVVixlchl6uX9qTia3EXT5hMd6lxMQmKsf22bxdnfGLGn7UoXTr22U4l3imdJiIgOakNZ16nw73SKFEzi8sE2gsTs2xY04A0FNu2ZbQ9boB1QBVqAVT6l7McI2hM4DOgCa53MAUo1eqVxY%3D\"}],\"group\":\"cf-nel\",\"max_age\":604800}","NEL":"{\"success_fraction\":0.01,\"report_to\":\"cf-nel\",\"max_age\":604800}","Server":"cloudflare","CF-RAY":"809d639f1afb0716-LHR"},"data":"{\"upload\":{\"token\":\"cs0vflvMytl7PHs8XueOo5mty\",\"expires_at\":\"2023-09-23T22:08:48Z\",\"attachments\":[{\"url\":\"https:\/\/codebarsolutions.zendesk.com\/api\/v2\/attachments\/10509414461596.json\",\"id\":10509414461596,\"file_name\":\"test.png\",\"content_url\":\"https:\/\/codebarsolutions.zendesk.com\/attachments\/token\/K32w31jO8UBB37UpKk2i1o4wg\/?name=test.png\",\"mapped_content_url\":\"https:\/\/codebarsolutions.zendesk.com\/attachments\/token\/K32w31jO8UBB37UpKk2i1o4wg\/?name=test.png\",\"content_type\":\"image\/png\",\"size\":26271,\"width\":640,\"height\":360,\"inline\":false,\"deleted\":false,\"malware_access_override\":false,\"malware_scan_result\":\"not_scanned\",\"thumbnails\":[{\"url\":\"https:\/\/codebarsolutions.zendesk.com\/api\/v2\/attachments\/10509440141468.json\",\"id\":10509440141468,\"file_name\":\"test_thumb.png\",\"content_url\":\"https:\/\/codebarsolutions.zendesk.com\/attachments\/token\/AXzrvui2s7ZHBqoXAxytAhpx1\/?name=test_thumb.png\",\"mapped_content_url\":\"https:\/\/codebarsolutions.zendesk.com\/attachments\/token\/AXzrvui2s7ZHBqoXAxytAhpx1\/?name=test_thumb.png\",\"content_type\":\"image\/png\",\"size\":1821,\"width\":80,\"height\":45,\"inline\":false,\"deleted\":false,\"malware_access_override\":false,\"malware_scan_result\":\"not_scanned\"}]}],\"attachment\":{\"url\":\"https:\/\/codebarsolutions.zendesk.com\/api\/v2\/attachments\/10509414461596.json\",\"id\":10509414461596,\"file_name\":\"test.png\",\"content_url\":\"https:\/\/codebarsolutions.zendesk.com\/attachments\/token\/K32w31jO8UBB37UpKk2i1o4wg\/?name=test.png\",\"mapped_content_url\":\"https:\/\/codebarsolutions.zendesk.com\/attachments\/token\/K32w31jO8UBB37UpKk2i1o4wg\/?name=test.png\",\"content_type\":\"image\/png\",\"size\":26271,\"width\":640,\"height\":360,\"inline\":false,\"deleted\":false,\"malware_access_override\":false,\"malware_scan_result\":\"not_scanned\",\"thumbnails\":[{\"url\":\"https:\/\/codebarsolutions.zendesk.com\/api\/v2\/attachments\/10509440141468.json\",\"id\":10509440141468,\"file_name\":\"test_thumb.png\",\"content_url\":\"https:\/\/codebarsolutions.zendesk.com\/attachments\/token\/AXzrvui2s7ZHBqoXAxytAhpx1\/?name=test_thumb.png\",\"mapped_content_url\":\"https:\/\/codebarsolutions.zendesk.com\/attachments\/token\/AXzrvui2s7ZHBqoXAxytAhpx1\/?name=test_thumb.png\",\"content_type\":\"image\/png\",\"size\":1821,\"width\":80,\"height\":45,\"inline\":false,\"deleted\":false,\"malware_access_override\":false,\"malware_scan_result\":\"not_scanned\"}]}}}"}
\ No newline at end of file
diff --git a/tests/Fixtures/Saloon/create-single-ticket-request-on-behalf-of.json b/tests/Fixtures/Saloon/create-single-ticket-request-on-behalf-of.json
deleted file mode 100644
index 54b3aac..0000000
--- a/tests/Fixtures/Saloon/create-single-ticket-request-on-behalf-of.json
+++ /dev/null
@@ -1 +0,0 @@
-{"statusCode":400,"headers":{"Date":"Fri, 08 Sep 2023 22:25:13 GMT","Content-Type":"text\/plain; charset=utf-8","Content-Length":"85","Connection":"keep-alive","x-zendesk-api-version":"v2","x-zendesk-application-version":"v18303","x-zendesk-api-warn":"{:allowed_parameters=>{:controller=>\"tickets\", :action=>\"create\", :unpermitted_keys=>[\"ticket.allow_attachments\", \"ticket.allow_channelback\", \"ticket.comment.attachments\", \"ticket.comment.audit_id\", \"ticket.comment.created_at\", \"ticket.comment.id\", \"ticket.comment.metadata\", \"ticket.comment.plain_body\", \"ticket.comment.type\", \"ticket.comment.via\", \"ticket.created_at\", \"ticket.email_cc_ids\", \"ticket.follower_ids\", \"ticket.followup_ids\", \"ticket.from_messaging_channel\", \"ticket.has_incidents\", \"ticket.id\", \"ticket.is_public\", \"ticket.self_update\", \"ticket.satisfaction_rating\", \"ticket.updated_at\"], :invalid_values=>[]}}","x-rate-limit":"400","rate-limit":"400","x-rate-limit-remaining":"396","rate-limit-remaining":"396","rate-limit-reset":"47","strict-transport-security":"max-age=31536000; includeSubDomains","cache-control":"no-cache","set-cookie":["_zendesk_cookie=BAhJIhl7ImRldmljZV90b2tlbnMiOnt9fQY6BkVU--0bf2100788cb010d0183feca16aaf88ccaf719ca; path=\/; expires=Sat, 07 Sep 2024 22:47:32 GMT; secure; HttpOnly; SameSite=None","__cfruid=0876246d6b37a4b1886f92df7b9c30efeb3bc181-1694211913; path=\/; domain=.codebarsolutions.zendesk.com; HttpOnly; Secure; SameSite=None"],"x-zendesk-origin-server":"classic-app-server-55f8b9dd4b-tpv7k","x-request-id":["803a9b27c93e7308-LHR","803a9b27c93e7308-LHR"],"x-runtime":"0.049878","X-Zendesk-Zorg":"yes","CF-Cache-Status":"DYNAMIC","Report-To":"{\"endpoints\":[{\"url\":\"https:\\\/\\\/a.nel.cloudflare.com\\\/report\\\/v3?s=KidFVeIIuRY2CUjPKQDOYc%2Bq2giL5TsouLwvdX0JVdDRX6rfSmhcC9g9N0ko5EGj0UxPdqLKz1ZX4M0vTb8pxp4xSM8wVSdITdYF31ohIJZcjnUemQ%2BVmk3lVDlPN7NWMQlsL7upAOJfDBOJDg0%3D\"}],\"group\":\"cf-nel\",\"max_age\":604800}","NEL":"{\"success_fraction\":0.01,\"report_to\":\"cf-nel\",\"max_age\":604800}","Server":"cloudflare","CF-RAY":"803a9b27c93e7308-LHR"},"data":"This API version does not support the X-On-Behalf-Of header. Please use an API token."}
\ No newline at end of file
diff --git a/tests/Fixtures/Saloon/create-single-ticket-request.json b/tests/Fixtures/Saloon/create-single-ticket-request.json
index f91c06b..41e710e 100644
--- a/tests/Fixtures/Saloon/create-single-ticket-request.json
+++ b/tests/Fixtures/Saloon/create-single-ticket-request.json
@@ -1 +1 @@
-{"statusCode":201,"headers":{"Date":"Fri, 08 Sep 2023 22:25:13 GMT","Content-Type":"application\/json; charset=utf-8","Content-Length":"3718","Connection":"keep-alive","x-zendesk-api-version":"v2","x-zendesk-application-version":"v18303","x-zendesk-api-warn":"{:allowed_parameters=>{:controller=>\"tickets\", :action=>\"create\", :unpermitted_keys=>[\"ticket.allow_attachments\", \"ticket.allow_channelback\", \"ticket.comment.attachments\", \"ticket.comment.audit_id\", \"ticket.comment.created_at\", \"ticket.comment.id\", \"ticket.comment.metadata\", \"ticket.comment.plain_body\", \"ticket.comment.type\", \"ticket.comment.via\", \"ticket.created_at\", \"ticket.email_cc_ids\", \"ticket.follower_ids\", \"ticket.followup_ids\", \"ticket.from_messaging_channel\", \"ticket.has_incidents\", \"ticket.id\", \"ticket.is_public\", \"ticket.self_update\", \"ticket.satisfaction_rating\", \"ticket.updated_at\"], :invalid_values=>[]}}","x-frame-options":"SAMEORIGIN","zendesk-ep":"-22","location":"https:\/\/codebarsolutions.zendesk.com\/api\/v2\/tickets\/15.json","x-rate-limit":"400","rate-limit":"400","x-rate-limit-remaining":"395","rate-limit-remaining":"395","rate-limit-reset":"47","strict-transport-security":"max-age=31536000; includeSubDomains","etag":"W\/\"88e369704b5bb18840a3353325fd804d\"","cache-control":"max-age=0, private, must-revalidate","set-cookie":["_zendesk_cookie=BAhJIhl7ImRldmljZV90b2tlbnMiOnt9fQY6BkVU--0bf2100788cb010d0183feca16aaf88ccaf719ca; path=\/; expires=Sun, 08 Sep 2024 21:05:57 GMT; secure; HttpOnly; SameSite=None","__cfruid=0876246d6b37a4b1886f92df7b9c30efeb3bc181-1694211913; path=\/; domain=.codebarsolutions.zendesk.com; HttpOnly; Secure; SameSite=None"],"x-zendesk-origin-server":"classic-app-server-55f8b9dd4b-m9tfc","x-request-id":["803a9b291fd12407-LHR","803a9b291fd12407-LHR"],"x-runtime":"0.698416","X-Zendesk-Zorg":"yes","CF-Cache-Status":"DYNAMIC","Report-To":"{\"endpoints\":[{\"url\":\"https:\\\/\\\/a.nel.cloudflare.com\\\/report\\\/v3?s=ZbwoBMRWktLkBw%2FD0ykKSahwK4YnDh2%2BG49dROV9ndR%2BZGWskECZHmCZd3HuPTn20svQyTi0naCXuyBxQz8O61izrFIj8wmI%2FXmnw03htHI%2Fqs6y%2Bu4X%2FrzgwkYN4I%2BijHzzI8MZlZ9GsVFmk4Q%3D\"}],\"group\":\"cf-nel\",\"max_age\":604800}","NEL":"{\"success_fraction\":0.01,\"report_to\":\"cf-nel\",\"max_age\":604800}","Server":"cloudflare","CF-RAY":"803a9b291fd12407-LHR"},"data":"{\"ticket\":{\"url\":\"https:\/\/codebarsolutions.zendesk.com\/api\/v2\/tickets\/15.json\",\"id\":15,\"external_id\":null,\"via\":{\"channel\":\"api\",\"source\":{\"from\":{},\"to\":{},\"rel\":null}},\"created_at\":\"2023-09-08T22:25:13Z\",\"updated_at\":\"2023-09-08T22:25:13Z\",\"type\":null,\"subject\":\"My printer is on fire!\",\"raw_subject\":\"My printer is on fire!\",\"description\":\"The smoke is very colorful.\",\"priority\":\"urgent\",\"status\":\"open\",\"recipient\":null,\"requester_id\":10344275987996,\"submitter_id\":10344275987996,\"assignee_id\":10344275987996,\"organization_id\":10344276178204,\"group_id\":10344307646492,\"collaborator_ids\":[],\"follower_ids\":[],\"email_cc_ids\":[],\"forum_topic_id\":null,\"problem_id\":null,\"has_incidents\":false,\"is_public\":true,\"due_at\":null,\"tags\":[],\"custom_fields\":[{\"id\":10344329458332,\"value\":null}],\"satisfaction_rating\":null,\"sharing_agreement_ids\":[],\"custom_status_id\":10344313751708,\"fields\":[{\"id\":10344329458332,\"value\":null}],\"followup_ids\":[],\"ticket_form_id\":10344290972956,\"brand_id\":10344297007388,\"allow_channelback\":false,\"allow_attachments\":true,\"from_messaging_channel\":false},\"audit\":{\"id\":10346619307292,\"ticket_id\":15,\"created_at\":\"2023-09-08T22:25:13Z\",\"author_id\":10344275987996,\"metadata\":{\"system\":{\"client\":\"GuzzleHttp\/7\",\"ip_address\":\"92.233.100.169\",\"location\":\"Ilford, ENG, United Kingdom\",\"latitude\":51.5749,\"longitude\":0.0869},\"custom\":{}},\"events\":[{\"id\":10346619307420,\"type\":\"Comment\",\"author_id\":10344275987996,\"body\":\"The smoke is very colorful.\",\"html_body\":\"
The smoke is very colorful.<\/p><\/div>\",\"plain_body\":\"The smoke is very colorful.\",\"public\":true,\"attachments\":[],\"audit_id\":10346619307292},{\"id\":10346619307548,\"type\":\"Create\",\"value\":\"urgent\",\"field_name\":\"priority\"},{\"id\":10346619307676,\"type\":\"Create\",\"value\":\"My printer is on fire!\",\"field_name\":\"subject\"},{\"id\":10346619307804,\"type\":\"Create\",\"value\":\"10344275987996\",\"field_name\":\"requester_id\"},{\"id\":10346619307932,\"type\":\"Create\",\"value\":null,\"field_name\":\"type\"},{\"id\":10346619308060,\"type\":\"Create\",\"value\":\"open\",\"field_name\":\"status\"},{\"id\":10346619308188,\"type\":\"Create\",\"value\":\"10344275987996\",\"field_name\":\"assignee_id\"},{\"id\":10346619308316,\"type\":\"Create\",\"value\":\"10344307646492\",\"field_name\":\"group_id\"},{\"id\":10346619308444,\"type\":\"Create\",\"value\":\"10344276178204\",\"field_name\":\"organization_id\"},{\"id\":10346619308572,\"type\":\"Create\",\"value\":\"10344297007388\",\"field_name\":\"brand_id\"},{\"id\":10346619308700,\"type\":\"Create\",\"value\":\"10344290972956\",\"field_name\":\"ticket_form_id\"},{\"id\":10346619308828,\"type\":\"Create\",\"value\":\"10344313751708\",\"field_name\":\"custom_status_id\"},{\"id\":10346619308956,\"type\":\"Notification\",\"via\":{\"channel\":\"rule\",\"source\":{\"from\":{\"deleted\":false,\"title\":\"Anfragenden \u00fcber neues proaktives Ticket benachrichtigen\",\"id\":10344280371100},\"rel\":\"trigger\"}},\"subject\":\"{{ticket.title}}\",\"body\":\"Dieses Ticket wurde in Ihrem Namen erstellt.\\n\\nUm weitere Kommentare hinzuzuf\u00fcgen, antworten Sie auf diese E-Mail.\\n\\n{{ticket.latest_public_comment_html}}\",\"recipients\":[10344275987996]},{\"id\":10346619309084,\"type\":\"Notification\",\"via\":{\"channel\":\"rule\",\"source\":{\"from\":{\"deleted\":false,\"title\":\"Alle Agenten \u00fcber eingegangene Anfrage benachrichtigen\",\"id\":10344280378780},\"rel\":\"trigger\"}},\"subject\":\"[{{ticket.account}}] {{ticket.title}}\",\"body\":\"Ein Ticket (#{{ticket.id}}) von {{ticket.requester.name}} ist eingegangen. Es ist momentan niemandem zugewiesen.\\n\\n{{ticket.latest_comment_html}}\",\"recipients\":[10344275987996]},{\"id\":10346644508572,\"type\":\"AssociateAttValsEvent\",\"attribute_values\":[]}],\"via\":{\"channel\":\"api\",\"source\":{\"from\":{},\"to\":{\"name\":\"Sebastian B\u00fcrgin\",\"address\":\"sebastian.buergin@codebar.ch\"},\"rel\":null}}}}"} \ No newline at end of file +{"statusCode":201,"headers":{"Date":"Wed, 20 Sep 2023 22:19:51 GMT","Content-Type":"application\/json; charset=utf-8","Content-Length":"4137","Connection":"keep-alive","x-zendesk-api-version":"v2","x-zendesk-application-version":"v18422","x-zendesk-api-warn":"{:allowed_parameters=>{:controller=>\"tickets\", :action=>\"create\", :unpermitted_keys=>[\"ticket.allow_attachments\", \"ticket.allow_channelback\", \"ticket.comment.attachments\", \"ticket.comment.audit_id\", \"ticket.comment.created_at\", \"ticket.comment.id\", \"ticket.comment.metadata\", \"ticket.comment.plain_body\", \"ticket.comment.type\", \"ticket.comment.via\", \"ticket.created_at\", \"ticket.email_cc_ids\", \"ticket.follower_ids\", \"ticket.followup_ids\", \"ticket.from_messaging_channel\", \"ticket.has_incidents\", \"ticket.id\", \"ticket.is_public\", \"ticket.self_update\", \"ticket.satisfaction_rating\", \"ticket.updated_at\"], :invalid_values=>[]}}","x-frame-options":"SAMEORIGIN","zendesk-ep":"-22","location":"https:\/\/codebarsolutions.zendesk.com\/api\/v2\/tickets\/26.json","x-rate-limit":"400","rate-limit":"400","x-rate-limit-remaining":"399","rate-limit-remaining":"399","rate-limit-reset":"9","strict-transport-security":"max-age=31536000; includeSubDomains","etag":"W\/\"becd401c1926cdf037f10b7cfe952915\"","cache-control":"max-age=0, private, must-revalidate","set-cookie":["_zendesk_cookie=BAhJIhl7ImRldmljZV90b2tlbnMiOnt9fQY6BkVU--0bf2100788cb010d0183feca16aaf88ccaf719ca; path=\/; expires=Fri, 20 Sep 2024 14:05:30 GMT; secure; HttpOnly; SameSite=None","__cfruid=b56d8917e85ef66923a75f60018d00c8a32d03b6-1695248391; path=\/; domain=.codebarsolutions.zendesk.com; HttpOnly; Secure; SameSite=None"],"x-zendesk-origin-server":"classic-app-server-9dcbdc8c6-l8kg7","x-request-id":["809d73c84d394165-LHR","809d73c84d394165-LHR"],"x-runtime":"0.548138","X-Zendesk-Zorg":"yes","CF-Cache-Status":"DYNAMIC","Report-To":"{\"endpoints\":[{\"url\":\"https:\\\/\\\/a.nel.cloudflare.com\\\/report\\\/v3?s=CRJAeqiza7AvRnys%2FQtz8PtyW0rVPbDbYpd5vkRNFd38WDwR5gYzQW5Ynp7CI5ggXQsgNHatx3h0OkSDnSkzAB6hxO3S%2FiiYL%2BC8uWxULUjgMQRKikxHPEALlaikEV1HZ8djOCVZGNXMHD189pw%3D\"}],\"group\":\"cf-nel\",\"max_age\":604800}","NEL":"{\"success_fraction\":0.01,\"report_to\":\"cf-nel\",\"max_age\":604800}","Server":"cloudflare","CF-RAY":"809d73c84d394165-LHR"},"data":"{\"ticket\":{\"url\":\"https:\/\/codebarsolutions.zendesk.com\/api\/v2\/tickets\/26.json\",\"id\":26,\"external_id\":null,\"via\":{\"channel\":\"api\",\"source\":{\"from\":{},\"to\":{},\"rel\":null}},\"created_at\":\"2023-09-20T22:19:51Z\",\"updated_at\":\"2023-09-20T22:19:51Z\",\"type\":null,\"subject\":\"My printer is on fire!\",\"raw_subject\":\"My printer is on fire!\",\"description\":\"The smoke is very colorful.\",\"priority\":\"urgent\",\"status\":\"open\",\"recipient\":null,\"requester_id\":10344275987996,\"submitter_id\":10344275987996,\"assignee_id\":10344275987996,\"organization_id\":10344276178204,\"group_id\":10344307646492,\"collaborator_ids\":[],\"follower_ids\":[],\"email_cc_ids\":[],\"forum_topic_id\":null,\"problem_id\":null,\"has_incidents\":false,\"is_public\":true,\"due_at\":null,\"tags\":[],\"custom_fields\":[{\"id\":10344329458332,\"value\":null},{\"id\":10350920893084,\"value\":\"Check field works\"},{\"id\":10350942541980,\"value\":\"Check field works number 2\"}],\"satisfaction_rating\":null,\"sharing_agreement_ids\":[],\"custom_status_id\":10344313751708,\"fields\":[{\"id\":10344329458332,\"value\":null},{\"id\":10350920893084,\"value\":\"Check field works\"},{\"id\":10350942541980,\"value\":\"Check field works number 2\"}],\"followup_ids\":[],\"ticket_form_id\":10344290972956,\"brand_id\":10344297007388,\"allow_channelback\":false,\"allow_attachments\":true,\"from_messaging_channel\":false},\"audit\":{\"id\":10509502480156,\"ticket_id\":26,\"created_at\":\"2023-09-20T22:19:51Z\",\"author_id\":10344275987996,\"metadata\":{\"system\":{\"client\":\"GuzzleHttp\/7\",\"ip_address\":\"92.233.100.169\",\"location\":\"Ilford, ENG, United Kingdom\",\"latitude\":51.5749,\"longitude\":0.0869},\"custom\":{}},\"events\":[{\"id\":10509464844572,\"type\":\"AssociateAttValsEvent\",\"attribute_values\":[]},{\"id\":10509502480284,\"type\":\"Comment\",\"author_id\":10344275987996,\"body\":\"The smoke is very colorful.\",\"html_body\":\"
The smoke is very colorful.<\/p><\/div>\",\"plain_body\":\"The smoke is very colorful.\",\"public\":true,\"attachments\":[],\"audit_id\":10509502480156},{\"id\":10509502480412,\"type\":\"Create\",\"value\":\"urgent\",\"field_name\":\"priority\"},{\"id\":10509502480540,\"type\":\"Create\",\"value\":\"My printer is on fire!\",\"field_name\":\"subject\"},{\"id\":10509502480668,\"type\":\"Create\",\"value\":\"10344275987996\",\"field_name\":\"requester_id\"},{\"id\":10509502480796,\"type\":\"Create\",\"value\":\"Check field works\",\"field_name\":\"10350920893084\"},{\"id\":10509502480924,\"type\":\"Create\",\"value\":\"Check field works number 2\",\"field_name\":\"10350942541980\"},{\"id\":10509502481052,\"type\":\"Create\",\"value\":null,\"field_name\":\"type\"},{\"id\":10509502481180,\"type\":\"Create\",\"value\":\"open\",\"field_name\":\"status\"},{\"id\":10509502481308,\"type\":\"Create\",\"value\":\"10344275987996\",\"field_name\":\"assignee_id\"},{\"id\":10509502481436,\"type\":\"Create\",\"value\":\"10344307646492\",\"field_name\":\"group_id\"},{\"id\":10509502481564,\"type\":\"Create\",\"value\":\"10344276178204\",\"field_name\":\"organization_id\"},{\"id\":10509502481692,\"type\":\"Create\",\"value\":\"10344297007388\",\"field_name\":\"brand_id\"},{\"id\":10509502481820,\"type\":\"Create\",\"value\":\"10344290972956\",\"field_name\":\"ticket_form_id\"},{\"id\":10509502481948,\"type\":\"Create\",\"value\":\"10344313751708\",\"field_name\":\"custom_status_id\"},{\"id\":10509502482076,\"type\":\"Notification\",\"via\":{\"channel\":\"rule\",\"source\":{\"from\":{\"deleted\":false,\"title\":\"Anfragenden \u00fcber neues proaktives Ticket benachrichtigen\",\"id\":10344280371100},\"rel\":\"trigger\"}},\"subject\":\"{{ticket.title}}\",\"body\":\"Dieses Ticket wurde in Ihrem Namen erstellt.\\n\\nUm weitere Kommentare hinzuzuf\u00fcgen, antworten Sie auf diese E-Mail.\\n\\n{{ticket.latest_public_comment_html}}\",\"recipients\":[10344275987996]},{\"id\":10509502482204,\"type\":\"Notification\",\"via\":{\"channel\":\"rule\",\"source\":{\"from\":{\"deleted\":false,\"title\":\"Alle Agenten \u00fcber eingegangene Anfrage benachrichtigen\",\"id\":10344280378780},\"rel\":\"trigger\"}},\"subject\":\"[{{ticket.account}}] {{ticket.title}}\",\"body\":\"Ein Ticket (#{{ticket.id}}) von {{ticket.requester.name}} ist eingegangen. Es ist momentan niemandem zugewiesen.\\n\\n{{ticket.latest_comment_html}}\",\"recipients\":[10344275987996]}],\"via\":{\"channel\":\"api\",\"source\":{\"from\":{},\"to\":{\"name\":\"Sebastian B\u00fcrgin\",\"address\":\"sebastian.buergin@codebar.ch\"},\"rel\":null}}}}"} \ No newline at end of file diff --git a/tests/Fixtures/Saloon/details-incorrect-request.json b/tests/Fixtures/Saloon/details-incorrect-request.json index 01b7572..0524864 100644 --- a/tests/Fixtures/Saloon/details-incorrect-request.json +++ b/tests/Fixtures/Saloon/details-incorrect-request.json @@ -1 +1 @@ -{"statusCode":404,"headers":{"Date":"Fri, 08 Sep 2023 22:25:14 GMT","Content-Type":"application\/json; charset=utf-8","Transfer-Encoding":"chunked","Connection":"keep-alive","strict-transport-security":"max-age=0;","cache-control":"no-cache","x-zendesk-origin-server":"classic-app-server-6b56fbdf4b-44445","x-request-id":["803a9b300a3575d7-LHR","803a9b300a3575d7-LHR"],"x-runtime":"0.012599","X-Zendesk-Zorg":"yes","CF-Cache-Status":"DYNAMIC","Set-Cookie":["__cf_bm=pVzUlgfK281lnisjjbGHWi4lRs5znek8y2WwsMw9wy8-1694211914-0-AYjbMqxpVM2LUHyRzpD3fAOXqWWegD1siCjnJTE7AK6nenL53SaCY+FtbsMxwWICfowsecbETOZQMW3DVX+1NwC3NSGHl9nJJHg\/XtR9IhBL; path=\/; expires=Fri, 08-Sep-23 22:55:14 GMT; domain=.zendesk.com; HttpOnly; Secure; SameSite=None","__cfruid=69818a20caf2c2ea7dceff21af7d00256667759b-1694211914; path=\/; domain=.zendesk.com; HttpOnly; Secure; SameSite=None"],"Report-To":"{\"endpoints\":[{\"url\":\"https:\\\/\\\/a.nel.cloudflare.com\\\/report\\\/v3?s=rBvCe8hC%2FL4CuzILpj%2B3bs6TPq3E%2FNjNqamBuTHy2%2FfwfxNC18955D5kckd%2BFwbfcM7Ouk8mtxKWXihcfzaqwJiXu0%2BVvY%2Bu%2FSvAXroTRzU2EpwhsWAy%2Bf%2F4RmXbHMSac%2BRiTVQpi9KcptcLCFOsUEUZ2RdM\"}],\"group\":\"cf-nel\",\"max_age\":604800}","NEL":"{\"success_fraction\":0,\"report_to\":\"cf-nel\",\"max_age\":604800}","Server":"cloudflare","CF-RAY":"803a9b300a3575d7-LHR"},"data":"{\n \"error\": {\n \"title\": \"No help desk at codebarsolutionsagwrong.zendesk.com\",\n \"message\": \"There is no help desk configured at this address. This means that the address is available and that you can claim it at http:\/\/www.zendesk.com\/signup\"\n }\n}\n"} \ No newline at end of file +{"statusCode":404,"headers":{"Date":"Wed, 20 Sep 2023 22:08:48 GMT","Content-Type":"application\/json; charset=utf-8","Transfer-Encoding":"chunked","Connection":"keep-alive","strict-transport-security":"max-age=0;","cache-control":"no-cache","x-zendesk-origin-server":"classic-app-server-58df4cf69d-f7p7b","x-request-id":["809d639c4daa23d3-LHR","809d639c4daa23d3-LHR"],"x-runtime":"0.012728","X-Zendesk-Zorg":"yes","CF-Cache-Status":"DYNAMIC","Set-Cookie":["__cf_bm=UBTo45LRzyYzIXebWK9ShHEycFfNza9RAKRGrq2fO5k-1695247728-0-ASB\/Jf63MhvEVRNFMfrHsMxDVKaZ4T0iVq4zRnt+UMu64Mt84U0gn9\/e5hHP3zFsJ7+2ZNijYAIR09S4cPM7ieg4pxdLQRULOZXIrukJnLnc; path=\/; expires=Wed, 20-Sep-23 22:38:48 GMT; domain=.zendesk.com; HttpOnly; Secure; SameSite=None","__cfruid=df530d786bcd8e363fbed7457dac6f66267b4be7-1695247728; path=\/; domain=.zendesk.com; HttpOnly; Secure; SameSite=None"],"Report-To":"{\"endpoints\":[{\"url\":\"https:\\\/\\\/a.nel.cloudflare.com\\\/report\\\/v3?s=9XSHYMjlLNbSz7%2BZGK9rNdtNXO18gXe6RtQHXoTpshVvaOLsY40OLDV5QnhCjn5VRBxYS%2ByUhdHOKzVYqaI3VWf1QgS8hPvL1H%2Fuw%2BK6s8wNIMRtTarJDIVEtDhoPGYVeY0%2B8WkrIOFFKg%2F2pl2RVi%2B0kLZR\"}],\"group\":\"cf-nel\",\"max_age\":604800}","NEL":"{\"success_fraction\":0,\"report_to\":\"cf-nel\",\"max_age\":604800}","Server":"cloudflare","CF-RAY":"809d639c4daa23d3-LHR"},"data":"{\n \"error\": {\n \"title\": \"No help desk at codebarsolutionsagwrong.zendesk.com\",\n \"message\": \"There is no help desk configured at this address. This means that the address is available and that you can claim it at http:\/\/www.zendesk.com\/signup\"\n }\n}\n"} \ No newline at end of file diff --git a/tests/Fixtures/Saloon/single-ticket-request.json b/tests/Fixtures/Saloon/single-ticket-request.json index 3ea3db5..8bcd286 100644 --- a/tests/Fixtures/Saloon/single-ticket-request.json +++ b/tests/Fixtures/Saloon/single-ticket-request.json @@ -1 +1 @@ -{"statusCode":200,"headers":{"Date":"Fri, 08 Sep 2023 22:27:33 GMT","Content-Type":"application\/json; charset=utf-8","Transfer-Encoding":"chunked","Connection":"keep-alive","x-zendesk-api-version":"v2","x-zendesk-application-version":"v18303","x-frame-options":"SAMEORIGIN","x-rate-limit":"400","rate-limit":"400","x-rate-limit-remaining":"399","rate-limit-remaining":"399","rate-limit-reset":"27","strict-transport-security":"max-age=31536000; includeSubDomains","etag":"W\/\"c9dbc9b2c6d7be31c4aea90682a55143\"","cache-control":"max-age=0, private, must-revalidate","set-cookie":["_zendesk_cookie=BAhJIhl7ImRldmljZV90b2tlbnMiOnt9fQY6BkVU--0bf2100788cb010d0183feca16aaf88ccaf719ca; path=\/; expires=Sat, 07 Sep 2024 22:49:54 GMT; secure; HttpOnly; SameSite=None","__cfruid=4a250fcac281106e9e27a70f8b47605a03319695-1694212053; path=\/; domain=.codebarsolutions.zendesk.com; HttpOnly; Secure; SameSite=None"],"x-zendesk-origin-server":"classic-app-server-55f8b9dd4b-9qs56","x-request-id":["803a9e95cd23240d-LHR","803a9e95cd23240d-LHR"],"x-runtime":"0.092172","X-Zendesk-Zorg":"yes","CF-Cache-Status":"DYNAMIC","Report-To":"{\"endpoints\":[{\"url\":\"https:\\\/\\\/a.nel.cloudflare.com\\\/report\\\/v3?s=JfpGwpTPAnVUVQDIuLNwVv4YmLCFBy3dB00V1gHPqeksNx9eWMyMFfF8A8q04yf2BujKFY0xTxVEo1x2yHvGnkmHNlYcGaClghr9JHtpZGeSqIiVSUsCW%2Bmijh91e8YZ5zr9XB5pYyNmzhQ7q2o%3D\"}],\"group\":\"cf-nel\",\"max_age\":604800}","NEL":"{\"success_fraction\":0.01,\"report_to\":\"cf-nel\",\"max_age\":604800}","Server":"cloudflare","CF-RAY":"803a9e95cd23240d-LHR"},"data":"{\"ticket\":{\"url\":\"https:\/\/codebarsolutions.zendesk.com\/api\/v2\/tickets\/15.json\",\"id\":15,\"external_id\":null,\"via\":{\"channel\":\"api\",\"source\":{\"from\":{},\"to\":{},\"rel\":null}},\"created_at\":\"2023-09-08T22:25:13Z\",\"updated_at\":\"2023-09-08T22:25:13Z\",\"type\":null,\"subject\":\"My printer is on fire!\",\"raw_subject\":\"My printer is on fire!\",\"description\":\"The smoke is very colorful.\",\"priority\":\"urgent\",\"status\":\"open\",\"recipient\":null,\"requester_id\":10344275987996,\"submitter_id\":10344275987996,\"assignee_id\":10344275987996,\"organization_id\":10344276178204,\"group_id\":10344307646492,\"collaborator_ids\":[],\"follower_ids\":[],\"email_cc_ids\":[],\"forum_topic_id\":null,\"problem_id\":null,\"has_incidents\":false,\"is_public\":true,\"due_at\":null,\"tags\":[],\"custom_fields\":[{\"id\":10344329458332,\"value\":null}],\"satisfaction_rating\":null,\"sharing_agreement_ids\":[],\"custom_status_id\":10344313751708,\"fields\":[{\"id\":10344329458332,\"value\":null}],\"followup_ids\":[],\"ticket_form_id\":10344290972956,\"brand_id\":10344297007388,\"allow_channelback\":false,\"allow_attachments\":true,\"from_messaging_channel\":false}}"} \ No newline at end of file +{"statusCode":200,"headers":{"Date":"Wed, 20 Sep 2023 22:22:49 GMT","Content-Type":"application\/json; charset=utf-8","Transfer-Encoding":"chunked","Connection":"keep-alive","x-zendesk-api-version":"v2","x-zendesk-application-version":"v18422","x-frame-options":"SAMEORIGIN","x-rate-limit":"400","rate-limit":"400","x-rate-limit-remaining":"399","rate-limit-remaining":"399","rate-limit-reset":"11","strict-transport-security":"max-age=31536000; includeSubDomains","etag":"W\/\"5c1cb878e1720cd879d8eb094b4964e4\"","cache-control":"max-age=0, private, must-revalidate","set-cookie":["_zendesk_cookie=BAhJIhl7ImRldmljZV90b2tlbnMiOnt9fQY6BkVU--0bf2100788cb010d0183feca16aaf88ccaf719ca; path=\/; expires=Fri, 20 Sep 2024 14:03:34 GMT; secure; HttpOnly; SameSite=None","__cfruid=1da04762d44ae445fb373bbd375baddf6f718557-1695248569; path=\/; domain=.codebarsolutions.zendesk.com; HttpOnly; Secure; SameSite=None"],"x-zendesk-origin-server":"classic-app-server-9dcbdc8c6-nkpjh","x-request-id":["809d782768e5067e-LHR","809d782768e5067e-LHR"],"x-runtime":"0.111712","X-Zendesk-Zorg":"yes","CF-Cache-Status":"DYNAMIC","Report-To":"{\"endpoints\":[{\"url\":\"https:\\\/\\\/a.nel.cloudflare.com\\\/report\\\/v3?s=RiakFqo47xQf4eyHBScJSnCnXSrMu49Yyr6Jlo%2ByfJm7sAKouiVVfzSzlsMQrzOX9hmZ28CIWI9CHlCQdUHfYAIUAevYmLS6uOKgrwH7CtNXEVbNZPAv8Grw0ZAhP7m4T6dDP%2FlVnSUtN7BeSfw%3D\"}],\"group\":\"cf-nel\",\"max_age\":604800}","NEL":"{\"success_fraction\":0.01,\"report_to\":\"cf-nel\",\"max_age\":604800}","Server":"cloudflare","CF-RAY":"809d782768e5067e-LHR"},"data":"{\"ticket\":{\"url\":\"https:\/\/codebarsolutions.zendesk.com\/api\/v2\/tickets\/21.json\",\"id\":21,\"external_id\":null,\"via\":{\"channel\":\"api\",\"source\":{\"from\":{},\"to\":{},\"rel\":null}},\"created_at\":\"2023-09-11T21:08:16Z\",\"updated_at\":\"2023-09-20T22:21:36Z\",\"type\":null,\"subject\":\"My printer is on fire!\",\"raw_subject\":\"My printer is on fire!\",\"description\":\"The smoke is very colorful.\",\"priority\":\"urgent\",\"status\":\"open\",\"recipient\":null,\"requester_id\":10344275987996,\"submitter_id\":10344275987996,\"assignee_id\":10344275987996,\"organization_id\":10344276178204,\"group_id\":10344307646492,\"collaborator_ids\":[],\"follower_ids\":[],\"email_cc_ids\":[],\"forum_topic_id\":null,\"problem_id\":null,\"has_incidents\":false,\"is_public\":true,\"due_at\":null,\"tags\":[],\"custom_fields\":[{\"id\":10344329458332,\"value\":null},{\"id\":10350920893084,\"value\":\"Check field works\"},{\"id\":10350942541980,\"value\":\"Check field works number 2\"}],\"satisfaction_rating\":null,\"sharing_agreement_ids\":[],\"custom_status_id\":10344313751708,\"fields\":[{\"id\":10344329458332,\"value\":null},{\"id\":10350920893084,\"value\":\"Check field works\"},{\"id\":10350942541980,\"value\":\"Check field works number 2\"}],\"followup_ids\":[],\"ticket_form_id\":10344290972956,\"brand_id\":10344297007388,\"allow_channelback\":false,\"allow_attachments\":true,\"from_messaging_channel\":false}}"} \ No newline at end of file diff --git a/tests/Pest.php b/tests/Pest.php index b07669c..cc8b9d4 100644 --- a/tests/Pest.php +++ b/tests/Pest.php @@ -8,12 +8,3 @@ uses()->beforeEach(function () { Event::fake(); })->in(__DIR__); - -uses()->beforeEach(function () { - config([ - 'zendesk.subdomain' => 'subdomain', - 'zendesk.auth.method' => 'token', - 'zendesk.auth.email_address' => 'test@example.com', - 'zendesk.auth.api_token' => 'token', - ]); -})->in(__DIR__.'/Requests'); diff --git a/tests/Requests/AllTicketsRequestTest.php b/tests/Requests/AllTicketsRequestTest.php index e4910cd..a2767e7 100644 --- a/tests/Requests/AllTicketsRequestTest.php +++ b/tests/Requests/AllTicketsRequestTest.php @@ -16,16 +16,18 @@ $response = $connector->send(new AllTicketsRequest()); + ray($response->dto()); + $mockClient->assertSent(AllTicketsRequest::class); - expect($response->dto()->count)->toBe(1) - ->and($response->dto()->tickets[0]['id'])->toBe(15) + expect($response->dto()->count)->toBe(6) + ->and($response->dto()->tickets[0]['id'])->toBe(21) ->and($response->dto()->tickets[0]['subject'])->toBe('My printer is on fire!') ->and($response->dto()->tickets[0]['raw_subject'])->toBe('My printer is on fire!') ->and($response->dto()->tickets[0]['description'])->toBe('The smoke is very colorful.') ->and($response->dto()->tickets[0]['priority'])->toBe(TicketPriority::URGENT) - ->and($response->dto()->tickets[0]['custom_fields'][1]['id'])->toBe(17195718961677) + ->and($response->dto()->tickets[0]['custom_fields'][1]['id'])->toBe(10350920893084) ->and($response->dto()->tickets[0]['custom_fields'][1]['value'])->toBe('Check field works') - ->and($response->dto()->tickets[0]['custom_fields'][2]['id'])->toBe(17195752153741) + ->and($response->dto()->tickets[0]['custom_fields'][2]['id'])->toBe(10350942541980) ->and($response->dto()->tickets[0]['custom_fields'][2]['value'])->toBe('Check field works number 2'); }); diff --git a/tests/Requests/CountTicketsRequestTest.php b/tests/Requests/CountTicketsRequestTest.php index 8368a0b..62a5d77 100644 --- a/tests/Requests/CountTicketsRequestTest.php +++ b/tests/Requests/CountTicketsRequestTest.php @@ -17,6 +17,6 @@ $mockClient->assertSent(CountTicketsRequest::class); - expect($response->dto()->value)->toBe(1) - ->and($response->dto()->refreshed_at->toDateTimeString())->toBe('2023-09-08 22:25:14'); + expect($response->dto()->value)->toBe(4) + ->and($response->dto()->refreshed_at->toDateTimeString())->toBe('2023-09-20 22:08:07'); }); diff --git a/tests/Requests/CreateAttachmentRequestTest.php b/tests/Requests/CreateAttachmentRequestTest.php index 4f6d375..952c6d4 100644 --- a/tests/Requests/CreateAttachmentRequestTest.php +++ b/tests/Requests/CreateAttachmentRequestTest.php @@ -23,11 +23,11 @@ $mockClient->assertSent(CreateAttachmentRequest::class); - expect($response->dto()->token)->toBe('QyLNkTdFhrpxXu7JzlZcJWLat') + expect($response->dto()->token)->toBe('cs0vflvMytl7PHs8XueOo5mty') ->and($response->dto()->attachment->content_type)->toBe('image/png') ->and($response->dto()->attachment->size)->toBe(26271) ->and($response->dto()->attachment->file_name)->toBe('test.png') ->and($response->dto()->attachment->width)->toBe('640') ->and($response->dto()->attachment->height)->toBe('360') - ->and($response->dto()->attachment->content_url)->toBe('https://codebarsolutions.zendesk.com/attachments/token/bClC0CjrndApmHI1aO9lKT80C/?name=test.png'); + ->and($response->dto()->attachment->content_url)->toBe('https://codebarsolutions.zendesk.com/attachments/token/K32w31jO8UBB37UpKk2i1o4wg/?name=test.png'); }); diff --git a/tests/Requests/CreateSingleTicketRequestTest.php b/tests/Requests/CreateSingleTicketRequestTest.php index 22e8c43..ad9eec2 100644 --- a/tests/Requests/CreateSingleTicketRequestTest.php +++ b/tests/Requests/CreateSingleTicketRequestTest.php @@ -23,11 +23,11 @@ 'subject' => 'My printer is on fire!', 'custom_fields' => [ [ - 'id' => 17195718961677, + 'id' => 10350920893084, 'value' => 'Check field works', ], [ - 'id' => 17195752153741, + 'id' => 10350942541980, 'value' => 'Check field works number 2', ], ], @@ -39,8 +39,8 @@ ->and($response->dto()->raw_subject)->toBe('My printer is on fire!') ->and($response->dto()->description)->toBe('The smoke is very colorful.') ->and($response->dto()->priority)->toBe(TicketPriority::URGENT) - ->and($response->dto()->custom_fields[1]['id'])->toBe(17195718961677) + ->and($response->dto()->custom_fields[1]['id'])->toBe(10350920893084) ->and($response->dto()->custom_fields[1]['value'])->toBe('Check field works') - ->and($response->dto()->custom_fields[2]['id'])->toBe(17195752153741) + ->and($response->dto()->custom_fields[2]['id'])->toBe(10350942541980) ->and($response->dto()->custom_fields[2]['value'])->toBe('Check field works number 2'); }); diff --git a/tests/Requests/SingleTicketRequestTest.php b/tests/Requests/SingleTicketRequestTest.php index a7f8003..492dbc6 100644 --- a/tests/Requests/SingleTicketRequestTest.php +++ b/tests/Requests/SingleTicketRequestTest.php @@ -14,17 +14,17 @@ $connector = new ZendeskConnector; $connector->withMockClient($mockClient); - $response = $connector->send(new SingleTicketRequest(15)); + $response = $connector->send(new SingleTicketRequest(21)); $mockClient->assertSent(SingleTicketRequest::class); - expect($response->dto()->id)->toBe(15) + expect($response->dto()->id)->toBe(21) ->and($response->dto()->subject)->toBe('My printer is on fire!') ->and($response->dto()->raw_subject)->toBe('My printer is on fire!') ->and($response->dto()->description)->toBe('The smoke is very colorful.') ->and($response->dto()->priority)->toBe(TicketPriority::URGENT) - ->and($response->dto()->custom_fields[1]['id'])->toBe(17195718961677) + ->and($response->dto()->custom_fields[1]['id'])->toBe(10350920893084) ->and($response->dto()->custom_fields[1]['value'])->toBe('Check field works') - ->and($response->dto()->custom_fields[2]['id'])->toBe(17195752153741) + ->and($response->dto()->custom_fields[2]['id'])->toBe(10350942541980) ->and($response->dto()->custom_fields[2]['value'])->toBe('Check field works number 2'); }); From 963aa4222627e0c0b7974953dfb212a0d7bf535d Mon Sep 17 00:00:00 2001 From: Rhys Lees <43909932+RhysLees@users.noreply.github.com> Date: Wed, 20 Sep 2023 23:26:21 +0100 Subject: [PATCH 12/17] WIP --- phpunit.xml.bak | 44 -------------------------------------------- 1 file changed, 44 deletions(-) delete mode 100644 phpunit.xml.bak diff --git a/phpunit.xml.bak b/phpunit.xml.bak deleted file mode 100644 index 5ae6cef..0000000 --- a/phpunit.xml.bak +++ /dev/null @@ -1,44 +0,0 @@ - -
-
-
- tests
-
-
-
-
- ./src
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
From 034082ba3f956bfce90ea521f43a6f9f7d1be027 Mon Sep 17 00:00:00 2001
From: Rhys Lees <43909932+RhysLees@users.noreply.github.com>
Date: Wed, 20 Sep 2023 23:31:44 +0100
Subject: [PATCH 13/17] WIP
---
composer.json | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/composer.json b/composer.json
index aa86424..95881c8 100644
--- a/composer.json
+++ b/composer.json
@@ -21,9 +21,11 @@
"php": "^8.2",
"guzzlehttp/guzzle": "^7.2",
"illuminate/contracts": "^10.0",
- "saloonphp/cache-plugin": "^2.1",
- "saloonphp/laravel-plugin": "^2.0",
- "saloonphp/saloon": "^2.0",
+ "laravel/framework": "10.*",
+ "orchestra/testbench": "8.*",
+ "saloonphp/cache-plugin": "^2.3",
+ "saloonphp/laravel-plugin": "^2.1",
+ "saloonphp/saloon": "^2.11",
"spatie/laravel-data": "^3.6",
"spatie/laravel-package-tools": "^1.9.2"
},
@@ -31,7 +33,6 @@
"laravel/pint": "^1.5",
"nunomaduro/collision": "^7.0",
"nunomaduro/larastan": "^2.4.0",
- "orchestra/testbench": "^8.0",
"pestphp/pest": "^2.0",
"pestphp/pest-plugin-laravel": "^2.0",
"phpstan/extension-installer": "^1.1",
From e28f77c398d7df103e10295cafa999fd28937bc7 Mon Sep 17 00:00:00 2001
From: Rhys Lees <43909932+RhysLees@users.noreply.github.com>
Date: Wed, 20 Sep 2023 23:38:16 +0100
Subject: [PATCH 14/17] WIP
---
tests/Pest.php | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/tests/Pest.php b/tests/Pest.php
index cc8b9d4..5a1fb30 100644
--- a/tests/Pest.php
+++ b/tests/Pest.php
@@ -8,3 +8,9 @@
uses()->beforeEach(function () {
Event::fake();
})->in(__DIR__);
+
+uses()->beforeAll(function () {
+ config()->set('zendesk.subdomain', 'codebar-zendesk');
+ config()->set('zendesk.credentials.email', 'fake-email');
+ config()->set('zendesk.credentials.token', 'fake-token');
+})->in(__DIR__);
From 7cd5d7e7352b45f2ca8248f3b5b1a93944ddcd57 Mon Sep 17 00:00:00 2001
From: Rhys Lees <43909932+RhysLees@users.noreply.github.com>
Date: Wed, 20 Sep 2023 23:42:03 +0100
Subject: [PATCH 15/17] WIP
---
tests/Pest.php | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/tests/Pest.php b/tests/Pest.php
index 5a1fb30..103c377 100644
--- a/tests/Pest.php
+++ b/tests/Pest.php
@@ -10,7 +10,9 @@
})->in(__DIR__);
uses()->beforeAll(function () {
- config()->set('zendesk.subdomain', 'codebar-zendesk');
- config()->set('zendesk.credentials.email', 'fake-email');
- config()->set('zendesk.credentials.token', 'fake-token');
+ if (is_dir('Fixtures/Saloon') && count(scandir('Fixtures/Saloon')) > 0) {
+ config()->set('zendesk.subdomain', 'codebar-zendesk');
+ config()->set('zendesk.credentials.email', 'fake-email');
+ config()->set('zendesk.credentials.token', 'fake-token');
+ }
})->in(__DIR__);
From 73642775bbfe115da6908d7fd8dac26864edf657 Mon Sep 17 00:00:00 2001
From: Rhys Lees <43909932+RhysLees@users.noreply.github.com>
Date: Wed, 20 Sep 2023 23:42:46 +0100
Subject: [PATCH 16/17] WIP
---
tests/Pest.php | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/tests/Pest.php b/tests/Pest.php
index 103c377..6bbc2d6 100644
--- a/tests/Pest.php
+++ b/tests/Pest.php
@@ -12,7 +12,7 @@
uses()->beforeAll(function () {
if (is_dir('Fixtures/Saloon') && count(scandir('Fixtures/Saloon')) > 0) {
config()->set('zendesk.subdomain', 'codebar-zendesk');
- config()->set('zendesk.credentials.email', 'fake-email');
- config()->set('zendesk.credentials.token', 'fake-token');
+ config()->set('zendesk.auth.email_address', 'fake-email');
+ config()->set('zendesk.auth.api_token', 'fake-token');
}
})->in(__DIR__);
From 54c905d24224d2c6434f0aeee4dc601ffed46259 Mon Sep 17 00:00:00 2001
From: Rhys Lees <43909932+RhysLees@users.noreply.github.com>
Date: Wed, 20 Sep 2023 23:55:52 +0100
Subject: [PATCH 17/17] WIP
---
tests/Pest.php | 18 +++++-------------
tests/TestCase.php | 6 ++++++
2 files changed, 11 insertions(+), 13 deletions(-)
diff --git a/tests/Pest.php b/tests/Pest.php
index 6bbc2d6..c139630 100644
--- a/tests/Pest.php
+++ b/tests/Pest.php
@@ -3,16 +3,8 @@
use CodebarAg\Zendesk\Tests\TestCase;
use Illuminate\Support\Facades\Event;
-uses(TestCase::class)->in(__DIR__);
-
-uses()->beforeEach(function () {
- Event::fake();
-})->in(__DIR__);
-
-uses()->beforeAll(function () {
- if (is_dir('Fixtures/Saloon') && count(scandir('Fixtures/Saloon')) > 0) {
- config()->set('zendesk.subdomain', 'codebar-zendesk');
- config()->set('zendesk.auth.email_address', 'fake-email');
- config()->set('zendesk.auth.api_token', 'fake-token');
- }
-})->in(__DIR__);
+uses(TestCase::class)
+ ->beforeEach(function () {
+ Event::fake();
+ })
+ ->in(__DIR__);
diff --git a/tests/TestCase.php b/tests/TestCase.php
index a4319ac..fcafde4 100644
--- a/tests/TestCase.php
+++ b/tests/TestCase.php
@@ -38,5 +38,11 @@ public function getEnvironmentSetUp($app): void
'database' => ':memory:',
'prefix' => '',
]);
+
+ if (is_dir(__DIR__ . '/Fixtures/Saloon/') && count(scandir(__DIR__ . '/Fixtures/Saloon')) > 0) {
+ $app['config']->set('zendesk.subdomain', 'codebar-zendesk');
+ $app['config']->set('zendesk.auth.email_address', 'fake-email');
+ $app['config']->set('zendesk.auth.api_token', 'fake-token');
+ }
}
}