Skip to content

Commit 3897800

Browse files
committed
phpunit.xml
1 parent 4857fc2 commit 3897800

File tree

2 files changed

+55
-1
lines changed

2 files changed

+55
-1
lines changed

phpunit.xml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<phpunit backupGlobals="false"
3+
backupStaticAttributes="false"
4+
colors="true"
5+
verbose="false"
6+
convertErrorsToExceptions="true"
7+
convertNoticesToExceptions="true"
8+
convertWarningsToExceptions="true"
9+
processIsolation="false"
10+
stopOnFailure="false"
11+
stopOnError="false">
12+
<testsuites>
13+
<testsuite name="Spiral: Roadrunner lock symfony bridge">
14+
<directory>./tests/</directory>
15+
</testsuite>
16+
</testsuites>
17+
18+
<filter>
19+
<whitelist>
20+
<directory>src</directory>
21+
</whitelist>
22+
</filter>
23+
</phpunit>

tests/RoadRunnerStoreTest.php

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,42 @@
22

33
declare(strict_types=1);
44

5-
namespace Spiral\RoadRunner\Symfony\Lock;
5+
namespace Spiral\RoadRunner\Symfony\Lock\Tests;
66

77
use PHPUnit\Framework\TestCase;
8+
use RoadRunner\Lock\LockInterface as RrLock;
9+
use Spiral\RoadRunner\Symfony\Lock\RoadRunnerStore;
10+
use Symfony\Component\Lock\Key;
811

912
final class RoadRunnerStoreTest extends TestCase
1013
{
14+
public function testSave(): void
15+
{
16+
$rrLock = $this->createMock(RrLock::class);
17+
$rrLock->expects(self::once())
18+
->method('lock')
19+
->with('resource-name');
20+
$store = new RoadRunnerStore($rrLock);
21+
$store->save(new Key('resource-name'));
22+
}
1123

24+
public function testExists(): void
25+
{
26+
$rrLock = $this->createMock(RrLock::class);
27+
$rrLock->expects(self::once())
28+
->method('exists')
29+
->with('resource-name');
30+
$store = new RoadRunnerStore($rrLock);
31+
$store->exists(new Key('resource-name'));
32+
}
33+
34+
public function testPutOffExpiration(): void
35+
{
36+
$rrLock = $this->createMock(RrLock::class);
37+
$rrLock->expects(self::once())
38+
->method('updateTTL')
39+
->with('resource-name', '*', 3600.0);
40+
$store = new RoadRunnerStore($rrLock);
41+
$store->putOffExpiration(new Key('resource-name'), 3600.0);
42+
}
1243
}

0 commit comments

Comments
 (0)