File tree 2 files changed +12
-2
lines changed
2 files changed +12
-2
lines changed Original file line number Diff line number Diff line change 5
5
use Spatie \WebhookClient \Exceptions \InvalidConfig ;
6
6
use Spatie \WebhookClient \SignatureValidator \SignatureValidator ;
7
7
use Spatie \WebhookClient \WebhookProfile \WebhookProfile ;
8
+ use Spatie \WebhookClient \WebhookResponse \DefaultRespondsTo ;
8
9
use Spatie \WebhookClient \WebhookResponse \RespondsToWebhook ;
9
10
10
11
class WebhookConfig
@@ -43,11 +44,11 @@ public function __construct(array $properties)
43
44
}
44
45
$ this ->webhookProfile = app ($ properties ['webhook_profile ' ]);
45
46
46
- $ webhookResponseClass = $ properties ['webhook_response ' ] ?? RespondsToWebhook ::class;
47
+ $ webhookResponseClass = $ properties ['webhook_response ' ] ?? DefaultRespondsTo ::class;
47
48
if (! is_subclass_of ($ webhookResponseClass , RespondsToWebhook::class)) {
48
49
throw InvalidConfig::invalidWebhookResponse ($ webhookResponseClass );
49
50
}
50
- $ this ->webhookResponse = app ($ properties [ ' webhook_response ' ] );
51
+ $ this ->webhookResponse = app ($ webhookResponseClass );
51
52
52
53
$ this ->webhookModel = $ properties ['webhook_model ' ];
53
54
Original file line number Diff line number Diff line change @@ -61,6 +61,15 @@ public function it_validates_the_webhook_response()
61
61
new WebhookConfig ($ config );
62
62
}
63
63
64
+ /** @test */
65
+ public function it_uses_the_default_webhook_response_if_none_provided ()
66
+ {
67
+ $ config = $ this ->getValidConfig ();
68
+ $ config ['webhook_response ' ] = null ;
69
+
70
+ $ this ->assertInstanceOf (DefaultRespondsTo::class, (new WebhookConfig ($ config ))->webhookResponse );
71
+ }
72
+
64
73
/** @test */
65
74
public function it_validates_the_process_webhook_job ()
66
75
{
You can’t perform that action at this time.
0 commit comments