/
githubmirror
/
framework
Обзор
Документация
Войти
/
githubmirror
/
framework
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
13.x
tests/Integration/Redis/PredisConnectionTest.php
42 строки
1 KB
Jason McCreary
[13.x] Mockery cleanup (#61117)
10 авг 2026, 20:23
Не верифицирован
10 авг 2026, 20:23
2ee40ee
Код
Авторство
О чём код?
<?php namespace Illuminate\Tests\Integration\Redis; use Illuminate\Redis\Connections\PredisConnection; use Illuminate\Redis\Events\CommandExecuted; use Illuminate\Support\Facades\Event; use Mockery; use Orchestra\Testbench\Attributes\WithConfig; use Orchestra\Testbench\TestCase; use Predis\Client; use Predis\Command\Argument\Search\SearchArguments; #[WithConfig('database.redis.client', 'predis')] class PredisConnectionTest extends TestCase { public function testPredisCanEmitEventWithArrayableArgumentObject() { if (! class_exists(SearchArguments::class)) { return $this->markTestSkipped('Skipped tests on predis/predis dependency without '.SearchArguments::class); } $event = Event::fake(); $command = 'ftSearch'; $parameters = ['test', '*', (new SearchArguments())->dialect('3')->withScores()]; $client = Mockery::mock(Client::class); $predis = new PredisConnection($client); $predis->setEventDispatcher($event); $client->expects($command)->with(...$parameters)->andReturnTrue(); $this->assertTrue($predis->command($command, $parameters)); $event->assertDispatched(function (CommandExecuted $event) use ($command) { return $event->connection instanceof PredisConnection && $event->command === $command && $event->parameters === ['test', '*', ['DIALECT', '3', 'WITHSCORES']]; }); } }