Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"ext-json": "*",
"php": ">=8.2",
"nette/di": "^3.2.4",
"predis/predis": "^2.3.0"
"predis/predis": "^2.3.0 || ^3.0"
},
"suggest": {
"ext-igbinary": "For Igbinary serialization",
Expand Down
8 changes: 5 additions & 3 deletions tests/Cases/Caching/RedisStorage.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,10 @@ require_once __DIR__ . '/../../bootstrap.php';
Toolkit::test(function (): void {
$storage = (object) ['unserialized' => 'unserialized'];

$conn = Mockery::mock(ConnectionInterface::class)
->shouldReceive('executeCommand')
$conn = Mockery::mock(ConnectionInterface::class);
$conn->shouldReceive('getParameters')
->andReturn((object) ['database' => 0, 'protocol' => 2]);
$conn->shouldReceive('executeCommand')
->andReturnUsing(function (Command $command) use ($storage) {
switch ($command->getId()) {
case 'SET':
Expand All @@ -37,7 +39,7 @@ Toolkit::test(function (): void {
default:
return $storage->{$command->getArguments()[0]} ?? null;
}
})->getMock();
});

$redis = new RedisStorage(new Client($conn));
$redis->write('foo', 'bar', []);
Expand Down
9 changes: 7 additions & 2 deletions tests/Cases/E2E/Predis.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
use Nette\Caching\Cache;
use Predis\Client;
use Predis\Connection\ConnectionException;
use Throwable;
use stdClass;

Check failure on line 12 in tests/Cases/E2E/Predis.phpt

View workflow job for this annotation

GitHub Actions / Codesniffer / Codesniffer (8.3)

Use statements should be sorted alphabetically. The first wrong one is stdClass.
use Tester\Assert;
use Tester\Environment;

Expand All @@ -20,8 +21,12 @@
$journal = new RedisJournal($client);
$storage = new RedisStorage($client, $journal);
$cache = new Cache($storage);
} catch (ConnectionException $e) {
Environment::skip('Redis not found: ' . $e->getMessage());
} catch (Throwable $e) {
if ($e instanceof ConnectionException || str_contains($e::class, 'StreamInitException') || str_contains($e::class, 'Connection')) {
Environment::skip('Redis not found: ' . $e->getMessage());
}

throw $e;
}

// Helper function for journal related tests
Expand Down
Loading