Skip to content

Commit

Permalink
Open for php8
Browse files Browse the repository at this point in the history
  • Loading branch information
vody105 authored and f3l1x committed Nov 13, 2020
1 parent 5a17a6d commit 288105f
Show file tree
Hide file tree
Showing 8 changed files with 67 additions and 82 deletions.
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ phpstan: vendor
vendor/bin/phpstan analyse -l max -c phpstan.neon src

tests: vendor
vendor/bin/phpunit tests --colors=always
vendor/bin/tester -s -p php --colors 1 -C tests/cases

coverage: vendor
phpdbg -qrr vendor/bin/phpunit tests --colors=always -c tests/coverage.xml
vendor/bin/tester -s -p phpdbg --colors 1 -C --coverage ./coverage.xml --coverage-src ./src tests/cases
9 changes: 1 addition & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

| State | Version | Branch | Nette | PHP |
|-------------|---------|----------|-------|---------|
| dev | `^0.3` | `master` | 3.0+ | `^7.2` |
| dev | `^0.3` | `master` | 3.0+ | `>=7.2` |
| stable | `^0.2` | `master` | 3.0+ | `^7.2` |
| stable | `^0.1` | `master` | 2.4 | `>=7.1` |

Expand All @@ -39,13 +39,6 @@
</br>
<a href="https://github.com/f3l1x">Milan Felix Šulc</a>
</td>
<td align="center">
<a href="https://github.com/mabar">
<img width="150" height="150" src="https://avatars0.githubusercontent.com/u/20974277?s=150&v=4">
</a>
</br>
<a href="https://github.com/mabar">Marek Bartoš</a>
</td>
</tr>
</tbody>
</table>
Expand Down
7 changes: 4 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,21 @@
}
],
"require": {
"php": "^7.2",
"php": ">=7.2",
"nette/di": "~3.0.1",
"predis/predis": "^1.1.1"
},
"require-dev": {
"mockery/mockery": "^1.3.3",
"nette/caching": "~3.0.0",
"nette/http": "~3.0.1",
"ninjify/nunjuck": "^0.4.0",
"ninjify/qa": "^0.10.0",
"phpstan/extension-installer": "^1.0",
"phpstan/phpstan-deprecation-rules": "^0.11",
"phpstan/phpstan-nette": "^0.11",
"phpstan/phpstan-shim": "^0.11",
"phpstan/phpstan-strict-rules": "^0.11",
"phpunit/phpunit": "^8.2.1",
"tracy/tracy": "~2.7.0"
},
"autoload": {
Expand All @@ -39,7 +40,7 @@
},
"autoload-dev": {
"psr-4": {
"Tests\\Contributte\\Redis\\": "tests"
"Tests\\Cases\\Redis\\": "tests"
}
},
"minimum-stability": "dev",
Expand Down
10 changes: 10 additions & 0 deletions tests/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Folders - recursive
*.expected
*.actual

# Folders
/tmp

# Files
/*.log
/*.html
58 changes: 0 additions & 58 deletions tests/RedisStorageTest.php

This file was deleted.

11 changes: 11 additions & 0 deletions tests/bootstrap.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?php declare(strict_types = 1);

use Ninjify\Nunjuck\Environment;

if (@!include __DIR__ . '/../vendor/autoload.php') {
echo 'Install Nette Tester using `composer update --dev`';
exit(1);
}

// Configure environment
Environment::setup(__DIR__);
39 changes: 39 additions & 0 deletions tests/cases/RedisStorage.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<?php declare(strict_types = 1);

namespace Tests\Cases\Redis;

use Contributte\Redis\Caching\RedisStorage;
use Mockery;
use Predis\Client;
use Predis\Command\Command;
use Predis\Connection\ConnectionInterface;
use Tester\Assert;

require_once __DIR__ . '/../bootstrap.php';

test(function (): void {
$storage = (object) [];

$conn = Mockery::mock(ConnectionInterface::class)
->shouldReceive('executeCommand')
->andReturnUsing(function (Command $command) use ($storage) {
switch ($command->getId()) {
case 'SET':
$storage->{$command->getArguments()[0]} = $command->getArguments()[1];
return null;
case 'DEL':
$storage->{$command->getArguments()[0]} = null;
return null;
default:
return $storage->{$command->getArguments()[0]} ?? null;
}
})->getMock();

$redis = new RedisStorage(new Client($conn));
$redis->write('foo', 'bar', []);
Assert::same('bar', $redis->read('foo'));
$redis->write('foo', 'bat', []);
Assert::same('bat', $redis->read('foo'));
$redis->remove('foo');
Assert::null($redis->read('foo'));
});
11 changes: 0 additions & 11 deletions tests/coverage.xml

This file was deleted.

0 comments on commit 288105f

Please sign in to comment.