/
githubmirror
/
framework
Обзор
Документация
Войти
/
githubmirror
/
framework
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
13.x
tests/Cache/CacheMemoizedStoreTest.php
53 строки
2 KB
Jason McCreary
[13.x] Mockery cleanup (#61117)
10 авг 2026, 20:23
Не верифицирован
10 авг 2026, 20:23
2ee40ee
Код
Авторство
О чём код?
<?php namespace Illuminate\Tests\Cache; use BadMethodCallException; use Illuminate\Cache\ArrayStore; use Illuminate\Cache\MemoizedStore; use Illuminate\Cache\NullStore; use Illuminate\Cache\Repository; use Illuminate\Contracts\Cache\Store; use Illuminate\Support\Carbon; use Mockery; use PHPUnit\Framework\TestCase; class CacheMemoizedStoreTest extends TestCase { public function testTouchExtendsTtl(): void { $store = new MemoizedStore('test', new Repository(new ArrayStore)); Carbon::setTestNow($now = Carbon::now()); $store->put('foo', 'bar', 30); $store->touch('foo', 60); Carbon::setTestNow($now->addSeconds(45)); $this->assertSame('bar', $store->get('foo')); } public function testLocksCanBeFlushedWhenUnderlyingStoreSupportsIt(): void { $store = new MemoizedStore('test', new Repository(new ArrayStore)); $this->assertTrue($store->flushLocks()); } public function testFlushLocksThrowsWhenUnderlyingStoreDoesNotSupportIt(): void { $this->expectException(BadMethodCallException::class); $stub = Mockery::mock(Store::class); (new MemoizedStore('test', new Repository($stub)))->flushLocks(); } public function testHasSeparateLockStoreDelegatestoUnderlyingStore(): void { $withSeparate = new MemoizedStore('test', new Repository(new ArrayStore)); $this->assertTrue($withSeparate->hasSeparateLockStore()); $withoutSeparate = new MemoizedStore('test', new Repository(new NullStore)); $this->assertFalse($withoutSeparate->hasSeparateLockStore()); } }