/
githubmirror
/
framework
Обзор
Документация
Войти
/
githubmirror
/
framework
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
13.x
tests/Integration/Cache/NoLockTest.php
34 строки
994 B
Mior Muhammad Zaki
[10.x] Test Improvements for Cache tests (#50684)
21 мар 2024, 11:45
Не верифицирован
21 мар 2024, 11:45
8a1a5a2
Код
Авторство
О чём код?
<?php namespace Illuminate\Tests\Integration\Cache; use Illuminate\Support\Facades\Cache; use Orchestra\Testbench\Attributes\WithConfig; use Orchestra\Testbench\TestCase; #[WithConfig('cache.default', 'null')] #[WithConfig('cache.stores.null', ['driver' => 'null'])] class NoLockTest extends TestCase { public function testLocksCanAlwaysBeAcquiredAndReleased() { Cache::lock('foo')->forceRelease(); $lock = Cache::lock('foo', 10); $this->assertTrue($lock->get()); $this->assertTrue(Cache::lock('foo', 10)->get()); $this->assertTrue($lock->release()); $this->assertTrue($lock->release()); } public function testLocksCanBlockForSeconds() { Cache::lock('foo')->forceRelease(); $this->assertSame('taylor', Cache::lock('foo', 10)->block(1, function () { return 'taylor'; })); Cache::lock('foo')->forceRelease(); $this->assertTrue(Cache::lock('foo', 10)->block(1)); } }