Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
RhysLees committed Feb 28, 2025
1 parent d4d3f16 commit 1f6fb9a
Show file tree
Hide file tree
Showing 16 changed files with 17 additions and 27 deletions.
2 changes: 1 addition & 1 deletion .phpunit.cache/test-results
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"version":"pest_2.34.4","defects":{"P\\Tests\\Requests\\CreateSingleTicketRequestTest::__pest_evaluable_it_can_get_create_a_single_ticket":8,"P\\Tests\\Requests\\AllTicketsRequestTest::__pest_evaluable_it_can_get_all_tickets":8},"times":{"P\\Tests\\Requests\\CreateSingleTicketRequestTest::__pest_evaluable_it_can_get_create_a_single_ticket":0.012,"P\\Tests\\Requests\\AllTicketsRequestTest::__pest_evaluable_it_can_get_all_tickets":0.004,"P\\Tests\\Requests\\SingleTicketRequestTest::__pest_evaluable_it_can_get_a_single_ticket":0.002,"P\\Tests\\Core\\ArchTest::__pest_evaluable_it_will_not_use_any_debug_function":0.036,"P\\Tests\\Requests\\CountTicketsRequestTest::__pest_evaluable_it_can_count_all_tickets":0.001,"P\\Tests\\Connectors\\ZendeskConnectorTest::__pest_evaluable_it_will_not_throw_an_exception_if_a_subdomain_is_set":0,"P\\Tests\\Connectors\\ZendeskConnectorTest::__pest_evaluable_it_will_compile_the_correct_authentication_string_for_basic_method":0,"P\\Tests\\Connectors\\ZendeskConnectorTest::__pest_evaluable_it_will_not_throw_an_exception_if_an_auth_method_valid":0,"P\\Tests\\Connectors\\ZendeskConnectorTest::__pest_evaluable_it_will_throw_an_exception_if_a_token_is_not_provided_when_using_the_token_method":0,"P\\Tests\\Connectors\\ZendeskConnectorTest::__pest_evaluable_it_will_not_throw_an_exception_if_a_token_is_provided_when_using_the_token_method":0,"P\\Tests\\Connectors\\ZendeskConnectorTest::__pest_evaluable_it_will_return_the_base_path":0,"P\\Tests\\Connectors\\ZendeskConnectorTest::__pest_evaluable_it_will_throw_an_exception_if_a_subdomain_is_not_set":0,"P\\Tests\\Connectors\\ZendeskConnectorTest::__pest_evaluable_it_will_throw_an_exception_if_an_auth_method_is_not_set":0,"P\\Tests\\Connectors\\ZendeskConnectorTest::__pest_evaluable_it_will_compile_the_correct_authentication_string_for_token_method":0,"P\\Tests\\Connectors\\ZendeskConnectorTest::__pest_evaluable_it_will_not_throw_an_exception_if_a_password_is_provided_when_using_the_password_method":0,"P\\Tests\\Connectors\\ZendeskConnectorTest::__pest_evaluable_it_will_throw_and_authentication_error_when_details_are_incorrect":0.001,"P\\Tests\\Connectors\\ZendeskConnectorTest::__pest_evaluable_it_will_throw_an_exception_if_a_password_is_not_provided_when_using_the_basic_method":0,"P\\Tests\\Connectors\\ZendeskConnectorTest::__pest_evaluable_it_will_throw_an_exception_if_an_auth_method_invalid":0,"P\\Tests\\Requests\\CreateAttachmentRequestTest::__pest_evaluable_it_can_create_an_attachment":0.001}}
{"version":"pest_2.36.0","defects":[],"times":{"P\\Tests\\Requests\\SingleTicketRequestTest::__pest_evaluable_it_can_get_a_single_ticket":0.001,"P\\Tests\\Requests\\CreateSingleTicketRequestTest::__pest_evaluable_it_can_get_create_a_single_ticket":0.046,"P\\Tests\\Core\\ArchTest::__pest_evaluable_it_will_not_use_any_debug_function":0.059,"P\\Tests\\Requests\\CountTicketsRequestTest::__pest_evaluable_it_can_count_all_tickets":0.001,"P\\Tests\\Requests\\AllTicketsRequestTest::__pest_evaluable_it_can_get_all_tickets":0.006,"P\\Tests\\Connectors\\ZendeskConnectorTest::__pest_evaluable_it_will_compile_the_correct_authentication_string_for_token_method":0,"P\\Tests\\Connectors\\ZendeskConnectorTest::__pest_evaluable_it_will_compile_the_correct_authentication_string_for_basic_method":0,"P\\Tests\\Connectors\\ZendeskConnectorTest::__pest_evaluable_it_will_not_throw_an_exception_if_a_subdomain_is_set":0,"P\\Tests\\Connectors\\ZendeskConnectorTest::__pest_evaluable_it_will_not_throw_an_exception_if_an_auth_method_valid":0,"P\\Tests\\Connectors\\ZendeskConnectorTest::__pest_evaluable_it_will_return_the_base_path":0,"P\\Tests\\Connectors\\ZendeskConnectorTest::__pest_evaluable_it_will_throw_an_exception_if_an_auth_method_is_not_set":0,"P\\Tests\\Connectors\\ZendeskConnectorTest::__pest_evaluable_it_will_throw_and_authentication_error_when_details_are_incorrect":0.001,"P\\Tests\\Connectors\\ZendeskConnectorTest::__pest_evaluable_it_will_throw_an_exception_if_a_token_is_not_provided_when_using_the_token_method":0,"P\\Tests\\Connectors\\ZendeskConnectorTest::__pest_evaluable_it_will_throw_an_exception_if_a_subdomain_is_not_set":0,"P\\Tests\\Connectors\\ZendeskConnectorTest::__pest_evaluable_it_will_not_throw_an_exception_if_a_password_is_provided_when_using_the_password_method":0,"P\\Tests\\Connectors\\ZendeskConnectorTest::__pest_evaluable_it_will_not_throw_an_exception_if_a_token_is_provided_when_using_the_token_method":0,"P\\Tests\\Connectors\\ZendeskConnectorTest::__pest_evaluable_it_will_throw_an_exception_if_an_auth_method_invalid":0,"P\\Tests\\Connectors\\ZendeskConnectorTest::__pest_evaluable_it_will_throw_an_exception_if_a_password_is_not_provided_when_using_the_basic_method":0,"P\\Tests\\Requests\\CreateAttachmentRequestTest::__pest_evaluable_it_can_create_an_attachment":0.001}}
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"saloonphp/cache-plugin": "^3.0",
"saloonphp/laravel-plugin": "^3.2",
"saloonphp/saloon": "^3.4",
"spatie/laravel-data": "^4.4.0",
"spatie/laravel-data": "^4.13.1",
"spatie/laravel-package-tools": "^1.16"
},
"require-dev": {
Expand Down
1 change: 0 additions & 1 deletion phpstan.neon.dist
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,4 @@ parameters:
tmpDir: build/phpstan
checkOctaneCompatibility: true
checkModelProperties: true
checkMissingIterableValueType: false

3 changes: 1 addition & 2 deletions src/Dto/Tickets/AllTicketsDTO.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@ public function __construct(
public int $count,
public ?string $next_page_url,
public ?string $previous_page_url,
) {
}
) {}

public static function fromResponse(Response $response): self
{
Expand Down
3 changes: 1 addition & 2 deletions src/Dto/Tickets/Attachments/AttachmentDTO.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@ public function __construct(
public ?array $thumbnails,
public ?string $url,
public ?string $width,
) {
}
) {}

public static function fromArray(array $data): self
{
Expand Down
3 changes: 1 addition & 2 deletions src/Dto/Tickets/Attachments/ThumbnailDTO.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@ public function __construct(
public ?int $size,
public ?string $url,
public ?string $width,
) {
}
) {}

public static function fromArray(array $data): self
{
Expand Down
3 changes: 1 addition & 2 deletions src/Dto/Tickets/Attachments/UploadDTO.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@ public function __construct(
public Carbon $expires_at,
public array $attachments,
public AttachmentDTO $attachment,
) {
}
) {}

public static function fromResponse(Response $response): self
{
Expand Down
3 changes: 1 addition & 2 deletions src/Dto/Tickets/Comments/CommentDTO.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@ public function __construct(
public ?string $type,
public ?array $uploads,
public ?array $via,
) {
}
) {}

public static function fromArray(array $data): self
{
Expand Down
3 changes: 1 addition & 2 deletions src/Dto/Tickets/CountTicketsDTO.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@ class CountTicketsDTO extends Data
public function __construct(
public ?int $value,
public ?Carbon $refreshed_at,
) {
}
) {}

public static function fromResponse(Response $response): self
{
Expand Down
3 changes: 1 addition & 2 deletions src/Dto/Tickets/SingleTicketDTO.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,7 @@ public function __construct(
public ?int $via_followup_source_id,
public ?int $via_id,
public ?array $voice_comment,
) {
}
) {}

public static function fromResponse(Response $response): self
{
Expand Down
3 changes: 1 addition & 2 deletions src/Requests/CreateAttachmentRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@ public function __construct(
protected string $fileName,
protected string $mimeType,
protected mixed $stream,
) {
}
) {}

protected function defaultHeaders(): array
{
Expand Down
3 changes: 1 addition & 2 deletions src/Requests/CreateSingleTicketRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@ public function resolveEndpoint(): string

public function __construct(
readonly protected array|SingleTicketDTO $createTicket
) {
}
) {}

protected function defaultBody(): array
{
Expand Down
4 changes: 1 addition & 3 deletions src/Zendesk.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,4 @@

namespace CodebarAg\Zendesk;

class Zendesk
{
}
class Zendesk {}
4 changes: 2 additions & 2 deletions tests/Requests/AllTicketsRequestTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
$connector = new ZendeskConnector;
$connector->withMockClient($mockClient);

$response = $connector->send(new AllTicketsRequest());
$response = $connector->send(new AllTicketsRequest);

$mockClient->assertSent(AllTicketsRequest::class);

Expand All @@ -23,7 +23,7 @@
->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]['priority'])->toBe(TicketPriority::URGENT->value)
->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(10350942541980)
Expand Down
2 changes: 1 addition & 1 deletion tests/Requests/CountTicketsRequestTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
$connector = new ZendeskConnector;
$connector->withMockClient($mockClient);

$response = $connector->send(new CountTicketsRequest());
$response = $connector->send(new CountTicketsRequest);

$mockClient->assertSent(CountTicketsRequest::class);

Expand Down
2 changes: 2 additions & 0 deletions tests/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
use CodebarAg\Zendesk\ZendeskServiceProvider;
use Illuminate\Database\Eloquent\Factories\Factory;
use Orchestra\Testbench\TestCase as Orchestra;
use Spatie\LaravelData\LaravelDataServiceProvider;
use Spatie\LaravelData\Support\DataConfig;

class TestCase extends Orchestra
Expand All @@ -27,6 +28,7 @@ protected function getPackageProviders($app): array
{
return [
ZendeskServiceProvider::class,
LaravelDataServiceProvider::class,
];
}

Expand Down

0 comments on commit 1f6fb9a

Please sign in to comment.