Merge "Type hint against LinkTarget in WatchedItemStore"
[lhc/web/wiklou.git] / tests / phpunit / includes / libs / MemoizedCallableTest.php
index d64ba3d..628cca0 100644 (file)
@@ -1,27 +1,6 @@
 <?php
 /**
- * A MemoizedCallable subclass that stores function return values
- * in an instance property rather than APC or APCu.
- */
-class ArrayBackedMemoizedCallable extends MemoizedCallable {
-       private $cache = [];
-
-       protected function fetchResult( $key, &$success ) {
-               if ( array_key_exists( $key, $this->cache ) ) {
-                       $success = true;
-                       return $this->cache[$key];
-               }
-               $success = false;
-               return false;
-       }
-
-       protected function storeResult( $key, $result ) {
-               $this->cache[$key] = $result;
-       }
-}
-
-/**
- * PHP Unit tests for MemoizedCallable class.
+ * PHPUnit tests for MemoizedCallable class.
  * @covers MemoizedCallable
  */
 class MemoizedCallableTest extends PHPUnit\Framework\TestCase {
@@ -47,7 +26,7 @@ class MemoizedCallableTest extends PHPUnit\Framework\TestCase {
         * Consecutive calls to the memoized callable with the same arguments
         * should result in just one invocation of the underlying callable.
         *
-        * @requires function apc_store/apcu_store
+        * @requires extension apcu
         */
        public function testCallableMemoized() {
                $observer = $this->getMockBuilder( stdClass::class )
@@ -140,3 +119,24 @@ class MemoizedCallableTest extends PHPUnit\Framework\TestCase {
                $memoized = new MemoizedCallable( 14 );
        }
 }
+
+/**
+ * A MemoizedCallable subclass that stores function return values
+ * in an instance property rather than APC or APCu.
+ */
+class ArrayBackedMemoizedCallable extends MemoizedCallable {
+       private $cache = [];
+
+       protected function fetchResult( $key, &$success ) {
+               if ( array_key_exists( $key, $this->cache ) ) {
+                       $success = true;
+                       return $this->cache[$key];
+               }
+               $success = false;
+               return false;
+       }
+
+       protected function storeResult( $key, $result ) {
+               $this->cache[$key] = $result;
+       }
+}