From fc6a5a8ecaf87883e768d28c3d76176d8ca35a40 Mon Sep 17 00:00:00 2001 From: Ruben van der Linde Date: Sat, 21 Nov 2026 13:07:57 +0000 Subject: [PATCH] test: accept both value names in the ObjectService doubles OpenRegister publishes the values of its ObjectServiceInterface in OCA\OpenRegister\Contract (task 7.2); the old OCA\OpenRegister\Kernel\Contracts\Value names become deprecated subclasses. The published interface and ObjectService then type these parameters with the published parent class, so a double typed with only the old name is narrower than its parent and fatals at class load. Every test class that implements ObjectServiceInterface or extends ObjectService now types those parameters as the old name OR the published one. PHP matches a union by name without loading the other class, so the doubles load against today's openregister (old names) and against the one that publishes the values. Behaviour, defaults and values are unchanged. Assisted-by: ClaudeCode:claude-opus-5-5 --- tests/Unit/Support/MainApiObjectService.php | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/tests/Unit/Support/MainApiObjectService.php b/tests/Unit/Support/MainApiObjectService.php index 08a855c93..02cfc85a7 100644 --- a/tests/Unit/Support/MainApiObjectService.php +++ b/tests/Unit/Support/MainApiObjectService.php @@ -21,6 +21,7 @@ use OCA\OpenRegister\Contract\ObjectEntityInterface; use OCA\OpenRegister\Contract\ObjectServiceInterface; use OCA\OpenRegister\Kernel\Contracts\Value\ObjectSaveOptions; +use OCA\OpenRegister\Contract\ObjectSaveOptions as PublishedObjectSaveOptions; /** * An ObjectServiceInterface double base on OpenRegister main's saveObject() @@ -34,16 +35,16 @@ abstract class MainApiObjectService implements ObjectServiceInterface { /** * Save an object (main's options form). * - * @param array $object The object to store. - * @param ObjectSaveOptions $options Where and how it is saved. - * @param bool $_rbac Apply register RBAC. - * @param bool $_multitenancy Apply organisation scoping. + * @param array $object The object to store. + * @param ObjectSaveOptions|PublishedObjectSaveOptions $options Where and how it is saved. + * @param bool $_rbac Apply register RBAC. + * @param bool $_multitenancy Apply organisation scoping. * * @return ObjectEntityInterface The stored object. */ abstract public function saveObject( array $object, - ObjectSaveOptions $options=new ObjectSaveOptions(), + ObjectSaveOptions|PublishedObjectSaveOptions $options=new ObjectSaveOptions(), bool $_rbac=true, bool $_multitenancy=true ): ObjectEntityInterface;