diff --git a/composer.json b/composer.json
index 332ce29..102c091 100644
--- a/composer.json
+++ b/composer.json
@@ -1,64 +1,70 @@
{
- "name": "igniterlabs/ti-ext-webhook",
- "type": "tastyigniter-package",
- "description": "Connect your third party apps via Zapier or other third-party services to your TastyIgniter website.",
- "license": "MIT",
- "authors": [
- {
- "name": "Igniter Labs Team",
- "email": "hello@igniterlabs.co.uk"
- }
- ],
- "require-dev": {
- "laravel/pint": "^1.2",
- "nunomaduro/larastan": "^2.4.0",
- "orchestra/testbench": "^8.5",
- "pestphp/pest-plugin-laravel": "^2.0",
- "tastyigniter/core": "dev-master",
- "tastyigniter/ti-ext-api": "v4.x-dev as 4.0",
- "tastyigniter/ti-ext-automation": "v4.x-dev as 4.0"
+ "name": "igniterlabs/ti-ext-webhook",
+ "type": "tastyigniter-package",
+ "description": "Connect your third party apps via Zapier or other third-party services to your TastyIgniter website.",
+ "license": "MIT",
+ "authors": [
+ {
+ "name": "Igniter Labs Team",
+ "email": "hello@igniterlabs.co.uk"
+ }
+ ],
+ "repositories": [
+ {
+ "type": "path",
+ "url": "../../../core/"
+ }
+ ],
+ "require-dev": {
+ "laravel/pint": "^1.2",
+ "nunomaduro/larastan": "^2.4.0",
+ "sampoyigi/testbench": "dev-main as 1.0",
+ "pestphp/pest-plugin-laravel": "^2.0",
+ "tastyigniter/core": "*@dev",
+ "tastyigniter/ti-ext-api": "v4.x-dev as 4.0",
+ "tastyigniter/ti-ext-automation": "v4.x-dev as 4.0"
+ },
+ "autoload": {
+ "psr-4": {
+ "IgniterLabs\\Webhook\\": "src/"
+ }
+ },
+ "autoload-dev": {
+ "psr-4": {
+ "IgniterLabs\\Webhook\\Tests\\": "tests/"
+ }
+ },
+ "extra": {
+ "tastyigniter-extension": {
+ "code": "igniterlabs.webhook",
+ "name": "Webhooks",
+ "icon": {
+ "image": "icon.svg",
+ "backgroundColor": "#147EFB",
+ "color": "#FFF"
+ },
+ "require": {
+ "igniter.cart": "*",
+ "igniter.local": "*",
+ "igniter.user": "*",
+ "igniter.reservation": "*"
+ },
+ "homepage": "https://tastyigniter.com/marketplace/item/igniterlabs-webhook"
+ }
+ },
+ "scripts": {
+ "test": "vendor/bin/pest",
+ "test-coverage": "vendor/bin/pest --coverage",
+ "format": "vendor/bin/pint",
+ "static": "vendor/bin/phpstan analyse --ansi --memory-limit 1056M"
+ },
+ "config": {
+ "allow-plugins": {
+ "pestphp/pest-plugin": true,
+ "php-http/discovery": true,
+ "composer/installers": true
},
- "autoload": {
- "psr-4": {
- "IgniterLabs\\Webhook\\": "src/"
- }
- },
- "autoload-dev": {
- "psr-4": {
- "IgniterLabs\\Webhook\\Tests\\": "tests/"
- }
- },
- "extra": {
- "tastyigniter-extension": {
- "code": "igniterlabs.webhook",
- "name": "Webhooks",
- "icon": {
- "image": "icon.svg",
- "backgroundColor": "#147EFB",
- "color": "#FFF"
- },
- "require": {
- "igniter.cart": "*",
- "igniter.local": "*",
- "igniter.user": "*",
- "igniter.reservation": "*"
- },
- "homepage": "https://tastyigniter.com/marketplace/item/igniterlabs-webhook"
- }
- },
- "scripts": {
- "test": "vendor/bin/pest",
- "test-coverage": "vendor/bin/pest --coverage",
- "format": "vendor/bin/pint",
- "static": "vendor/bin/phpstan analyse --ansi --memory-limit 1056M"
- },
- "config": {
- "allow-plugins": {
- "pestphp/pest-plugin": true,
- "php-http/discovery": true,
- "composer/installers": true
- },
- "sort-packages": true
- },
- "minimum-stability": "dev"
+ "sort-packages": true
+ },
+ "minimum-stability": "dev"
}
diff --git a/phpunit.xml.dist b/phpunit.xml.dist
index 1414b2f..45a69c9 100644
--- a/phpunit.xml.dist
+++ b/phpunit.xml.dist
@@ -12,6 +12,7 @@
+
diff --git a/src/Models/Outgoing.php b/src/Models/Outgoing.php
index 3b228fa..8de7496 100755
--- a/src/Models/Outgoing.php
+++ b/src/Models/Outgoing.php
@@ -102,7 +102,7 @@ public function dispatchWebhook($actionCode, $eventCode)
'event_code' => $eventCode,
]);
- Event::fire('igniterlabs.webhook.beforeDispatch', [$webhookJob, $this]);
+ Event::dispatch('igniterlabs.webhook.beforeDispatch', [$webhookJob, $this]);
$webhookJob->dispatch();
}
diff --git a/tests/Pest.php b/tests/Pest.php
index b3d9bbc..9b0c66e 100644
--- a/tests/Pest.php
+++ b/tests/Pest.php
@@ -1 +1,3 @@
in(__DIR__);
diff --git a/tests/WebhookEvents/CategoryTest.php b/tests/WebhookEvents/CategoryTest.php
new file mode 100644
index 0000000..c3451db
--- /dev/null
+++ b/tests/WebhookEvents/CategoryTest.php
@@ -0,0 +1,31 @@
+ 'Category created',
+ 'url' => 'http://webhook.tld',
+ 'events' => ['category'],
+ 'is_active' => true,
+ ]);
+
+ $actionCode = 'created';
+ $payload = Category::makePayloadFromEvent([], $actionCode);
+ resolve(WebhookManager::class)->runWebhookEvent(
+ 'category', $actionCode, $payload ?? []
+ );
+
+ Event::assertDispatched('igniterlabs.webhook.beforeDispatch');
+})->with([
+ 'created'
+]);
diff --git a/tests/WebhookTest.php b/tests/WebhookTest.php
index 4b44535..b055b57 100644
--- a/tests/WebhookTest.php
+++ b/tests/WebhookTest.php
@@ -7,8 +7,6 @@
use IgniterLabs\Webhook\Jobs\CallWebhook;
use Illuminate\Support\Facades\Queue;
-uses(TestCase::class);
-
beforeEach(function () {
Queue::fake();
});
diff --git a/tests/webhookevents/CategoryTest.php b/tests/webhookevents/CategoryTest.php
deleted file mode 100644
index 7473176..0000000
--- a/tests/webhookevents/CategoryTest.php
+++ /dev/null
@@ -1,23 +0,0 @@
-runWebhookEvent(
- 'order', $actionCode, $payload ?? []
- );
- }
-
- public function testCategoryUpdatedEvent()
- {
- }
-}