aboutsummaryrefslogtreecommitdiffhomepage
path: root/assets/php/vendor/react/cache/tests/ArrayCacheTest.php
diff options
context:
space:
mode:
Diffstat (limited to 'assets/php/vendor/react/cache/tests/ArrayCacheTest.php')
-rw-r--r--assets/php/vendor/react/cache/tests/ArrayCacheTest.php60
1 files changed, 60 insertions, 0 deletions
diff --git a/assets/php/vendor/react/cache/tests/ArrayCacheTest.php b/assets/php/vendor/react/cache/tests/ArrayCacheTest.php
new file mode 100644
index 0000000..eec3739
--- /dev/null
+++ b/assets/php/vendor/react/cache/tests/ArrayCacheTest.php
@@ -0,0 +1,60 @@
+<?php
+
+namespace React\Tests\Cache;
+
+use React\Cache\ArrayCache;
+
+class ArrayCacheTest extends TestCase
+{
+ private $cache;
+
+ public function setUp()
+ {
+ $this->cache = new ArrayCache();
+ }
+
+ /** @test */
+ public function getShouldRejectPromiseForNonExistentKey()
+ {
+ $this->cache
+ ->get('foo')
+ ->then(
+ $this->expectCallableNever(),
+ $this->expectCallableOnce()
+ );
+ }
+
+ /** @test */
+ public function setShouldSetKey()
+ {
+ $this->cache
+ ->set('foo', 'bar');
+
+ $success = $this->createCallableMock();
+ $success
+ ->expects($this->once())
+ ->method('__invoke')
+ ->with('bar');
+
+ $this->cache
+ ->get('foo')
+ ->then($success);
+ }
+
+ /** @test */
+ public function removeShouldRemoveKey()
+ {
+ $this->cache
+ ->set('foo', 'bar');
+
+ $this->cache
+ ->remove('foo');
+
+ $this->cache
+ ->get('foo')
+ ->then(
+ $this->expectCallableNever(),
+ $this->expectCallableOnce()
+ );
+ }
+}