From 0896b6bcacb7e199164f14b28eec4c2f73c468b7 Mon Sep 17 00:00:00 2001 From: recursivetree <60423027+recursivetree@users.noreply.github.com> Date: Tue, 20 Aug 2024 21:24:26 +0200 Subject: [PATCH] make some tests pass --- src/Http/Composers/CharacterFilter.php | 3 +-- tests/Acl/AlliancePolicyTest.php | 6 ++++++ tests/Acl/CharacterPolicyTest.php | 6 ++++++ tests/Acl/CorporationPolicyTest.php | 3 +++ 4 files changed, 16 insertions(+), 2 deletions(-) diff --git a/src/Http/Composers/CharacterFilter.php b/src/Http/Composers/CharacterFilter.php index 46d1a55aa..01f16642f 100644 --- a/src/Http/Composers/CharacterFilter.php +++ b/src/Http/Composers/CharacterFilter.php @@ -33,12 +33,11 @@ public function compose(View $view) // work with raw arrays since the filter code requires an array of objects, and laravel collections don't like to give us that $newrules = []; foreach ($rules as $rule) { + // convert route names to urls, but keep arrays with hardcoded options if(is_string($rule['src'])){ $rule['src'] = route($rule['src']); } - $newrules[] = (object) $rule; - } $view->with('characterFilterRules', $newrules); diff --git a/tests/Acl/AlliancePolicyTest.php b/tests/Acl/AlliancePolicyTest.php index c4fbfabf9..8f0162461 100644 --- a/tests/Acl/AlliancePolicyTest.php +++ b/tests/Acl/AlliancePolicyTest.php @@ -149,6 +149,9 @@ public function testAlliancePermissionsAsWildcard() */ public function testAlliancePermissionsAsDelegatedCharacter() { + // make sure this doesn't generate observer events that trigger the squads logic + CharacterAffiliation::unsetEventDispatcher(); + $permissions = array_keys(require __DIR__ . '/../../src/Config/Permissions/alliance.php'); $user = User::factory()->create(); @@ -199,6 +202,9 @@ public function testAlliancePermissionsAsDelegatedCharacter() */ public function testAlliancePermissionsAsDelegatedCorporation() { + // make sure this doesn't generate observer events that trigger the squads logic + CharacterAffiliation::unsetEventDispatcher(); + $permissions = array_keys(require __DIR__ . '/../../src/Config/Permissions/alliance.php'); $user = User::factory()->create(); diff --git a/tests/Acl/CharacterPolicyTest.php b/tests/Acl/CharacterPolicyTest.php index b909b1282..906286dec 100644 --- a/tests/Acl/CharacterPolicyTest.php +++ b/tests/Acl/CharacterPolicyTest.php @@ -258,6 +258,9 @@ public function testCharacterPermissionsAsDelegatedCharacter() */ public function testCharacterPermissionsAsDelegatedCorporation() { + // make sure this doesn't generate observer events that trigger the squads logic + CharacterAffiliation::unsetEventDispatcher(); + $permissions = array_keys(require __DIR__ . '/../../src/Config/Permissions/character.php'); $user = User::factory()->create(); @@ -313,6 +316,9 @@ public function testCharacterPermissionsAsDelegatedCorporation() */ public function testCharacterPermissionsAsDelegatedAlliance() { + // make sure this doesn't generate observer events that trigger the squads logic + CharacterAffiliation::unsetEventDispatcher(); + $permissions = array_keys(require __DIR__ . '/../../src/Config/Permissions/character.php'); $user = User::factory()->create(); diff --git a/tests/Acl/CorporationPolicyTest.php b/tests/Acl/CorporationPolicyTest.php index 86465b068..81b68b2c2 100644 --- a/tests/Acl/CorporationPolicyTest.php +++ b/tests/Acl/CorporationPolicyTest.php @@ -186,6 +186,9 @@ public function testCorporationPermissionsAsWildcard() */ public function testCorporationPermissionsAsDelegatedCharacter() { + // make sure this doesn't generate observer events that trigger the squads logic + CharacterAffiliation::unsetEventDispatcher(); + $permissions = array_keys(require __DIR__ . '/../../src/Config/Permissions/corporation.php'); $user = User::factory()->create();