[NFC][PHP8.1] Ensure that Trait function is only accessed by classes that use the...
authorSeamus Lee <seamuslee001@gmail.com>
Thu, 28 Jul 2022 21:37:42 +0000 (07:37 +1000)
committerSeamus Lee <seamuslee001@gmail.com>
Thu, 28 Jul 2022 21:37:42 +0000 (07:37 +1000)
tests/phpunit/CRM/Core/Resources/CollectionTestTrait.php

index 63fad9d1986e3ca40a99ad1d3a5cc9f785f93ddf..caead5920cca93b6c10760b66883274618120844 100644 (file)
  */
 trait CRM_Core_Resources_CollectionTestTrait {
 
+  use CRM_Core_Resources_CollectionAdderTrait;
+
+  /**
+   * Add an item to the collection.
+   *
+   * @param array $snippet
+   * @return array
+   *   The full/computed snippet (with defaults applied).
+   * @see CRM_Core_Resources_CollectionInterface::add()
+   * @see CRM_Core_Resources_CollectionTrait::add()
+   */
+  public function add($snippet) {
+    return $snippet;
+  }
+
+  /**
+   * Locate the 'settings' snippet.
+   *
+   * @param array $options
+   * @return array
+   * @see CRM_Core_Resources_CollectionTrait::findCreateSettingSnippet()
+   */
+  public function &findCreateSettingSnippet($options = []): array {
+    return $options;
+  }
+
   /**
    * @return \CRM_Core_Resources_CollectionInterface
    */
@@ -329,7 +355,7 @@ trait CRM_Core_Resources_CollectionTestTrait {
    */
   public function testStandardSplatParser() {
     $parse = function(...$options) {
-      return CRM_Core_Resources_CollectionAdderTrait::mergeStandardOptions($options, []);
+      return self::mergeStandardOptions($options, []);
     };
     $this->assertEquals([], $parse());
     $this->assertEquals(['weight' => '100'], $parse('100'));
@@ -346,7 +372,7 @@ trait CRM_Core_Resources_CollectionTestTrait {
    */
   public function testSettingsSplatParser() {
     $parse = function(...$options) {
-      return CRM_Core_Resources_CollectionAdderTrait::mergeSettingOptions($options, []);
+      return self::mergeSettingOptions($options, []);
     };
     $this->assertEquals([], $parse());
     $this->assertEquals(['region' => 'oakaneigh'], $parse('oakaneigh'));