diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml
index abf18652ab..db88044590 100644
--- a/.github/workflows/ci.yaml
+++ b/.github/workflows/ci.yaml
@@ -29,7 +29,7 @@ jobs:
strategy:
fail-fast: true
matrix:
- php: [8.3, 8.4, 8.5]
+ php: [8.4, 8.5]
env:
DB_CONNECTION: sqlite
DB_DATABASE: testing.sqlite
@@ -84,13 +84,18 @@ jobs:
env:
CREATE_SNAPSHOTS: "false"
+ - name: Feature tests
+ run: vendor/bin/pest tests/Feature --parallel --do-not-fail-on-phpunit-warning
+ env:
+ CREATE_SNAPSHOTS: "false"
+
mysql:
name: MySQL
runs-on: ubuntu-latest
strategy:
fail-fast: true
matrix:
- php: [8.5]
+ php: [8.4, 8.5]
database: ["mysql:8.4", "mysql:9.6"]
services:
database:
@@ -153,7 +158,7 @@ jobs:
fail-fast: true
matrix:
php: [8.5]
- database: ["mariadb:10.11", "mariadb:11.4"]
+ database: ["mariadb:11.4"]
services:
database:
image: ${{ matrix.database }}
diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml
index 039d526770..03a70057f0 100644
--- a/.github/workflows/lint.yaml
+++ b/.github/workflows/lint.yaml
@@ -35,7 +35,7 @@ jobs:
strategy:
fail-fast: true
matrix:
- php: [8.3, 8.4, 8.5]
+ php: [8.4, 8.5]
steps:
- name: Code Checkout
uses: actions/checkout@v6
diff --git a/app/Listeners/DispatchWebhooks.php b/app/Listeners/DispatchWebhooks.php
index 93b138337c..80c184036a 100644
--- a/app/Listeners/DispatchWebhooks.php
+++ b/app/Listeners/DispatchWebhooks.php
@@ -86,7 +86,8 @@ protected function handleGenericClassEvent(string $eventName, array $payload): v
$obj = $payload[0] ?? null;
$webhookData = ['event' => $eventName, 'timestamp' => now()->toIso8601String()];
if (is_object($obj)) {
- $webhookData['data'] = $obj->toArray();
+ // Custom event classes rarely implement toArray, so fall back to their public properties
+ $webhookData['data'] = is_callable([$obj, 'toArray']) ? $obj->toArray() : get_object_vars($obj);
} elseif (is_array($obj)) {
$webhookData['data'] = $obj;
}
diff --git a/composer.json b/composer.json
index eca5c746d7..4bea745034 100644
--- a/composer.json
+++ b/composer.json
@@ -3,7 +3,7 @@
"description": "The free, open-source game management panel. Supporting Minecraft, Spigot, BungeeCord, and SRCDS servers.",
"license": "AGPL-3.0-only",
"require": {
- "php": "^8.3 || ^8.4 || ^8.5",
+ "php": "^8.4 || ^8.5",
"ext-intl": "*",
"ext-json": "*",
"ext-mbstring": "*",
@@ -94,7 +94,7 @@
"pestphp/pest-plugin": true
},
"platform": {
- "php": "8.3"
+ "php": "8.4"
}
},
"minimum-stability": "stable",
diff --git a/composer.lock b/composer.lock
index 82c1ede24e..ebdf15e745 100644
--- a/composer.lock
+++ b/composer.lock
@@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
- "content-hash": "12ca4c66e7510642652722281dec8150",
+ "content-hash": "609aa1fba9d85e0b9286c90a623cf144",
"packages": [
{
"name": "anourvalar/eloquent-serialize",
@@ -15892,7 +15892,7 @@
"prefer-stable": true,
"prefer-lowest": false,
"platform": {
- "php": "^8.3 || ^8.4 || ^8.5",
+ "php": "^8.4 || ^8.5",
"ext-intl": "*",
"ext-json": "*",
"ext-mbstring": "*",
@@ -15901,7 +15901,7 @@
},
"platform-dev": {},
"platform-overrides": {
- "php": "8.3"
+ "php": "8.4"
},
"plugin-api-version": "2.9.0"
}
diff --git a/phpunit.xml b/phpunit.xml
index 1f52f89f67..8cc9d0652b 100644
--- a/phpunit.xml
+++ b/phpunit.xml
@@ -14,6 +14,9 @@
./tests/Filament
+
+ ./tests/Feature
+
diff --git a/tests/Feature/Webhooks/DispatchWebhooksTest.php b/tests/Feature/Webhooks/DispatchWebhooksTest.php
index 4779273536..ae85ccb7e2 100644
--- a/tests/Feature/Webhooks/DispatchWebhooksTest.php
+++ b/tests/Feature/Webhooks/DispatchWebhooksTest.php
@@ -68,7 +68,7 @@ public function test_it_does_not_call_removed_events(): void
'events' => ['eloquent.created: '.Server::class],
]);
- $webhookConfig->update(['events' => 'eloquent.deleted: '.Server::class]);
+ $webhookConfig->update(['events' => ['eloquent.deleted: '.Server::class]]);
$this->createServer();
diff --git a/tests/Feature/Webhooks/ProcessWebhooksTest.php b/tests/Feature/Webhooks/ProcessWebhooksTest.php
index 40c6a33822..836b278a8f 100644
--- a/tests/Feature/Webhooks/ProcessWebhooksTest.php
+++ b/tests/Feature/Webhooks/ProcessWebhooksTest.php
@@ -64,16 +64,19 @@ public function test_it_sends_a_single_webhook(): void
ProcessWebhook::dispatchSync(
$webhook,
'eloquent.created: '.Server::class,
- $data,
+ [$data],
);
$this->assertCount(1, cache()->get("webhooks.$eventName"));
$this->assertEquals($webhook->id, cache()->get("webhooks.$eventName")->first()->id);
+ $expected = $data;
+ $expected['event'] = WebhookConfiguration::transformClassName($eventName);
+
Http::assertSentCount(1);
- Http::assertSent(function (Request $request) use ($webhook, $data) {
+ Http::assertSent(function (Request $request) use ($webhook, $expected) {
return $webhook->endpoint === $request->url()
- && $request->data() === $data;
+ && $request->data() === $expected;
});
}
@@ -143,7 +146,7 @@ public function test_it_records_when_a_webhook_is_sent(): void
$this->assertDatabaseCount(Webhook::class, 1);
$webhook = Webhook::query()->first();
- $this->assertEquals($server->uuid, $webhook->payload[0]['uuid']);
+ $this->assertEquals($server->uuid, $webhook->payload['data']['uuid']);
$this->assertDatabaseHas(Webhook::class, [
'endpoint' => $webhookConfig->endpoint,
@@ -165,8 +168,8 @@ public function test_it_records_when_a_webhook_fails(): void
$server = $this->createServer();
$this->assertDatabaseCount(Webhook::class, 1);
+ $this->assertEquals($server->uuid, Webhook::query()->first()->payload['data']['uuid']);
$this->assertDatabaseHas(Webhook::class, [
- 'payload' => json_encode([$server->toArray()]),
'endpoint' => $webhookConfig->endpoint,
'successful_at' => null,
'event' => 'eloquent.created: '.Server::class,