Skip to content

Commit 62577c7

Browse files
committed
Namespace test files
1 parent a11ae4e commit 62577c7

18 files changed

+64
-42
lines changed

.github/workflows/test-unit.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ jobs:
4242
- name: "Run tests (only for Phpunit)"
4343
if: startsWith(matrix.type, 'Phpunit')
4444
run: |
45-
vendor/bin/phpunit --exclude-group none --no-coverage --fail-on-warning --fail-on-risky $(if vendor/bin/phpunit --version | grep -q '^PHPUnit 9\.'; then echo -v; else echo --fail-on-notice --fail-on-deprecation --display-notices --display-deprecations --display-warnings --display-errors --display-incomplete --display-skipped; fi) --filter '^(?!malkusch\\lock\\mutex\\PHPRedisMutexTest::)'
45+
vendor/bin/phpunit --exclude-group none --no-coverage --fail-on-warning --fail-on-risky $(if vendor/bin/phpunit --version | grep -q '^PHPUnit 9\.'; then echo -v; else echo --fail-on-notice --fail-on-deprecation --display-notices --display-deprecations --display-warnings --display-errors --display-incomplete --display-skipped; fi) --filter '^(?!malkusch\\lock\\Tests\\mutex\\PHPRedisMutexTest::)'
4646
4747
- name: Check Coding Style (only for CodingStyle)
4848
if: matrix.type == 'CodingStyle'

README.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -398,16 +398,16 @@ $mutex->synchronized(function () use ($bankAccount, $amount) {
398398

399399
This project is free and is licensed under the MIT.
400400

401-
[1]: http://semver.org
401+
[1]: http://semver.org/
402402
[2]: https://github.com/nrk/predis
403403
[3]: http://php.net/manual/en/book.pcntl.php
404-
[4]: https://getcomposer.org
405-
[5]: https://github.com/php-lock/lock/blob/master/src/mutex/Mutex.php
406-
[6]: https://github.com/php-lock/lock/blob/master/src/mutex/Mutex.php#L38
407-
[7]: https://github.com/php-lock/lock/blob/master/src/mutex/Mutex.php#L57
408-
[8]: https://github.com/php-lock/lock/blob/master/src/util/DoubleCheckedLocking.php#L72
404+
[4]: https://getcomposer.org/
405+
[5]: https://github.com/php-lock/lock/blob/35526aee28/src/mutex/Mutex.php#L15
406+
[6]: https://github.com/php-lock/lock/blob/35526aee28/src/mutex/Mutex.php#L38
407+
[7]: https://github.com/php-lock/lock/blob/35526aee28/src/mutex/Mutex.php#L60
408+
[8]: https://github.com/php-lock/lock/blob/35526aee28/src/util/DoubleCheckedLocking.php#L63
409409
[9]: https://en.wikipedia.org/wiki/Double-checked_locking
410410
[10]: https://en.wikipedia.org/wiki/Compare-and-swap
411-
[11]: https://github.com/php-lock/lock/blob/master/src/mutex/CASMutex.php#L44
412-
[12]: https://github.com/php-lock/lock/blob/master/src/mutex/LockMutex.php
413-
[13]: https://github.com/php-lock/lock/blob/master/src/exception/LockReleaseException.php
411+
[11]: https://github.com/php-lock/lock/blob/35526aee28/src/mutex/CASMutex.php#L42
412+
[12]: https://github.com/php-lock/lock/blob/35526aee28/src/mutex/LockMutex.php
413+
[13]: https://github.com/php-lock/lock/blob/35526aee28/src/exception/LockReleaseException.php

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@
7474
},
7575
"autoload-dev": {
7676
"psr-4": {
77-
"malkusch\\lock\\": "tests/"
77+
"malkusch\\lock\\Tests\\": "tests/"
7878
}
7979
},
8080
"config": {

tests/mutex/CASMutexTest.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
<?php
22

3-
namespace malkusch\lock\mutex;
3+
namespace malkusch\lock\Tests\mutex;
44

55
use malkusch\lock\exception\LockAcquireException;
6+
use malkusch\lock\mutex\CASMutex;
67
use phpmock\environment\SleepEnvironmentBuilder;
78
use phpmock\phpunit\PHPMock;
89
use PHPUnit\Framework\TestCase;
@@ -18,6 +19,7 @@ protected function setUp(): void
1819

1920
$builder = new SleepEnvironmentBuilder();
2021
$builder->addNamespace(__NAMESPACE__);
22+
$builder->addNamespace('malkusch\lock\mutex');
2123
$builder->addNamespace('malkusch\lock\util');
2224
$sleep = $builder->build();
2325
$sleep->enable();

tests/mutex/FlockMutexTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
<?php
22

3-
namespace malkusch\lock\mutex;
3+
namespace malkusch\lock\Tests\mutex;
44

55
use Eloquent\Liberator\Liberator;
66
use malkusch\lock\exception\DeadlineException;
77
use malkusch\lock\exception\TimeoutException;
8+
use malkusch\lock\mutex\FlockMutex;
89
use malkusch\lock\util\PcntlTimeout;
910
use PHPUnit\Framework\TestCase;
1011

tests/mutex/LockMutexTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
<?php
22

3-
namespace malkusch\lock\mutex;
3+
namespace malkusch\lock\Tests\mutex;
44

55
use malkusch\lock\exception\LockAcquireException;
66
use malkusch\lock\exception\LockReleaseException;
7+
use malkusch\lock\mutex\LockMutex;
78
use PHPUnit\Framework\MockObject\MockObject;
89
use PHPUnit\Framework\TestCase;
910

tests/mutex/MemcachedMutexTest.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
11
<?php
22

3-
namespace malkusch\lock\mutex;
3+
namespace malkusch\lock\Tests\mutex;
44

55
use malkusch\lock\exception\LockReleaseException;
66
use malkusch\lock\exception\TimeoutException;
7+
use malkusch\lock\mutex\MemcachedMutex;
78
use PHPUnit\Framework\MockObject\MockObject;
89
use PHPUnit\Framework\TestCase;
910

1011
/**
11-
* Tests for MemcachedMutex.
12-
*
1312
* Please provide the environment variable MEMCACHE_HOST.
1413
*
1514
* @requires extension memcached

tests/mutex/MutexConcurrencyTest.php

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,23 @@
11
<?php
22

3-
namespace malkusch\lock\mutex;
3+
namespace malkusch\lock\Tests\mutex;
44

55
use Eloquent\Liberator\Liberator;
6+
use malkusch\lock\mutex\FlockMutex;
7+
use malkusch\lock\mutex\MemcachedMutex;
8+
use malkusch\lock\mutex\Mutex;
9+
use malkusch\lock\mutex\MySQLMutex;
10+
use malkusch\lock\mutex\PgAdvisoryLockMutex;
11+
use malkusch\lock\mutex\PHPRedisMutex;
12+
use malkusch\lock\mutex\PredisMutex;
13+
use malkusch\lock\mutex\SemaphoreMutex;
14+
use malkusch\lock\mutex\TransactionalMutex;
615
use PHPUnit\Framework\Constraint\IsType;
716
use PHPUnit\Framework\TestCase;
817
use Predis\Client;
918
use Spatie\Async\Pool;
1019

1120
/**
12-
* Concurrency Tests for Mutex.
13-
*
1421
* If you want to run integration tests you should provide these environment variables:
1522
*
1623
* - MEMCACHE_HOST

tests/mutex/MutexTest.php

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,25 @@
11
<?php
22

3-
namespace malkusch\lock\mutex;
3+
namespace malkusch\lock\Tests\mutex;
44

55
use Eloquent\Liberator\Liberator;
6+
use malkusch\lock\mutex\FlockMutex;
7+
use malkusch\lock\mutex\LockMutex;
8+
use malkusch\lock\mutex\MemcachedMutex;
9+
use malkusch\lock\mutex\Mutex;
10+
use malkusch\lock\mutex\MySQLMutex;
11+
use malkusch\lock\mutex\NoMutex;
12+
use malkusch\lock\mutex\PgAdvisoryLockMutex;
13+
use malkusch\lock\mutex\PHPRedisMutex;
14+
use malkusch\lock\mutex\PredisMutex;
15+
use malkusch\lock\mutex\SemaphoreMutex;
16+
use malkusch\lock\mutex\SpinlockMutex;
17+
use malkusch\lock\mutex\TransactionalMutex;
618
use org\bovigo\vfs\vfsStream;
719
use PHPUnit\Framework\TestCase;
820
use Predis\Client;
921

1022
/**
11-
* Tests for Mutex.
12-
*
1323
* If you want to run integrations tests you should provide these environment variables:
1424
*
1525
* - MEMCACHE_HOST

tests/mutex/PHPRedisMutexTest.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
<?php
22

3-
namespace malkusch\lock\mutex;
3+
namespace malkusch\lock\Tests\mutex;
44

55
use malkusch\lock\exception\LockAcquireException;
66
use malkusch\lock\exception\LockReleaseException;
77
use malkusch\lock\exception\MutexException;
8+
use malkusch\lock\mutex\PHPRedisMutex;
89
use PHPUnit\Framework\TestCase;
910

1011
if (\PHP_MAJOR_VERSION >= 8) {
@@ -52,8 +53,6 @@ public function set($key, $value, $options = null)
5253
}
5354

5455
/**
55-
* Tests for PHPRedisMutex.
56-
*
5756
* These tests require the environment variable:
5857
*
5958
* REDIS_URIS - a comma separated list of redis:// URIs.

0 commit comments

Comments
 (0)