diff --git a/.gitattributes b/.gitattributes
index c917df3..0ab3524 100755
--- a/.gitattributes
+++ b/.gitattributes
@@ -1,12 +1,15 @@
# Files and directories which won't be included in .zip archive during running `composer install --prefer-dist`
-/.github export-ignore
-/.gitattributes export-ignore
-/.gitignore export-ignore
-/.scrutinizer.yml export-ignore
-/.styleci.yml export-ignore
-/phpstan.neon export-ignore
-/phpunit.xml.dist export-ignore
-/Tests export-ignore
-/Resources/images export-ignore
-/Resources/docs export-ignore
+/.idea export-ignore
+/.github export-ignore
+/.gitattributes export-ignore
+/.gitignore export-ignore
+/.scrutinizer.yml export-ignore
+/.styleci.yml export-ignore
+/docker-compose.yml export-ignore
+/Dockerfile export-ignore
+/phpstan.neon export-ignore
+/phpunit.xml.dist export-ignore
+/Tests export-ignore
+/Resources/images export-ignore
+/Resources/docs export-ignore
diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml
index fa09734..96d5e43 100644
--- a/.github/workflows/ci.yaml
+++ b/.github/workflows/ci.yaml
@@ -18,7 +18,7 @@ jobs:
- name: 'Setup PHP'
uses: shivammathur/setup-php@v2
with:
- php-version: 8.3
+ php-version: 8.4
ini-values: memory_limit=-1
coverage: none
tools: composer:v2
@@ -37,7 +37,7 @@ jobs:
- name: 'Setup PHP'
uses: shivammathur/setup-php@v2
with:
- php-version: 8.3
+ php-version: 8.4
ini-values: memory_limit=-1
coverage: none
tools: composer:v2
@@ -58,7 +58,7 @@ jobs:
- name: 'Setup PHP'
uses: shivammathur/setup-php@v2
with:
- php-version: 8.3
+ php-version: 8.4
ini-values: memory_limit=-1
coverage: none
tools: composer:v2
@@ -83,7 +83,7 @@ jobs:
- name: 'Setup PHP'
uses: shivammathur/setup-php@v2
with:
- php-version: 8.3
+ php-version: 8.4
ini-values: memory_limit=-1
coverage: none
tools: composer:v2
@@ -104,9 +104,11 @@ jobs:
matrix:
php-version:
- '8.3'
+ - '8.4'
symfony-version:
- '7.0'
- '7.1'
+ - '7.2'
steps:
- name: 'Checkout Code'
uses: actions/checkout@v4
@@ -141,7 +143,7 @@ jobs:
- name: 'Setup PHP'
uses: shivammathur/setup-php@v2
with:
- php-version: 8.3
+ php-version: 8.4
ini-values: memory_limit=-1
coverage: pcov
tools: composer:v2
diff --git a/.gitignore b/.gitignore
index 3ffdd8a..0efdbe2 100755
--- a/.gitignore
+++ b/.gitignore
@@ -1,3 +1,18 @@
/vendor/
.phpunit.result.cache
composer.lock
+.phpcs-cache
+.php-cs-fixer.cache
+clover-coverage.xml
+
+###> PhpStrom Shared Project Settings ###
+.idea/*
+!.idea/CentrifugoBundle.iml
+!.idea/icon.svg
+!.idea/inspectionProfiles
+!.idea/modules.xml
+!.idea/php-test-framework.xml
+!.idea/php.xml
+!.idea/phpunit.xml
+!.idea/runConfigurations
+###< PhpStrom Shared Project Settings ###
diff --git a/.idea/CentrifugoBundle.iml b/.idea/CentrifugoBundle.iml
new file mode 100644
index 0000000..60ad289
--- /dev/null
+++ b/.idea/CentrifugoBundle.iml
@@ -0,0 +1,15 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml
new file mode 100644
index 0000000..de40a2d
--- /dev/null
+++ b/.idea/inspectionProfiles/Project_Default.xml
@@ -0,0 +1,156 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/modules.xml b/.idea/modules.xml
new file mode 100644
index 0000000..171a1d6
--- /dev/null
+++ b/.idea/modules.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/php-test-framework.xml b/.idea/php-test-framework.xml
new file mode 100644
index 0000000..3d062cf
--- /dev/null
+++ b/.idea/php-test-framework.xml
@@ -0,0 +1,14 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/php.xml b/.idea/php.xml
new file mode 100644
index 0000000..ce44160
--- /dev/null
+++ b/.idea/php.xml
@@ -0,0 +1,111 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ /usr/local/etc/php/conf.d/docker-php-ext-sodium.ini, /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini
+ /usr/local/etc/php/php.ini
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/phpunit.xml b/.idea/phpunit.xml
new file mode 100644
index 0000000..6334aef
--- /dev/null
+++ b/.idea/phpunit.xml
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/runConfigurations/Install_vendors.xml b/.idea/runConfigurations/Install_vendors.xml
new file mode 100644
index 0000000..dad994c
--- /dev/null
+++ b/.idea/runConfigurations/Install_vendors.xml
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/runConfigurations/Run_CI_Pack.xml b/.idea/runConfigurations/Run_CI_Pack.xml
new file mode 100644
index 0000000..b0655a0
--- /dev/null
+++ b/.idea/runConfigurations/Run_CI_Pack.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/runConfigurations/Run_docker_compose.xml b/.idea/runConfigurations/Run_docker_compose.xml
new file mode 100644
index 0000000..51dd264
--- /dev/null
+++ b/.idea/runConfigurations/Run_docker_compose.xml
@@ -0,0 +1,16 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/runConfigurations/Run_unit_tests.xml b/.idea/runConfigurations/Run_unit_tests.xml
new file mode 100644
index 0000000..9418592
--- /dev/null
+++ b/.idea/runConfigurations/Run_unit_tests.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/runConfigurations/Update_vendors.xml b/.idea/runConfigurations/Update_vendors.xml
new file mode 100644
index 0000000..d3ce834
--- /dev/null
+++ b/.idea/runConfigurations/Update_vendors.xml
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.php-cs-fixer.php b/.php-cs-fixer.php
new file mode 100644
index 0000000..985e71b
--- /dev/null
+++ b/.php-cs-fixer.php
@@ -0,0 +1,39 @@
+in(__DIR__)
+ ->exclude('vendor/')
+ ->exclude('public/')
+ ->exclude('config/')
+ ->exclude('src/')
+ ->exclude('tests/')
+ ->notName('composer-setup.php')
+;
+
+return (new PhpCsFixer\Config())
+ ->setParallelConfig(PhpCsFixer\Runner\Parallel\ParallelConfigFactory::detect())
+ ->setRules([
+ '@Symfony' => true,
+ '@Symfony:risky' => true,
+ 'no_unused_imports' => true,
+ 'ordered_imports' => true,
+ 'self_accessor' => false,
+ 'declare_strict_types' => true,
+ 'no_superfluous_phpdoc_tags' => false,
+ 'no_empty_phpdoc' => false,
+ 'visibility_required' => false,
+ 'array_syntax' => [
+ 'syntax' => 'short',
+ ],
+ 'phpdoc_types_order' => [
+ 'null_adjustment' => 'always_last',
+ 'sort_algorithm' => 'none',
+ ],
+ ])
+ ->setUsingCache(true)
+ ->setRiskyAllowed(true)
+ ->setFinder($finder)
+ ->setCacheFile(__DIR__.'/.php-cs-fixer.cache')
+;
diff --git a/DataCollector/CentrifugoCollector.php b/DataCollector/CentrifugoCollector.php
index 88d569a..b858878 100755
--- a/DataCollector/CentrifugoCollector.php
+++ b/DataCollector/CentrifugoCollector.php
@@ -36,7 +36,7 @@ public function __construct(private readonly CommandHistoryLogger $commandHistor
/**
* {@inheritdoc}
*/
- public function collect(Request $request, Response $response, \Throwable $exception = null): void
+ public function collect(Request $request, Response $response, ?\Throwable $exception = null): void
{
$this->data = [
'command_history' => $this->commandHistoryLogger->getCommandHistory(),
diff --git a/Dockerfile b/Dockerfile
new file mode 100644
index 0000000..3dac6c4
--- /dev/null
+++ b/Dockerfile
@@ -0,0 +1,14 @@
+FROM php:8.3
+RUN apt-get update && apt-get -yq \
+ install \
+ git \
+ unzip \
+ zip \
+ libzip-dev \
+ zlib1g-dev \
+ libicu-dev
+RUN pecl install xdebug && docker-php-ext-enable xdebug
+RUN php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
+RUN php composer-setup.php --install-dir=/usr/local/bin --filename=composer
+RUN echo 'memory_limit = 512M' >> /usr/local/etc/php/php.ini
+WORKDIR /var/www/bundle
diff --git a/Exception/CentrifugoErrorException.php b/Exception/CentrifugoErrorException.php
index 24520cf..aa39f18 100755
--- a/Exception/CentrifugoErrorException.php
+++ b/Exception/CentrifugoErrorException.php
@@ -29,7 +29,7 @@ class CentrifugoErrorException extends CentrifugoException
* @param int $code
* @param \Throwable|null $previous
*/
- public function __construct(private readonly CommandInterface $command, ResponseInterface $response, string $message = '', int $code = 0, \Throwable $previous = null)
+ public function __construct(private readonly CommandInterface $command, ResponseInterface $response, string $message = '', int $code = 0, ?\Throwable $previous = null)
{
parent::__construct($response, $message, $code, $previous);
}
diff --git a/Model/BroadcastCommand.php b/Model/BroadcastCommand.php
index 4ad0a99..fb777c4 100755
--- a/Model/BroadcastCommand.php
+++ b/Model/BroadcastCommand.php
@@ -29,7 +29,7 @@ final class BroadcastCommand extends AbstractCommand
public function __construct(array $data, private array $channels, bool $skipHistory = false, array $tags = [], string $base64data = '')
{
$params = [
- 'channels' => \array_values($channels),
+ 'channels' => $channels,
'data' => $data,
];
diff --git a/Model/ChannelsCommand.php b/Model/ChannelsCommand.php
index a940384..91fbfde 100755
--- a/Model/ChannelsCommand.php
+++ b/Model/ChannelsCommand.php
@@ -22,7 +22,7 @@ final class ChannelsCommand extends AbstractCommand implements ResultableCommand
/**
* @param string|null $pattern
*/
- public function __construct(string $pattern = null)
+ public function __construct(?string $pattern = null)
{
$params = [];
diff --git a/Model/DisconnectCommand.php b/Model/DisconnectCommand.php
index d0a9633..f065923 100755
--- a/Model/DisconnectCommand.php
+++ b/Model/DisconnectCommand.php
@@ -26,14 +26,14 @@ final class DisconnectCommand extends AbstractCommand
* @param string|null $session
* @param Disconnect|null $disconnectObject
*/
- public function __construct(string $user, array $clientIdWhitelist = [], string $client = null, string $session = null, Disconnect $disconnectObject = null)
+ public function __construct(string $user, array $clientIdWhitelist = [], ?string $client = null, ?string $session = null, ?Disconnect $disconnectObject = null)
{
$params = [
'user' => $user,
];
if (!empty($clientIdWhitelist)) {
- $params['whitelist'] = \array_values($clientIdWhitelist);
+ $params['whitelist'] = $clientIdWhitelist;
}
if (\is_string($client) && !empty($client)) {
diff --git a/Model/HistoryCommand.php b/Model/HistoryCommand.php
index 712a35e..a6bffe2 100755
--- a/Model/HistoryCommand.php
+++ b/Model/HistoryCommand.php
@@ -27,7 +27,7 @@ final class HistoryCommand extends AbstractCommand implements ResultableCommandI
* @param int|null $limit
* @param StreamPosition|null $streamPosition
*/
- public function __construct(protected readonly string $channel, bool $reverse = false, int $limit = null, StreamPosition $streamPosition = null)
+ public function __construct(protected readonly string $channel, bool $reverse = false, ?int $limit = null, ?StreamPosition $streamPosition = null)
{
$params = [
'channel' => $channel,
diff --git a/Model/PublishCommand.php b/Model/PublishCommand.php
index 1ba133c..760dbdb 100755
--- a/Model/PublishCommand.php
+++ b/Model/PublishCommand.php
@@ -28,7 +28,7 @@ final class PublishCommand extends AbstractCommand
* @param array $tags
* @param string|null $base64data
*/
- public function __construct(array $data, protected readonly string $channel, bool $skipHistory = false, array $tags = [], string $base64data = null)
+ public function __construct(array $data, protected readonly string $channel, bool $skipHistory = false, array $tags = [], ?string $base64data = null)
{
$params = [
'channel' => $channel,
diff --git a/Model/RefreshCommand.php b/Model/RefreshCommand.php
index 4ee80d6..6f9ab2e 100755
--- a/Model/RefreshCommand.php
+++ b/Model/RefreshCommand.php
@@ -26,7 +26,7 @@ final class RefreshCommand extends AbstractCommand
* @param bool|null $expired
* @param int|null $expireAt
*/
- public function __construct(string $user, string $client = null, string $session = null, bool $expired = null, int $expireAt = null)
+ public function __construct(string $user, ?string $client = null, ?string $session = null, ?bool $expired = null, ?int $expireAt = null)
{
$params = ['user' => $user];
diff --git a/Model/SubscribeCommand.php b/Model/SubscribeCommand.php
index 73e8119..10c51bb 100755
--- a/Model/SubscribeCommand.php
+++ b/Model/SubscribeCommand.php
@@ -33,7 +33,7 @@ final class SubscribeCommand extends AbstractCommand
* @param StreamPosition|null $recoverSince
* @param Override|null $override
*/
- public function __construct(string $user, protected readonly string $channel, array $info = [], string $base64Info = null, string $client = null, string $session = null, array $data = [], string $base64Data = null, StreamPosition $recoverSince = null, Override $override = null)
+ public function __construct(string $user, protected readonly string $channel, array $info = [], ?string $base64Info = null, ?string $client = null, ?string $session = null, array $data = [], ?string $base64Data = null, ?StreamPosition $recoverSince = null, ?Override $override = null)
{
$params = [
'user' => $user,
diff --git a/README.md b/README.md
index 2b75dcc..252e5ac 100755
--- a/README.md
+++ b/README.md
@@ -35,7 +35,7 @@ $ composer req fresh/centrifugo-bundle
| Bundle Version (X.Y.Z) | PHP | Symfony | Comment |
|:----------------------:|:--------:|:-------:|:--------------------|
-| `6.0.*` | `>= 8.3` | `7.*` | **Current version** |
+| `6.1.*` | `>= 8.3` | `7.*` | **Current version** |
| `5.3.*` | `>= 8.2` | `7.*` | Previous version |
By default, [Symfony Flex](https://symfony.com/doc/current/setup/flex.html) adds this bundle to the `config/bundles.php` file and adds required environment variables into `.env` file.
diff --git a/Service/Centrifugo.php b/Service/Centrifugo.php
index 3bf3fb5..e2c6c62 100755
--- a/Service/Centrifugo.php
+++ b/Service/Centrifugo.php
@@ -64,7 +64,7 @@ public function broadcast(array $data, array $channels, bool $skipHistory = fals
/**
* {@inheritdoc}
*/
- public function subscribe(string $user, string $channel, array $info = [], string $base64Info = null, string $client = null, string $session = null, array $data = [], string $base64Data = null, StreamPosition $recoverSince = null, Override $override = null): void
+ public function subscribe(string $user, string $channel, array $info = [], ?string $base64Info = null, ?string $client = null, ?string $session = null, array $data = [], ?string $base64Data = null, ?StreamPosition $recoverSince = null, ?Override $override = null): void
{
$this->doSendCommand(new Model\SubscribeCommand($user, $channel, $info, $base64Info, $client, $session, $data, $base64Data, $recoverSince, $override));
}
@@ -80,7 +80,7 @@ public function unsubscribe(string $user, string $channel, string $client = '',
/**
* {@inheritdoc}
*/
- public function disconnect(string $user, array $whitelist = [], string $client = null, string $session = null, Disconnect $disconnectObject = null): void
+ public function disconnect(string $user, array $whitelist = [], ?string $client = null, ?string $session = null, ?Disconnect $disconnectObject = null): void
{
$this->doSendCommand(new Model\DisconnectCommand($user, $whitelist, $client, $session, $disconnectObject));
}
@@ -88,7 +88,7 @@ public function disconnect(string $user, array $whitelist = [], string $client =
/**
* {@inheritdoc}
*/
- public function refresh(string $user, string $client = null, string $session = null, bool $expired = null, int $expireAt = null): void
+ public function refresh(string $user, ?string $client = null, ?string $session = null, ?bool $expired = null, ?int $expireAt = null): void
{
$this->doSendCommand(new Model\RefreshCommand($user, $client, $session, $expired, $expireAt));
}
@@ -112,7 +112,7 @@ public function presenceStats(string $channel): array
/**
* {@inheritdoc}
*/
- public function history(string $channel, bool $reverse = false, int $limit = null, StreamPosition $streamPosition = null): array
+ public function history(string $channel, bool $reverse = false, ?int $limit = null, ?StreamPosition $streamPosition = null): array
{
return (array) $this->doSendCommand(new Model\HistoryCommand($channel, $reverse, $limit, $streamPosition));
}
@@ -128,7 +128,7 @@ public function historyRemove(string $channel): void
/**
* {@inheritdoc}
*/
- public function channels(string $pattern = null): array
+ public function channels(?string $pattern = null): array
{
return (array) $this->doSendCommand(new Model\ChannelsCommand($pattern));
}
diff --git a/Tests/Command/Argument/ArgumentChannelTraitTest.php b/Tests/Command/Argument/ArgumentChannelTraitTest.php
index 437f33c..fb57f30 100755
--- a/Tests/Command/Argument/ArgumentChannelTraitTest.php
+++ b/Tests/Command/Argument/ArgumentChannelTraitTest.php
@@ -31,12 +31,8 @@
*/
final class ArgumentChannelTraitTest extends TestCase
{
- /** @var CentrifugoInterface|MockObject */
private CentrifugoInterface|MockObject $centrifugo;
-
- /** @var CentrifugoChecker|MockObject */
private CentrifugoChecker|MockObject $centrifugoChecker;
-
private Command $command;
private Application $application;
private CommandTester $commandTester;
@@ -69,14 +65,14 @@ protected function tearDown(): void
public function invalidChannelName(): void
{
$this->centrifugoChecker
- ->expects(self::once())
+ ->expects($this->once())
->method('assertValidChannelName')
->with('channelA')
->willThrowException(new CentrifugoInvalidArgumentException('test'))
;
$this->centrifugo
- ->expects(self::never())
+ ->expects($this->never())
->method('presence')
;
@@ -95,12 +91,12 @@ public function invalidChannelName(): void
public function channelNameIsNotString(): void
{
$this->centrifugoChecker
- ->expects(self::never())
+ ->expects($this->never())
->method('assertValidChannelName')
;
$this->centrifugo
- ->expects(self::never())
+ ->expects($this->never())
->method('presence')
;
@@ -119,12 +115,12 @@ public function channelNameIsNotString(): void
public function channelNameIsMissed(): void
{
$this->centrifugoChecker
- ->expects(self::never())
+ ->expects($this->never())
->method('assertValidChannelName')
;
$this->centrifugo
- ->expects(self::never())
+ ->expects($this->never())
->method('presence')
;
diff --git a/Tests/Command/Argument/ArgumentChannelsTraitTest.php b/Tests/Command/Argument/ArgumentChannelsTraitTest.php
index ab7204f..94e6e1e 100755
--- a/Tests/Command/Argument/ArgumentChannelsTraitTest.php
+++ b/Tests/Command/Argument/ArgumentChannelsTraitTest.php
@@ -30,12 +30,8 @@
*/
final class ArgumentChannelsTraitTest extends TestCase
{
- /** @var CentrifugoInterface|MockObject */
private CentrifugoInterface|MockObject $centrifugo;
-
- /** @var CentrifugoChecker|MockObject */
private CentrifugoChecker|MockObject $centrifugoChecker;
-
private Command $command;
private Application $application;
private CommandTester $commandTester;
@@ -68,14 +64,14 @@ protected function tearDown(): void
public function invalidChannelName(): void
{
$this->centrifugoChecker
- ->expects(self::once())
+ ->expects($this->once())
->method('assertValidChannelName')
->with('channelA')
->willThrowException(new InvalidArgumentException('test'))
;
$this->centrifugo
- ->expects(self::never())
+ ->expects($this->never())
->method('broadcast')
;
diff --git a/Tests/Command/Argument/ArgumentDataTraitTest.php b/Tests/Command/Argument/ArgumentDataTraitTest.php
index 7889f55..8a45080 100755
--- a/Tests/Command/Argument/ArgumentDataTraitTest.php
+++ b/Tests/Command/Argument/ArgumentDataTraitTest.php
@@ -30,12 +30,8 @@
*/
final class ArgumentDataTraitTest extends TestCase
{
- /** @var CentrifugoInterface|MockObject */
private CentrifugoInterface|MockObject $centrifugo;
-
- /** @var CentrifugoChecker|MockObject */
private CentrifugoChecker|MockObject $centrifugoChecker;
-
private Command $command;
private Application $application;
private CommandTester $commandTester;
@@ -68,7 +64,7 @@ protected function tearDown(): void
public function dataIsNotValidJson(): void
{
$this->centrifugo
- ->expects(self::never())
+ ->expects($this->never())
->method('broadcast')
;
@@ -88,7 +84,7 @@ public function dataIsNotValidJson(): void
public function dataIsNotString(): void
{
$this->centrifugo
- ->expects(self::never())
+ ->expects($this->never())
->method('broadcast')
;
diff --git a/Tests/Command/Argument/ArgumentUserTraitTest.php b/Tests/Command/Argument/ArgumentUserTraitTest.php
index 6101f56..59c655a 100755
--- a/Tests/Command/Argument/ArgumentUserTraitTest.php
+++ b/Tests/Command/Argument/ArgumentUserTraitTest.php
@@ -29,9 +29,7 @@
*/
final class ArgumentUserTraitTest extends TestCase
{
- /** @var CentrifugoInterface|MockObject */
private CentrifugoInterface|MockObject $centrifugo;
-
private Command $command;
private Application $application;
private CommandTester $commandTester;
@@ -62,7 +60,7 @@ protected function tearDown(): void
public function invalidUser(): void
{
$this->centrifugo
- ->expects(self::never())
+ ->expects($this->never())
->method('disconnect')
;
diff --git a/Tests/Command/BroadcastCommandTest.php b/Tests/Command/BroadcastCommandTest.php
index a764650..1c2f605 100755
--- a/Tests/Command/BroadcastCommandTest.php
+++ b/Tests/Command/BroadcastCommandTest.php
@@ -29,12 +29,8 @@
*/
final class BroadcastCommandTest extends TestCase
{
- /** @var CentrifugoInterface|MockObject */
private CentrifugoInterface|MockObject $centrifugo;
-
- /** @var CentrifugoChecker|MockObject */
private CentrifugoChecker|MockObject $centrifugoChecker;
-
private Command $command;
private Application $application;
private CommandTester $commandTester;
@@ -67,7 +63,7 @@ protected function tearDown(): void
public function successfulExecutionWithRequiredParameters(): void
{
$this->centrifugo
- ->expects(self::once())
+ ->expects($this->once())
->method('broadcast')
->with(['foo' => 'bar'], ['channelA', 'channelB'])
;
@@ -77,19 +73,19 @@ public function successfulExecutionWithRequiredParameters(): void
'command' => $this->command->getName(),
'data' => '{"foo":"bar"}',
'channels' => ['channelA', 'channelB'],
- ]
+ ],
);
- self::assertSame(0, $result);
+ $this->assertSame(0, $result);
$output = $this->commandTester->getDisplay();
- self::assertStringContainsString('DONE', $output);
+ $this->assertStringContainsString('DONE', $output);
}
#[Test]
public function successfulExecutionWithAllParameters(): void
{
$this->centrifugo
- ->expects(self::once())
+ ->expects($this->once())
->method('broadcast')
->with(['foo' => 'bar'], ['channelA', 'channelB'], true, ['env' => 'test'], 'SGVsbG8gd29ybGQ=')
;
@@ -102,19 +98,19 @@ public function successfulExecutionWithAllParameters(): void
'--tags' => '{"env":"test"}',
'--skipHistory' => true,
'--base64data' => 'SGVsbG8gd29ybGQ=',
- ]
+ ],
);
- self::assertSame(0, $result);
+ $this->assertSame(0, $result);
$output = $this->commandTester->getDisplay();
- self::assertStringContainsString('DONE', $output);
+ $this->assertStringContainsString('DONE', $output);
}
#[Test]
public function exception(): void
{
$this->centrifugo
- ->expects(self::once())
+ ->expects($this->once())
->method('broadcast')
->willThrowException(new \Exception('test'))
;
@@ -124,11 +120,11 @@ public function exception(): void
'command' => $this->command->getName(),
'data' => '{"foo":"bar"}',
'channels' => ['channelA', 'channelB'],
- ]
+ ],
);
- self::assertSame(1, $result);
+ $this->assertSame(1, $result);
$output = $this->commandTester->getDisplay();
- self::assertStringContainsString('test', $output);
+ $this->assertStringContainsString('test', $output);
}
}
diff --git a/Tests/Command/ChannelsCommandTest.php b/Tests/Command/ChannelsCommandTest.php
index b5c38ed..fceb742 100755
--- a/Tests/Command/ChannelsCommandTest.php
+++ b/Tests/Command/ChannelsCommandTest.php
@@ -28,9 +28,7 @@
*/
final class ChannelsCommandTest extends TestCase
{
- /** @var CentrifugoInterface|MockObject */
private CentrifugoInterface|MockObject $centrifugo;
-
private Command $command;
private Application $application;
private CommandTester $commandTester;
@@ -61,25 +59,25 @@ protected function tearDown(): void
public function successfulExecutionWithoutPattern(): void
{
$this->centrifugo
- ->expects(self::once())
+ ->expects($this->once())
->method('channels')
->willReturn(['channels' => ['channelA' => ['num_clients' => 33], 'channelB' => ['num_clients' => 25]]])
;
$result = $this->commandTester->execute(['command' => $this->command->getName()]);
- self::assertSame(0, $result);
+ $this->assertSame(0, $result);
$output = $this->commandTester->getDisplay();
- self::assertStringContainsString('channelA 33', $output);
- self::assertStringContainsString('channelB 25', $output);
- self::assertStringContainsString('Total Channels: 2', $output);
+ $this->assertStringContainsString('channelA 33', $output);
+ $this->assertStringContainsString('channelB 25', $output);
+ $this->assertStringContainsString('Total Channels: 2', $output);
}
#[Test]
public function successfulExecutionWithPattern(): void
{
$this->centrifugo
- ->expects(self::once())
+ ->expects($this->once())
->method('channels')
->willReturn(['channels' => ['channelA' => ['num_clients' => 33]]])
;
@@ -87,59 +85,59 @@ public function successfulExecutionWithPattern(): void
$result = $this->commandTester->execute(
[
'command' => $this->command->getName(),
- 'pattern' => 'channelA'
- ]
+ 'pattern' => 'channelA',
+ ],
);
- self::assertSame(0, $result);
+ $this->assertSame(0, $result);
$output = $this->commandTester->getDisplay();
- self::assertStringContainsString('channelA 33', $output);
- self::assertStringContainsString('Total Channels: 1', $output);
+ $this->assertStringContainsString('channelA 33', $output);
+ $this->assertStringContainsString('Total Channels: 1', $output);
}
#[Test]
public function noData(): void
{
$this->centrifugo
- ->expects(self::once())
+ ->expects($this->once())
->method('channels')
->willReturn(['channels' => []])
;
$result = $this->commandTester->execute(['command' => $this->command->getName()]);
- self::assertSame(0, $result);
+ $this->assertSame(0, $result);
$output = $this->commandTester->getDisplay();
- self::assertStringContainsString('NO DATA', $output);
+ $this->assertStringContainsString('NO DATA', $output);
}
#[Test]
public function exception(): void
{
$this->centrifugo
- ->expects(self::once())
+ ->expects($this->once())
->method('channels')
->willThrowException(new \Exception('test'))
;
$result = $this->commandTester->execute(['command' => $this->command->getName()]);
- self::assertSame(1, $result);
+ $this->assertSame(1, $result);
$output = $this->commandTester->getDisplay();
- self::assertStringContainsString('test', $output);
+ $this->assertStringContainsString('test', $output);
}
#[Test]
public function autocomplete(): void
{
$this->centrifugo
- ->expects(self::once())
+ ->expects($this->once())
->method('channels')
->willReturn(['channels' => ['channel1' => [], 'channel2' => []]])
;
$channels = $this->command->getChannelsForAutocompletion()();
- self::assertSame(['channel1', 'channel2'], $channels);
+ $this->assertSame(['channel1', 'channel2'], $channels);
}
}
diff --git a/Tests/Command/DisconnectCommandTest.php b/Tests/Command/DisconnectCommandTest.php
index 631e6db..e4608f9 100755
--- a/Tests/Command/DisconnectCommandTest.php
+++ b/Tests/Command/DisconnectCommandTest.php
@@ -30,9 +30,7 @@
*/
final class DisconnectCommandTest extends TestCase
{
- /** @var CentrifugoInterface|MockObject */
private CentrifugoInterface|MockObject $centrifugo;
-
private Command $command;
private Application $application;
private CommandTester $commandTester;
@@ -63,7 +61,7 @@ protected function tearDown(): void
public function successfulExecutionWithRequiredParameters(): void
{
$this->centrifugo
- ->expects(self::once())
+ ->expects($this->once())
->method('disconnect')
->with('user123')
;
@@ -72,21 +70,21 @@ public function successfulExecutionWithRequiredParameters(): void
[
'command' => $this->command->getName(),
'user' => 'user123',
- ]
+ ],
);
- self::assertSame(0, $result);
+ $this->assertSame(0, $result);
$output = $this->commandTester->getDisplay();
- self::assertStringContainsString('DONE', $output);
+ $this->assertStringContainsString('DONE', $output);
}
#[Test]
public function successfulExecutionWithAllParameters(): void
{
$this->centrifugo
- ->expects(self::once())
+ ->expects($this->once())
->method('disconnect')
- ->with('user123', ['clientID1'], 'clientID2', 'sessionID', self::isInstanceOf(Disconnect::class))
+ ->with('user123', ['clientID1'], 'clientID2', 'sessionID', $this->isInstanceOf(Disconnect::class))
;
$result = $this->commandTester->execute(
@@ -98,19 +96,19 @@ public function successfulExecutionWithAllParameters(): void
'--session' => 'sessionID',
'--disconnectCode' => 999,
'--disconnectReason' => 'some reason',
- ]
+ ],
);
- self::assertSame(0, $result);
+ $this->assertSame(0, $result);
$output = $this->commandTester->getDisplay();
- self::assertStringContainsString('DONE', $output);
+ $this->assertStringContainsString('DONE', $output);
}
#[Test]
public function exceptionForMissingDisconnectCode(): void
{
$this->centrifugo
- ->expects(self::never())
+ ->expects($this->never())
->method('disconnect')
;
@@ -125,19 +123,19 @@ public function exceptionForMissingDisconnectCode(): void
'--client' => 'clientID2',
'--session' => 'sessionID',
'--disconnectReason' => 'some reason',
- ]
+ ],
);
- self::assertSame(0, $result);
+ $this->assertSame(0, $result);
$output = $this->commandTester->getDisplay();
- self::assertStringContainsString('DONE', $output);
+ $this->assertStringContainsString('DONE', $output);
}
#[Test]
public function exceptionForMissingDisconnectReason(): void
{
$this->centrifugo
- ->expects(self::never())
+ ->expects($this->never())
->method('disconnect')
;
@@ -152,19 +150,19 @@ public function exceptionForMissingDisconnectReason(): void
'--client' => 'clientID2',
'--session' => 'sessionID',
'--disconnectCode' => 999,
- ]
+ ],
);
- self::assertSame(0, $result);
+ $this->assertSame(0, $result);
$output = $this->commandTester->getDisplay();
- self::assertStringContainsString('DONE', $output);
+ $this->assertStringContainsString('DONE', $output);
}
#[Test]
public function exception(): void
{
$this->centrifugo
- ->expects(self::once())
+ ->expects($this->once())
->method('disconnect')
->willThrowException(new \Exception('test'))
;
@@ -173,11 +171,11 @@ public function exception(): void
[
'command' => $this->command->getName(),
'user' => 'user123',
- ]
+ ],
);
- self::assertSame(1, $result);
+ $this->assertSame(1, $result);
$output = $this->commandTester->getDisplay();
- self::assertStringContainsString('test', $output);
+ $this->assertStringContainsString('test', $output);
}
}
diff --git a/Tests/Command/HistoryCommandTest.php b/Tests/Command/HistoryCommandTest.php
index 0b1acea..be90d9e 100755
--- a/Tests/Command/HistoryCommandTest.php
+++ b/Tests/Command/HistoryCommandTest.php
@@ -30,12 +30,8 @@
*/
final class HistoryCommandTest extends TestCase
{
- /** @var CentrifugoInterface|MockObject */
private CentrifugoInterface|MockObject $centrifugo;
-
- /** @var CentrifugoChecker|MockObject */
private CentrifugoChecker|MockObject $centrifugoChecker;
-
private Command $command;
private Application $application;
private CommandTester $commandTester;
@@ -68,7 +64,7 @@ protected function tearDown(): void
public function successfulExecutionWithRequiredParameters(): void
{
$this->centrifugo
- ->expects(self::once())
+ ->expects($this->once())
->method('history')
->with('channelA')
->willReturn(
@@ -82,7 +78,7 @@ public function successfulExecutionWithRequiredParameters(): void
],
'offset' => 0,
'epoch' => 'test',
- ]
+ ],
)
;
@@ -90,31 +86,31 @@ public function successfulExecutionWithRequiredParameters(): void
[
'command' => $this->command->getName(),
'channel' => 'channelA',
- ]
+ ],
);
- self::assertSame(0, $result);
+ $this->assertSame(0, $result);
$output = $this->commandTester->getDisplay();
- self::assertStringContainsString('Publications', $output);
- self::assertStringContainsString(
+ $this->assertStringContainsString('Publications', $output);
+ $this->assertStringContainsString(
<<<'JSON'
{
"foo": "bar"
}
JSON,
- $output
+ $output,
);
- self::assertStringContainsString('Offset: 0', $output);
- self::assertStringContainsString('Epoch: test', $output);
+ $this->assertStringContainsString('Offset: 0', $output);
+ $this->assertStringContainsString('Epoch: test', $output);
}
#[Test]
public function successfulExecutionWithAllParameters(): void
{
$this->centrifugo
- ->expects(self::once())
+ ->expects($this->once())
->method('history')
- ->with('channelA', true, 10, self::isInstanceOf(StreamPosition::class))
+ ->with('channelA', true, 10, $this->isInstanceOf(StreamPosition::class))
->willReturn(
[
'publications' => [
@@ -126,7 +122,7 @@ public function successfulExecutionWithAllParameters(): void
],
'offset' => 0,
'epoch' => 'test',
- ]
+ ],
)
;
@@ -138,29 +134,29 @@ public function successfulExecutionWithAllParameters(): void
'--offset' => 5,
'--epoch' => 'test',
'--reverse' => true,
- ]
+ ],
);
- self::assertSame(0, $result);
+ $this->assertSame(0, $result);
$output = $this->commandTester->getDisplay();
- self::assertStringContainsString('Publications', $output);
- self::assertStringContainsString(
+ $this->assertStringContainsString('Publications', $output);
+ $this->assertStringContainsString(
<<<'JSON'
{
"foo": "bar"
}
JSON,
- $output
+ $output,
);
- self::assertStringContainsString('Offset: 0', $output);
- self::assertStringContainsString('Epoch: test', $output);
+ $this->assertStringContainsString('Offset: 0', $output);
+ $this->assertStringContainsString('Epoch: test', $output);
}
#[Test]
public function exception(): void
{
$this->centrifugo
- ->expects(self::once())
+ ->expects($this->once())
->method('history')
->willThrowException(new \Exception('test'))
;
@@ -169,11 +165,11 @@ public function exception(): void
[
'command' => $this->command->getName(),
'channel' => 'channelA',
- ]
+ ],
);
- self::assertSame(1, $result);
+ $this->assertSame(1, $result);
$output = $this->commandTester->getDisplay();
- self::assertStringContainsString('test', $output);
+ $this->assertStringContainsString('test', $output);
}
}
diff --git a/Tests/Command/HistoryRemoveCommandTest.php b/Tests/Command/HistoryRemoveCommandTest.php
index 004302d..2b155ef 100755
--- a/Tests/Command/HistoryRemoveCommandTest.php
+++ b/Tests/Command/HistoryRemoveCommandTest.php
@@ -29,12 +29,8 @@
*/
final class HistoryRemoveCommandTest extends TestCase
{
- /** @var CentrifugoInterface|MockObject */
private CentrifugoInterface|MockObject $centrifugo;
-
- /** @var CentrifugoChecker|MockObject */
private CentrifugoChecker|MockObject $centrifugoChecker;
-
private Command $command;
private Application $application;
private CommandTester $commandTester;
@@ -67,7 +63,7 @@ protected function tearDown(): void
public function successfulExecution(): void
{
$this->centrifugo
- ->expects(self::once())
+ ->expects($this->once())
->method('historyRemove')
->with('channelA')
;
@@ -76,19 +72,19 @@ public function successfulExecution(): void
[
'command' => $this->command->getName(),
'channel' => 'channelA',
- ]
+ ],
);
- self::assertSame(0, $result);
+ $this->assertSame(0, $result);
$output = $this->commandTester->getDisplay();
- self::assertStringContainsString('DONE', $output);
+ $this->assertStringContainsString('DONE', $output);
}
#[Test]
public function exception(): void
{
$this->centrifugo
- ->expects(self::once())
+ ->expects($this->once())
->method('historyRemove')
->willThrowException(new \Exception('test'))
;
@@ -97,11 +93,11 @@ public function exception(): void
[
'command' => $this->command->getName(),
'channel' => 'channelA',
- ]
+ ],
);
- self::assertSame(1, $result);
+ $this->assertSame(1, $result);
$output = $this->commandTester->getDisplay();
- self::assertStringContainsString('test', $output);
+ $this->assertStringContainsString('test', $output);
}
}
diff --git a/Tests/Command/InfoCommandTest.php b/Tests/Command/InfoCommandTest.php
index 084e84c..c6927d4 100755
--- a/Tests/Command/InfoCommandTest.php
+++ b/Tests/Command/InfoCommandTest.php
@@ -28,9 +28,7 @@
*/
final class InfoCommandTest extends TestCase
{
- /** @var CentrifugoInterface|MockObject */
private CentrifugoInterface|MockObject $centrifugo;
-
private Command $command;
private Application $application;
private CommandTester $commandTester;
@@ -61,7 +59,7 @@ protected function tearDown(): void
public function successfulExecution(): void
{
$this->centrifugo
- ->expects(self::once())
+ ->expects($this->once())
->method('info')
->willReturn(
[
@@ -76,59 +74,59 @@ public function successfulExecution(): void
],
],
],
- ]
+ ],
)
;
$result = $this->commandTester->execute(['command' => $this->command->getName()]);
- self::assertSame(0, $result);
+ $this->assertSame(0, $result);
$output = $this->commandTester->getDisplay();
- self::assertStringContainsString('Info', $output);
- self::assertStringContainsString('Node Test', $output);
- self::assertStringContainsString('metrics', $output);
- self::assertStringContainsString(' ├ interval: 60', $output);
- self::assertStringContainsString(' └ items', $output);
- self::assertStringContainsString(' └ process.virtual.memory_max_bytes: -1', $output);
+ $this->assertStringContainsString('Info', $output);
+ $this->assertStringContainsString('Node Test', $output);
+ $this->assertStringContainsString('metrics', $output);
+ $this->assertStringContainsString(' ├ interval: 60', $output);
+ $this->assertStringContainsString(' └ items', $output);
+ $this->assertStringContainsString(' └ process.virtual.memory_max_bytes: -1', $output);
}
#[Test]
public function noData(): void
{
$this->centrifugo
- ->expects(self::once())
+ ->expects($this->once())
->method('info')
->willReturn(['nodes' => []])
;
$result = $this->commandTester->execute(['command' => $this->command->getName()]);
- self::assertSame(0, $result);
+ $this->assertSame(0, $result);
$output = $this->commandTester->getDisplay();
- self::assertStringContainsString('NO DATA', $output);
+ $this->assertStringContainsString('NO DATA', $output);
}
#[Test]
public function exception(): void
{
$this->centrifugo
- ->expects(self::once())
+ ->expects($this->once())
->method('info')
->willThrowException(new \Exception('test'))
;
$result = $this->commandTester->execute(['command' => $this->command->getName()]);
- self::assertSame(1, $result);
+ $this->assertSame(1, $result);
$output = $this->commandTester->getDisplay();
- self::assertStringContainsString('test', $output);
+ $this->assertStringContainsString('test', $output);
}
#[Test]
public function unexpectedValueException(): void
{
$this->centrifugo
- ->expects(self::once())
+ ->expects($this->once())
->method('info')
->willReturn(
[
@@ -138,14 +136,14 @@ public function unexpectedValueException(): void
'bar' => new \stdClass(),
],
],
- ]
+ ],
)
;
$result = $this->commandTester->execute(['command' => $this->command->getName()]);
- self::assertSame(1, $result);
+ $this->assertSame(1, $result);
$output = $this->commandTester->getDisplay();
- self::assertStringContainsString('Value is not an array, nor a string', $output);
+ $this->assertStringContainsString('Value is not an array, nor a string', $output);
}
}
diff --git a/Tests/Command/Option/OptionBase64DataTraitTest.php b/Tests/Command/Option/OptionBase64DataTraitTest.php
index 4e0a347..82a5be7 100755
--- a/Tests/Command/Option/OptionBase64DataTraitTest.php
+++ b/Tests/Command/Option/OptionBase64DataTraitTest.php
@@ -30,12 +30,8 @@
*/
final class OptionBase64DataTraitTest extends TestCase
{
- /** @var CentrifugoInterface|MockObject */
private CentrifugoInterface|MockObject $centrifugo;
-
- /** @var CentrifugoChecker|MockObject */
private CentrifugoChecker|MockObject $centrifugoChecker;
-
private Command $command;
private Application $application;
private CommandTester $commandTester;
@@ -68,7 +64,7 @@ protected function tearDown(): void
public function optionIsNotValidBase64(): void
{
$this->centrifugo
- ->expects(self::never())
+ ->expects($this->never())
->method('publish')
;
@@ -89,7 +85,7 @@ public function optionIsNotValidBase64(): void
public function validOption(): void
{
$this->centrifugo
- ->expects(self::once())
+ ->expects($this->once())
->method('publish')
;
diff --git a/Tests/Command/Option/OptionBase64InfoTraitTest.php b/Tests/Command/Option/OptionBase64InfoTraitTest.php
index 53f004e..9f0f898 100755
--- a/Tests/Command/Option/OptionBase64InfoTraitTest.php
+++ b/Tests/Command/Option/OptionBase64InfoTraitTest.php
@@ -30,12 +30,8 @@
*/
final class OptionBase64InfoTraitTest extends TestCase
{
- /** @var CentrifugoInterface|MockObject */
private CentrifugoInterface|MockObject $centrifugo;
-
- /** @var CentrifugoChecker|MockObject */
private CentrifugoChecker|MockObject $centrifugoChecker;
-
private Command $command;
private Application $application;
private CommandTester $commandTester;
@@ -68,7 +64,7 @@ protected function tearDown(): void
public function optionIsNotValidBase64(): void
{
$this->centrifugo
- ->expects(self::never())
+ ->expects($this->never())
->method('subscribe')
;
@@ -81,7 +77,7 @@ public function optionIsNotValidBase64(): void
'user' => 'user123',
'channel' => 'channelName',
'--base64info' => 'SGVsbG8gd29ybGQ=bla',
- ]
+ ],
);
}
@@ -89,7 +85,7 @@ public function optionIsNotValidBase64(): void
public function validOption(): void
{
$this->centrifugo
- ->expects(self::once())
+ ->expects($this->once())
->method('subscribe')
;
@@ -99,7 +95,7 @@ public function validOption(): void
'user' => 'user123',
'channel' => 'channelName',
'--base64info' => 'SGVsbG8gd29ybGQ=',
- ]
+ ],
);
}
}
diff --git a/Tests/Command/Option/OptionDataTraitTest.php b/Tests/Command/Option/OptionDataTraitTest.php
index 2207396..749289c 100755
--- a/Tests/Command/Option/OptionDataTraitTest.php
+++ b/Tests/Command/Option/OptionDataTraitTest.php
@@ -30,12 +30,8 @@
*/
final class OptionDataTraitTest extends TestCase
{
- /** @var CentrifugoInterface|MockObject */
private CentrifugoInterface|MockObject $centrifugo;
-
- /** @var CentrifugoChecker|MockObject */
private CentrifugoChecker|MockObject $centrifugoChecker;
-
private Command $command;
private Application $application;
private CommandTester $commandTester;
@@ -68,7 +64,7 @@ protected function tearDown(): void
public function dataIsNotValidJson(): void
{
$this->centrifugo
- ->expects(self::never())
+ ->expects($this->never())
->method('subscribe')
;
@@ -89,7 +85,7 @@ public function dataIsNotValidJson(): void
public function validOption(): void
{
$this->centrifugo
- ->expects(self::once())
+ ->expects($this->once())
->method('subscribe')
;
diff --git a/Tests/Command/Option/OptionDisconnectCodeTraitTest.php b/Tests/Command/Option/OptionDisconnectCodeTraitTest.php
index 7c5c202..eb382fa 100755
--- a/Tests/Command/Option/OptionDisconnectCodeTraitTest.php
+++ b/Tests/Command/Option/OptionDisconnectCodeTraitTest.php
@@ -29,9 +29,7 @@
*/
final class OptionDisconnectCodeTraitTest extends TestCase
{
- /** @var CentrifugoInterface|MockObject */
private CentrifugoInterface|MockObject $centrifugo;
-
private Command $command;
private Application $application;
private CommandTester $commandTester;
@@ -62,7 +60,7 @@ protected function tearDown(): void
public function validOption(): void
{
$this->centrifugo
- ->expects(self::once())
+ ->expects($this->once())
->method('disconnect')
;
@@ -80,7 +78,7 @@ public function validOption(): void
public function invalidOption(): void
{
$this->centrifugo
- ->expects(self::never())
+ ->expects($this->never())
->method('disconnect')
;
diff --git a/Tests/Command/Option/OptionDisconnectReasonTraitTest.php b/Tests/Command/Option/OptionDisconnectReasonTraitTest.php
index 1acfe04..059b1bb 100755
--- a/Tests/Command/Option/OptionDisconnectReasonTraitTest.php
+++ b/Tests/Command/Option/OptionDisconnectReasonTraitTest.php
@@ -28,9 +28,7 @@
*/
final class OptionDisconnectReasonTraitTest extends TestCase
{
- /** @var CentrifugoInterface|MockObject */
private CentrifugoInterface|MockObject $centrifugo;
-
private Command $command;
private Application $application;
private CommandTester $commandTester;
@@ -61,7 +59,7 @@ protected function tearDown(): void
public function validOption(): void
{
$this->centrifugo
- ->expects(self::once())
+ ->expects($this->once())
->method('disconnect')
;
@@ -71,7 +69,7 @@ public function validOption(): void
'user' => 'user123',
'--disconnectReason' => 'some reason',
'--disconnectCode' => 999,
- ]
+ ],
);
}
}
diff --git a/Tests/Command/Option/OptionEpochTraitTest.php b/Tests/Command/Option/OptionEpochTraitTest.php
index cedd998..b5e5bca 100755
--- a/Tests/Command/Option/OptionEpochTraitTest.php
+++ b/Tests/Command/Option/OptionEpochTraitTest.php
@@ -29,12 +29,8 @@
*/
final class OptionEpochTraitTest extends TestCase
{
- /** @var CentrifugoInterface|MockObject */
private CentrifugoInterface|MockObject $centrifugo;
-
- /** @var CentrifugoChecker|MockObject */
private CentrifugoChecker|MockObject $centrifugoChecker;
-
private Command $command;
private Application $application;
private CommandTester $commandTester;
@@ -67,7 +63,7 @@ protected function tearDown(): void
public function validOption(): void
{
$this->centrifugo
- ->expects(self::once())
+ ->expects($this->once())
->method('history')
;
@@ -76,7 +72,7 @@ public function validOption(): void
'command' => $this->command->getName(),
'channel' => 'channelName',
'--epoch' => 'ABCD',
- ]
+ ],
);
}
}
diff --git a/Tests/Command/Option/OptionExpireAtTraitTest.php b/Tests/Command/Option/OptionExpireAtTraitTest.php
index 1115089..bd56404 100755
--- a/Tests/Command/Option/OptionExpireAtTraitTest.php
+++ b/Tests/Command/Option/OptionExpireAtTraitTest.php
@@ -29,9 +29,7 @@
*/
final class OptionExpireAtTraitTest extends TestCase
{
- /** @var CentrifugoInterface|MockObject */
private CentrifugoInterface|MockObject $centrifugo;
-
private Command $command;
private Application $application;
private CommandTester $commandTester;
@@ -62,7 +60,7 @@ protected function tearDown(): void
public function validOption(): void
{
$this->centrifugo
- ->expects(self::once())
+ ->expects($this->once())
->method('refresh')
;
@@ -71,7 +69,7 @@ public function validOption(): void
'command' => $this->command->getName(),
'user' => 'user123',
'--expireAt' => 1234567890,
- ]
+ ],
);
}
@@ -79,7 +77,7 @@ public function validOption(): void
public function zeroValue(): void
{
$this->centrifugo
- ->expects(self::never())
+ ->expects($this->never())
->method('refresh')
;
@@ -91,7 +89,7 @@ public function zeroValue(): void
'command' => $this->command->getName(),
'user' => 'user123',
'--expireAt' => 0,
- ]
+ ],
);
}
@@ -99,7 +97,7 @@ public function zeroValue(): void
public function nonStringValue(): void
{
$this->centrifugo
- ->expects(self::never())
+ ->expects($this->never())
->method('refresh')
;
@@ -111,7 +109,7 @@ public function nonStringValue(): void
'command' => $this->command->getName(),
'user' => 'user123',
'--expireAt' => 'abcd',
- ]
+ ],
);
}
}
diff --git a/Tests/Command/Option/OptionExpiredTraitTest.php b/Tests/Command/Option/OptionExpiredTraitTest.php
index 7f3c810..4d375d7 100755
--- a/Tests/Command/Option/OptionExpiredTraitTest.php
+++ b/Tests/Command/Option/OptionExpiredTraitTest.php
@@ -28,9 +28,7 @@
*/
final class OptionExpiredTraitTest extends TestCase
{
- /** @var CentrifugoInterface|MockObject */
private CentrifugoInterface|MockObject $centrifugo;
-
private Command $command;
private Application $application;
private CommandTester $commandTester;
@@ -61,7 +59,7 @@ protected function tearDown(): void
public function validOption(): void
{
$this->centrifugo
- ->expects(self::once())
+ ->expects($this->once())
->method('refresh')
;
diff --git a/Tests/Command/Option/OptionInfoTraitTest.php b/Tests/Command/Option/OptionInfoTraitTest.php
index eb7c39c..f163802 100755
--- a/Tests/Command/Option/OptionInfoTraitTest.php
+++ b/Tests/Command/Option/OptionInfoTraitTest.php
@@ -30,12 +30,8 @@
*/
final class OptionInfoTraitTest extends TestCase
{
- /** @var CentrifugoInterface|MockObject */
private CentrifugoInterface|MockObject $centrifugo;
-
- /** @var CentrifugoChecker|MockObject */
private CentrifugoChecker|MockObject $centrifugoChecker;
-
private Command $command;
private Application $application;
private CommandTester $commandTester;
@@ -68,7 +64,7 @@ protected function tearDown(): void
public function dataIsNotValidJson(): void
{
$this->centrifugo
- ->expects(self::never())
+ ->expects($this->never())
->method('subscribe')
;
@@ -81,7 +77,7 @@ public function dataIsNotValidJson(): void
'user' => 'user123',
'channel' => 'channelName',
'--info' => 'invalid json',
- ]
+ ],
);
}
@@ -89,7 +85,7 @@ public function dataIsNotValidJson(): void
public function validOption(): void
{
$this->centrifugo
- ->expects(self::once())
+ ->expects($this->once())
->method('subscribe')
;
@@ -99,7 +95,7 @@ public function validOption(): void
'user' => 'user123',
'channel' => 'channelName',
'--info' => '{"foo":"bar"}',
- ]
+ ],
);
}
}
diff --git a/Tests/Command/Option/OptionLimitTraitTest.php b/Tests/Command/Option/OptionLimitTraitTest.php
index 12070ee..1f29692 100755
--- a/Tests/Command/Option/OptionLimitTraitTest.php
+++ b/Tests/Command/Option/OptionLimitTraitTest.php
@@ -30,12 +30,8 @@
*/
final class OptionLimitTraitTest extends TestCase
{
- /** @var CentrifugoInterface|MockObject */
private CentrifugoInterface|MockObject $centrifugo;
-
- /** @var CentrifugoChecker|MockObject */
private CentrifugoChecker|MockObject $centrifugoChecker;
-
private Command $command;
private Application $application;
private CommandTester $commandTester;
@@ -68,7 +64,7 @@ protected function tearDown(): void
public function validOption(): void
{
$this->centrifugo
- ->expects(self::once())
+ ->expects($this->once())
->method('history')
;
@@ -77,7 +73,7 @@ public function validOption(): void
'command' => $this->command->getName(),
'channel' => 'channelName',
'--limit' => 20,
- ]
+ ],
);
}
@@ -85,7 +81,7 @@ public function validOption(): void
public function zeroValue(): void
{
$this->centrifugo
- ->expects(self::never())
+ ->expects($this->never())
->method('history')
;
@@ -97,7 +93,7 @@ public function zeroValue(): void
'command' => $this->command->getName(),
'channel' => 'channelName',
'--limit' => 0,
- ]
+ ],
);
}
@@ -105,7 +101,7 @@ public function zeroValue(): void
public function nonStringValue(): void
{
$this->centrifugo
- ->expects(self::never())
+ ->expects($this->never())
->method('history')
;
@@ -117,7 +113,7 @@ public function nonStringValue(): void
'command' => $this->command->getName(),
'channel' => 'channelName',
'--limit' => 'abcd',
- ]
+ ],
);
}
}
diff --git a/Tests/Command/Option/OptionOffsetTraitTest.php b/Tests/Command/Option/OptionOffsetTraitTest.php
index d7f7d09..bad76ad 100755
--- a/Tests/Command/Option/OptionOffsetTraitTest.php
+++ b/Tests/Command/Option/OptionOffsetTraitTest.php
@@ -30,12 +30,8 @@
*/
final class OptionOffsetTraitTest extends TestCase
{
- /** @var CentrifugoInterface|MockObject */
private CentrifugoInterface|MockObject $centrifugo;
-
- /** @var CentrifugoChecker|MockObject */
private CentrifugoChecker|MockObject $centrifugoChecker;
-
private Command $command;
private Application $application;
private CommandTester $commandTester;
@@ -68,7 +64,7 @@ protected function tearDown(): void
public function validOption(): void
{
$this->centrifugo
- ->expects(self::once())
+ ->expects($this->once())
->method('history')
;
@@ -77,7 +73,7 @@ public function validOption(): void
'command' => $this->command->getName(),
'channel' => 'channelName',
'--offset' => 20,
- ]
+ ],
);
}
@@ -85,7 +81,7 @@ public function validOption(): void
public function zeroValue(): void
{
$this->centrifugo
- ->expects(self::never())
+ ->expects($this->never())
->method('history')
;
@@ -97,7 +93,7 @@ public function zeroValue(): void
'command' => $this->command->getName(),
'channel' => 'channelName',
'--offset' => 0,
- ]
+ ],
);
}
@@ -105,7 +101,7 @@ public function zeroValue(): void
public function nonStringValue(): void
{
$this->centrifugo
- ->expects(self::never())
+ ->expects($this->never())
->method('history')
;
@@ -117,7 +113,7 @@ public function nonStringValue(): void
'command' => $this->command->getName(),
'channel' => 'channelName',
'--offset' => 'abcd',
- ]
+ ],
);
}
}
diff --git a/Tests/Command/Option/OptionReverseTraitTest.php b/Tests/Command/Option/OptionReverseTraitTest.php
index 46ed0d6..d2b0b06 100755
--- a/Tests/Command/Option/OptionReverseTraitTest.php
+++ b/Tests/Command/Option/OptionReverseTraitTest.php
@@ -29,12 +29,8 @@
*/
final class OptionReverseTraitTest extends TestCase
{
- /** @var CentrifugoInterface|MockObject */
private CentrifugoInterface|MockObject $centrifugo;
-
- /** @var CentrifugoChecker|MockObject */
private CentrifugoChecker|MockObject $centrifugoChecker;
-
private Command $command;
private Application $application;
private CommandTester $commandTester;
@@ -67,7 +63,7 @@ protected function tearDown(): void
public function validOption(): void
{
$this->centrifugo
- ->expects(self::once())
+ ->expects($this->once())
->method('history')
;
@@ -76,7 +72,7 @@ public function validOption(): void
'command' => $this->command->getName(),
'channel' => 'channelName',
'--reverse' => true,
- ]
+ ],
);
}
}
diff --git a/Tests/Command/Option/OptionSkipHistoryTraitTest.php b/Tests/Command/Option/OptionSkipHistoryTraitTest.php
index 9c4c4a4..0a9f729 100755
--- a/Tests/Command/Option/OptionSkipHistoryTraitTest.php
+++ b/Tests/Command/Option/OptionSkipHistoryTraitTest.php
@@ -29,12 +29,8 @@
*/
final class OptionSkipHistoryTraitTest extends TestCase
{
- /** @var CentrifugoInterface|MockObject */
private CentrifugoInterface|MockObject $centrifugo;
-
- /** @var CentrifugoChecker|MockObject */
private CentrifugoChecker|MockObject $centrifugoChecker;
-
private Command $command;
private Application $application;
private CommandTester $commandTester;
@@ -67,7 +63,7 @@ protected function tearDown(): void
public function validOption(): void
{
$this->centrifugo
- ->expects(self::once())
+ ->expects($this->once())
->method('publish')
;
@@ -77,7 +73,7 @@ public function validOption(): void
'data' => '{"foo":"bar"}',
'channel' => 'channelName',
'--skipHistory' => true,
- ]
+ ],
);
}
}
diff --git a/Tests/Command/Option/OptionTagsTraitTest.php b/Tests/Command/Option/OptionTagsTraitTest.php
index 894fedf..16cf4f2 100755
--- a/Tests/Command/Option/OptionTagsTraitTest.php
+++ b/Tests/Command/Option/OptionTagsTraitTest.php
@@ -30,12 +30,8 @@
*/
final class OptionTagsTraitTest extends TestCase
{
- /** @var CentrifugoInterface|MockObject */
private CentrifugoInterface|MockObject $centrifugo;
-
- /** @var CentrifugoChecker|MockObject */
private CentrifugoChecker|MockObject $centrifugoChecker;
-
private Command $command;
private Application $application;
private CommandTester $commandTester;
@@ -68,7 +64,7 @@ protected function tearDown(): void
public function tagsIsNotValidJson(): void
{
$this->centrifugo
- ->expects(self::never())
+ ->expects($this->never())
->method('publish')
;
@@ -81,7 +77,7 @@ public function tagsIsNotValidJson(): void
'data' => '{"foo":"bar"}',
'channel' => 'channelName',
'--tags' => 'invalid json',
- ]
+ ],
);
}
@@ -89,7 +85,7 @@ public function tagsIsNotValidJson(): void
public function tagsIsNotArray(): void
{
$this->centrifugo
- ->expects(self::never())
+ ->expects($this->never())
->method('publish')
;
@@ -102,7 +98,7 @@ public function tagsIsNotArray(): void
'data' => '{"foo":"bar"}',
'channel' => 'channelName',
'--tags' => 'true',
- ]
+ ],
);
}
@@ -110,7 +106,7 @@ public function tagsIsNotArray(): void
public function tagValueIsNotString(): void
{
$this->centrifugo
- ->expects(self::never())
+ ->expects($this->never())
->method('publish')
;
@@ -123,7 +119,7 @@ public function tagValueIsNotString(): void
'data' => '{"foo":"bar"}',
'channel' => 'channelName',
'--tags' => '{"foo":123}',
- ]
+ ],
);
}
@@ -131,7 +127,7 @@ public function tagValueIsNotString(): void
public function validTags(): void
{
$this->centrifugo
- ->expects(self::once())
+ ->expects($this->once())
->method('publish')
;
@@ -141,7 +137,7 @@ public function validTags(): void
'data' => '{"foo":"bar"}',
'channel' => 'channelName',
'--tags' => '{"env":"test"}',
- ]
+ ],
);
}
}
diff --git a/Tests/Command/PresenceCommandTest.php b/Tests/Command/PresenceCommandTest.php
index 3ddbc86..f7f1d63 100755
--- a/Tests/Command/PresenceCommandTest.php
+++ b/Tests/Command/PresenceCommandTest.php
@@ -29,12 +29,8 @@
*/
final class PresenceCommandTest extends TestCase
{
- /** @var CentrifugoInterface|MockObject */
private CentrifugoInterface|MockObject $centrifugo;
-
- /** @var CentrifugoChecker|MockObject */
private CentrifugoChecker|MockObject $centrifugoChecker;
-
private Command $command;
private Application $application;
private CommandTester $commandTester;
@@ -67,7 +63,7 @@ protected function tearDown(): void
public function successfulExecution(): void
{
$this->centrifugo
- ->expects(self::once())
+ ->expects($this->once())
->method('presence')
->with('channelA')
->willReturn(
@@ -84,7 +80,7 @@ public function successfulExecution(): void
],
],
],
- ]
+ ],
)
;
@@ -92,24 +88,24 @@ public function successfulExecution(): void
[
'command' => $this->command->getName(),
'channel' => 'channelA',
- ]
+ ],
);
- self::assertSame(0, $result);
+ $this->assertSame(0, $result);
$output = $this->commandTester->getDisplay();
- self::assertStringContainsString('Presence', $output);
- self::assertStringContainsString('client: c54313b2-0442-499a-a70c-051f8588020f', $output);
- self::assertStringContainsString('user: 42', $output);
- self::assertStringContainsString('conn_info', $output);
- self::assertStringContainsString('chan_info', $output);
- self::assertStringContainsString('"username": "user1@test.com"', $output);
+ $this->assertStringContainsString('Presence', $output);
+ $this->assertStringContainsString('client: c54313b2-0442-499a-a70c-051f8588020f', $output);
+ $this->assertStringContainsString('user: 42', $output);
+ $this->assertStringContainsString('conn_info', $output);
+ $this->assertStringContainsString('chan_info', $output);
+ $this->assertStringContainsString('"username": "user1@test.com"', $output);
}
#[Test]
public function noData(): void
{
$this->centrifugo
- ->expects(self::once())
+ ->expects($this->once())
->method('presence')
->with('channelA')
->willReturn(['presence' => []])
@@ -119,19 +115,19 @@ public function noData(): void
[
'command' => $this->command->getName(),
'channel' => 'channelA',
- ]
+ ],
);
- self::assertSame(0, $result);
+ $this->assertSame(0, $result);
$output = $this->commandTester->getDisplay();
- self::assertStringContainsString('NO DATA', $output);
+ $this->assertStringContainsString('NO DATA', $output);
}
#[Test]
public function exception(): void
{
$this->centrifugo
- ->expects(self::once())
+ ->expects($this->once())
->method('presence')
->willThrowException(new \Exception('test'))
;
@@ -140,11 +136,11 @@ public function exception(): void
[
'command' => $this->command->getName(),
'channel' => 'channelA',
- ]
+ ],
);
- self::assertSame(1, $result);
+ $this->assertSame(1, $result);
$output = $this->commandTester->getDisplay();
- self::assertStringContainsString('test', $output);
+ $this->assertStringContainsString('test', $output);
}
}
diff --git a/Tests/Command/PresenceStatsCommandTest.php b/Tests/Command/PresenceStatsCommandTest.php
index 9c108e8..a070142 100755
--- a/Tests/Command/PresenceStatsCommandTest.php
+++ b/Tests/Command/PresenceStatsCommandTest.php
@@ -29,12 +29,8 @@
*/
final class PresenceStatsCommandTest extends TestCase
{
- /** @var CentrifugoInterface|MockObject */
private CentrifugoInterface|MockObject $centrifugo;
-
- /** @var CentrifugoChecker|MockObject */
private CentrifugoChecker|MockObject $centrifugoChecker;
-
private Command $command;
private Application $application;
private CommandTester $commandTester;
@@ -67,14 +63,14 @@ protected function tearDown(): void
public function successfulExecution(): void
{
$this->centrifugo
- ->expects(self::once())
+ ->expects($this->once())
->method('presenceStats')
->with('channelA')
->willReturn(
[
'num_clients' => 2,
'num_users' => 1,
- ]
+ ],
)
;
@@ -82,21 +78,21 @@ public function successfulExecution(): void
[
'command' => $this->command->getName(),
'channel' => 'channelA',
- ]
+ ],
);
- self::assertSame(0, $result);
+ $this->assertSame(0, $result);
$output = $this->commandTester->getDisplay();
- self::assertStringContainsString('Presence Stats', $output);
- self::assertStringContainsString('Total number of clients in channel: 2', $output);
- self::assertStringContainsString('Total number of unique users in channel: 1', $output);
+ $this->assertStringContainsString('Presence Stats', $output);
+ $this->assertStringContainsString('Total number of clients in channel: 2', $output);
+ $this->assertStringContainsString('Total number of unique users in channel: 1', $output);
}
#[Test]
public function exception(): void
{
$this->centrifugo
- ->expects(self::once())
+ ->expects($this->once())
->method('presenceStats')
->willThrowException(new \Exception('test'))
;
@@ -105,11 +101,11 @@ public function exception(): void
[
'command' => $this->command->getName(),
'channel' => 'channelA',
- ]
+ ],
);
- self::assertSame(1, $result);
+ $this->assertSame(1, $result);
$output = $this->commandTester->getDisplay();
- self::assertStringContainsString('test', $output);
+ $this->assertStringContainsString('test', $output);
}
}
diff --git a/Tests/Command/PublishCommandTest.php b/Tests/Command/PublishCommandTest.php
index 4d4215b..5187bcd 100755
--- a/Tests/Command/PublishCommandTest.php
+++ b/Tests/Command/PublishCommandTest.php
@@ -29,12 +29,8 @@
*/
final class PublishCommandTest extends TestCase
{
- /** @var CentrifugoInterface|MockObject */
private CentrifugoInterface|MockObject $centrifugo;
-
- /** @var CentrifugoChecker|MockObject */
private CentrifugoChecker|MockObject $centrifugoChecker;
-
private Command $command;
private Application $application;
private CommandTester $commandTester;
@@ -67,7 +63,7 @@ protected function tearDown(): void
public function successfulExecutionWithRequiredParameters(): void
{
$this->centrifugo
- ->expects(self::once())
+ ->expects($this->once())
->method('publish')
->with(['foo' => 'bar'], 'channelA')
;
@@ -77,19 +73,19 @@ public function successfulExecutionWithRequiredParameters(): void
'command' => $this->command->getName(),
'data' => '{"foo":"bar"}',
'channel' => 'channelA',
- ]
+ ],
);
- self::assertSame(0, $result);
+ $this->assertSame(0, $result);
$output = $this->commandTester->getDisplay();
- self::assertStringContainsString('DONE', $output);
+ $this->assertStringContainsString('DONE', $output);
}
#[Test]
public function successfulExecutionWithAllParameters(): void
{
$this->centrifugo
- ->expects(self::once())
+ ->expects($this->once())
->method('publish')
->with(['foo' => 'bar'], 'channelA', true, ['env' => 'test'], 'SGVsbG8gd29ybGQ=')
;
@@ -104,17 +100,17 @@ public function successfulExecutionWithAllParameters(): void
'--base64data' => 'SGVsbG8gd29ybGQ=',
],
);
- self::assertSame(0, $result);
+ $this->assertSame(0, $result);
$output = $this->commandTester->getDisplay();
- self::assertStringContainsString('DONE', $output);
+ $this->assertStringContainsString('DONE', $output);
}
#[Test]
public function exception(): void
{
$this->centrifugo
- ->expects(self::once())
+ ->expects($this->once())
->method('publish')
->willThrowException(new \Exception('test'))
;
@@ -124,11 +120,11 @@ public function exception(): void
'command' => $this->command->getName(),
'data' => '{"foo":"bar"}',
'channel' => 'channelA',
- ]
+ ],
);
- self::assertSame(1, $result);
+ $this->assertSame(1, $result);
$output = $this->commandTester->getDisplay();
- self::assertStringContainsString('test', $output);
+ $this->assertStringContainsString('test', $output);
}
}
diff --git a/Tests/Command/RefreshCommandTest.php b/Tests/Command/RefreshCommandTest.php
index 8d49601..9df2419 100755
--- a/Tests/Command/RefreshCommandTest.php
+++ b/Tests/Command/RefreshCommandTest.php
@@ -28,9 +28,7 @@
*/
final class RefreshCommandTest extends TestCase
{
- /** @var CentrifugoInterface|MockObject */
private CentrifugoInterface|MockObject $centrifugo;
-
private Command $command;
private Application $application;
private CommandTester $commandTester;
@@ -61,7 +59,7 @@ protected function tearDown(): void
public function successfulExecutionWithRequiredParameters(): void
{
$this->centrifugo
- ->expects(self::once())
+ ->expects($this->once())
->method('refresh')
->with('user123')
;
@@ -70,19 +68,19 @@ public function successfulExecutionWithRequiredParameters(): void
[
'command' => $this->command->getName(),
'user' => 'user123',
- ]
+ ],
);
- self::assertSame(0, $result);
+ $this->assertSame(0, $result);
$output = $this->commandTester->getDisplay();
- self::assertStringContainsString('DONE', $output);
+ $this->assertStringContainsString('DONE', $output);
}
#[Test]
public function successfulExecutionWithAllParameters(): void
{
$this->centrifugo
- ->expects(self::once())
+ ->expects($this->once())
->method('refresh')
->with('user123', 'clientID', 'sessionID', true, 1234567890)
;
@@ -95,19 +93,19 @@ public function successfulExecutionWithAllParameters(): void
'--session' => 'sessionID',
'--expired' => true,
'--expireAt' => 1234567890,
- ]
+ ],
);
- self::assertSame(0, $result);
+ $this->assertSame(0, $result);
$output = $this->commandTester->getDisplay();
- self::assertStringContainsString('DONE', $output);
+ $this->assertStringContainsString('DONE', $output);
}
#[Test]
public function exception(): void
{
$this->centrifugo
- ->expects(self::once())
+ ->expects($this->once())
->method('refresh')
->willThrowException(new \Exception('test'))
;
@@ -116,11 +114,11 @@ public function exception(): void
[
'command' => $this->command->getName(),
'user' => 'user123',
- ]
+ ],
);
- self::assertSame(1, $result);
+ $this->assertSame(1, $result);
$output = $this->commandTester->getDisplay();
- self::assertStringContainsString('test', $output);
+ $this->assertStringContainsString('test', $output);
}
}
diff --git a/Tests/Command/SubscribeCommandTest.php b/Tests/Command/SubscribeCommandTest.php
index d8d58ac..4e25ae5 100755
--- a/Tests/Command/SubscribeCommandTest.php
+++ b/Tests/Command/SubscribeCommandTest.php
@@ -30,12 +30,8 @@
*/
final class SubscribeCommandTest extends TestCase
{
- /** @var CentrifugoInterface|MockObject */
private CentrifugoInterface|MockObject $centrifugo;
-
- /** @var CentrifugoChecker|MockObject */
private CentrifugoChecker|MockObject $centrifugoChecker;
-
private Command $command;
private Application $application;
private CommandTester $commandTester;
@@ -68,7 +64,7 @@ protected function tearDown(): void
public function successfulExecutionWithRequiredParameters(): void
{
$this->centrifugo
- ->expects(self::once())
+ ->expects($this->once())
->method('subscribe')
->with('user123', 'channelA')
;
@@ -78,21 +74,21 @@ public function successfulExecutionWithRequiredParameters(): void
'command' => $this->command->getName(),
'user' => 'user123',
'channel' => 'channelA',
- ]
+ ],
);
- self::assertSame(0, $result);
+ $this->assertSame(0, $result);
$output = $this->commandTester->getDisplay();
- self::assertStringContainsString('DONE', $output);
+ $this->assertStringContainsString('DONE', $output);
}
#[Test]
public function successfulExecutionWithAllParameters(): void
{
$this->centrifugo
- ->expects(self::once())
+ ->expects($this->once())
->method('subscribe')
- ->with('user123', 'channelA', ['foo1' => 'bar1'], 'SGVsbG8gd29ybGQ=', 'clientID', 'sessionID', ['foo2' => 'bar2'], 'QmxhIGJsYSBibGE=', self::isInstanceOf(StreamPosition::class))
+ ->with('user123', 'channelA', ['foo1' => 'bar1'], 'SGVsbG8gd29ybGQ=', 'clientID', 'sessionID', ['foo2' => 'bar2'], 'QmxhIGJsYSBibGE=', $this->isInstanceOf(StreamPosition::class))
;
$result = $this->commandTester->execute(
@@ -108,19 +104,19 @@ public function successfulExecutionWithAllParameters(): void
'--base64data' => 'QmxhIGJsYSBibGE=',
'--offset' => 5,
'--epoch' => 'test',
- ]
+ ],
);
- self::assertSame(0, $result);
+ $this->assertSame(0, $result);
$output = $this->commandTester->getDisplay();
- self::assertStringContainsString('DONE', $output);
+ $this->assertStringContainsString('DONE', $output);
}
#[Test]
public function exception(): void
{
$this->centrifugo
- ->expects(self::once())
+ ->expects($this->once())
->method('subscribe')
->willThrowException(new \Exception('test'))
;
@@ -130,11 +126,11 @@ public function exception(): void
'command' => $this->command->getName(),
'user' => 'user123',
'channel' => 'channelA',
- ]
+ ],
);
- self::assertSame(1, $result);
+ $this->assertSame(1, $result);
$output = $this->commandTester->getDisplay();
- self::assertStringContainsString('test', $output);
+ $this->assertStringContainsString('test', $output);
}
}
diff --git a/Tests/Command/UnsubscribeCommandTest.php b/Tests/Command/UnsubscribeCommandTest.php
index 6373a82..9694715 100755
--- a/Tests/Command/UnsubscribeCommandTest.php
+++ b/Tests/Command/UnsubscribeCommandTest.php
@@ -29,12 +29,8 @@
*/
final class UnsubscribeCommandTest extends TestCase
{
- /** @var CentrifugoInterface|MockObject */
private CentrifugoInterface|MockObject $centrifugo;
-
- /** @var CentrifugoChecker|MockObject */
private CentrifugoChecker|MockObject $centrifugoChecker;
-
private Command $command;
private Application $application;
private CommandTester $commandTester;
@@ -67,7 +63,7 @@ protected function tearDown(): void
public function successfulExecutionWithRequiredParameters(): void
{
$this->centrifugo
- ->expects(self::once())
+ ->expects($this->once())
->method('unsubscribe')
->with('user123', 'channelA')
;
@@ -77,19 +73,19 @@ public function successfulExecutionWithRequiredParameters(): void
'command' => $this->command->getName(),
'user' => 'user123',
'channel' => 'channelA',
- ]
+ ],
);
- self::assertSame(0, $result);
+ $this->assertSame(0, $result);
$output = $this->commandTester->getDisplay();
- self::assertStringContainsString('DONE', $output);
+ $this->assertStringContainsString('DONE', $output);
}
#[Test]
public function successfulExecutionWithAllParameters(): void
{
$this->centrifugo
- ->expects(self::once())
+ ->expects($this->once())
->method('unsubscribe')
->with('user123', 'channelA')
;
@@ -101,19 +97,19 @@ public function successfulExecutionWithAllParameters(): void
'channel' => 'channelA',
'--client' => 'clientID',
'--session' => 'sessionID',
- ]
+ ],
);
- self::assertSame(0, $result);
+ $this->assertSame(0, $result);
$output = $this->commandTester->getDisplay();
- self::assertStringContainsString('DONE', $output);
+ $this->assertStringContainsString('DONE', $output);
}
#[Test]
public function exception(): void
{
$this->centrifugo
- ->expects(self::once())
+ ->expects($this->once())
->method('unsubscribe')
->willThrowException(new \Exception('test'))
;
@@ -123,11 +119,11 @@ public function exception(): void
'command' => $this->command->getName(),
'user' => 'user123',
'channel' => 'channelA',
- ]
+ ],
);
- self::assertSame(1, $result);
+ $this->assertSame(1, $result);
$output = $this->commandTester->getDisplay();
- self::assertStringContainsString('test', $output);
+ $this->assertStringContainsString('test', $output);
}
}
diff --git a/Tests/DataCollector/CommandCollectorTest.php b/Tests/DataCollector/CommandCollectorTest.php
index e21222b..ae3b773 100755
--- a/Tests/DataCollector/CommandCollectorTest.php
+++ b/Tests/DataCollector/CommandCollectorTest.php
@@ -27,9 +27,7 @@
*/
final class CommandCollectorTest extends TestCase
{
- /** @var CommandHistoryLogger|MockObject */
private CommandHistoryLogger|MockObject $commandHistoryLogger;
-
private CentrifugoCollector $centrifugoCollector;
protected function setUp(): void
@@ -49,39 +47,39 @@ protected function tearDown(): void
#[Test]
public function constructor(): void
{
- self::assertEquals(0, $this->centrifugoCollector->getCommandsCount());
- self::assertEquals(0, $this->centrifugoCollector->getRequestsCount());
- self::assertEquals(0, $this->centrifugoCollector->getSuccessfulCommandsCount());
- self::assertEquals(0, $this->centrifugoCollector->getFailedCommandsCount());
- self::assertCount(0, $this->centrifugoCollector->getCommandHistory());
- self::assertSame('centrifugo', $this->centrifugoCollector->getName());
+ $this->assertEquals(0, $this->centrifugoCollector->getCommandsCount());
+ $this->assertEquals(0, $this->centrifugoCollector->getRequestsCount());
+ $this->assertEquals(0, $this->centrifugoCollector->getSuccessfulCommandsCount());
+ $this->assertEquals(0, $this->centrifugoCollector->getFailedCommandsCount());
+ $this->assertCount(0, $this->centrifugoCollector->getCommandHistory());
+ $this->assertSame('centrifugo', $this->centrifugoCollector->getName());
}
#[Test]
public function collectAndReset(): void
{
$this->commandHistoryLogger
- ->expects(self::exactly(2))
+ ->expects($this->exactly(2))
->method('getCommandHistory')
->willReturn([['test']], [['test'], ['test']])
;
$this->commandHistoryLogger
- ->expects(self::exactly(2))
+ ->expects($this->exactly(2))
->method('getCommandsCount')
->willReturnOnConsecutiveCalls(1, 2)
;
$this->commandHistoryLogger
- ->expects(self::exactly(2))
+ ->expects($this->exactly(2))
->method('getRequestsCount')
->willReturnOnConsecutiveCalls(1, 2)
;
$this->commandHistoryLogger
- ->expects(self::exactly(2))
+ ->expects($this->exactly(2))
->method('getSuccessfulCommandsCount')
->willReturnOnConsecutiveCalls(1, 1)
;
$this->commandHistoryLogger
- ->expects(self::exactly(2))
+ ->expects($this->exactly(2))
->method('getFailedCommandsCount')
->willReturnOnConsecutiveCalls(0, 1)
;
@@ -91,29 +89,29 @@ public function collectAndReset(): void
$this->createStub(Response::class)
);
- self::assertEquals(1, $this->centrifugoCollector->getCommandsCount());
- self::assertEquals(1, $this->centrifugoCollector->getRequestsCount());
- self::assertEquals(1, $this->centrifugoCollector->getSuccessfulCommandsCount());
- self::assertEquals(0, $this->centrifugoCollector->getFailedCommandsCount());
- self::assertCount(1, $this->centrifugoCollector->getCommandHistory());
+ $this->assertEquals(1, $this->centrifugoCollector->getCommandsCount());
+ $this->assertEquals(1, $this->centrifugoCollector->getRequestsCount());
+ $this->assertEquals(1, $this->centrifugoCollector->getSuccessfulCommandsCount());
+ $this->assertEquals(0, $this->centrifugoCollector->getFailedCommandsCount());
+ $this->assertCount(1, $this->centrifugoCollector->getCommandHistory());
$this->centrifugoCollector->collect(
$this->createStub(Request::class),
- $this->createStub(Response::class)
+ $this->createStub(Response::class),
);
- self::assertEquals(2, $this->centrifugoCollector->getCommandsCount());
- self::assertEquals(2, $this->centrifugoCollector->getRequestsCount());
- self::assertEquals(1, $this->centrifugoCollector->getSuccessfulCommandsCount());
- self::assertEquals(1, $this->centrifugoCollector->getFailedCommandsCount());
- self::assertCount(2, $this->centrifugoCollector->getCommandHistory());
+ $this->assertEquals(2, $this->centrifugoCollector->getCommandsCount());
+ $this->assertEquals(2, $this->centrifugoCollector->getRequestsCount());
+ $this->assertEquals(1, $this->centrifugoCollector->getSuccessfulCommandsCount());
+ $this->assertEquals(1, $this->centrifugoCollector->getFailedCommandsCount());
+ $this->assertCount(2, $this->centrifugoCollector->getCommandHistory());
$this->centrifugoCollector->reset();
- self::assertEquals(0, $this->centrifugoCollector->getCommandsCount());
- self::assertEquals(0, $this->centrifugoCollector->getRequestsCount());
- self::assertEquals(0, $this->centrifugoCollector->getSuccessfulCommandsCount());
- self::assertEquals(0, $this->centrifugoCollector->getFailedCommandsCount());
- self::assertCount(0, $this->centrifugoCollector->getCommandHistory());
+ $this->assertEquals(0, $this->centrifugoCollector->getCommandsCount());
+ $this->assertEquals(0, $this->centrifugoCollector->getRequestsCount());
+ $this->assertEquals(0, $this->centrifugoCollector->getSuccessfulCommandsCount());
+ $this->assertEquals(0, $this->centrifugoCollector->getFailedCommandsCount());
+ $this->assertCount(0, $this->centrifugoCollector->getCommandHistory());
}
}
diff --git a/Tests/DependencyInjection/Compiler/RegisterCentrifugoPassTest.php b/Tests/DependencyInjection/Compiler/RegisterCentrifugoPassTest.php
index 0af6617..1b66452 100755
--- a/Tests/DependencyInjection/Compiler/RegisterCentrifugoPassTest.php
+++ b/Tests/DependencyInjection/Compiler/RegisterCentrifugoPassTest.php
@@ -32,9 +32,7 @@ final class RegisterCentrifugoPassTest extends TestCase
{
use ConsecutiveParams;
- /** @var ContainerBuilder|MockObject */
private ContainerBuilder|MockObject $containerBuilder;
-
private RegisterCentrifugoPass $registerCentrifugoPass;
protected function setUp(): void
@@ -55,16 +53,16 @@ protected function tearDown(): void
public function processFakeCentrifugo(): void
{
$this->containerBuilder
- ->expects(self::once())
+ ->expects($this->once())
->method('getParameter')
->with('centrifugo.fake_mode')
->willReturn(true)
;
$this->containerBuilder
- ->expects(self::once())
+ ->expects($this->once())
->method('setDefinition')
- ->with(CentrifugoInterface::class, self::callback(static function (Definition $definition) {
+ ->with(CentrifugoInterface::class, $this->callback(static function (Definition $definition) {
return FakeCentrifugo::class === $definition->getClass();
}))
;
@@ -93,9 +91,9 @@ public function processCentrifugo(): void
;
$this->containerBuilder
- ->expects(self::once())
+ ->expects($this->once())
->method('setDefinition')
- ->with(CentrifugoInterface::class, self::callback(static function (Definition $definition) {
+ ->with(CentrifugoInterface::class, $this->callback(static function (Definition $definition) {
return Centrifugo::class === $definition->getClass();
}))
;
diff --git a/Tests/DependencyInjection/FreshCentrifugoExtensionTest.php b/Tests/DependencyInjection/FreshCentrifugoExtensionTest.php
index 038ca5b..c0fdbe2 100755
--- a/Tests/DependencyInjection/FreshCentrifugoExtensionTest.php
+++ b/Tests/DependencyInjection/FreshCentrifugoExtensionTest.php
@@ -52,25 +52,25 @@ public function loadExtension(): void
$this->container->loadFromExtension($this->extension->getAlias());
$this->container->compile();
- self::assertArrayHasKey(CentrifugoInterface::class, $this->container->getRemovedIds());
- self::assertArrayHasKey(ResponseProcessor::class, $this->container->getRemovedIds());
- self::assertArrayHasKey(DateTimeHelper::class, $this->container->getRemovedIds());
- self::assertArrayNotHasKey(CentrifugoInterface::class, $this->container->getDefinitions());
- self::assertArrayNotHasKey(ResponseProcessor::class, $this->container->getDefinitions());
- self::assertArrayNotHasKey(DateTimeHelper::class, $this->container->getDefinitions());
+ $this->assertArrayHasKey(CentrifugoInterface::class, $this->container->getRemovedIds());
+ $this->assertArrayHasKey(ResponseProcessor::class, $this->container->getRemovedIds());
+ $this->assertArrayHasKey(DateTimeHelper::class, $this->container->getRemovedIds());
+ $this->assertArrayNotHasKey(CentrifugoInterface::class, $this->container->getDefinitions());
+ $this->assertArrayNotHasKey(ResponseProcessor::class, $this->container->getDefinitions());
+ $this->assertArrayNotHasKey(DateTimeHelper::class, $this->container->getDefinitions());
- self::assertTrue($this->container->hasParameter('centrifugo.channel_max_length'));
- self::assertSame(255, $this->container->getParameter('centrifugo.channel_max_length'));
- self::assertTrue($this->container->hasParameter('centrifugo.jwt.ttl'));
- self::assertNull($this->container->getParameter('centrifugo.jwt.ttl'));
- self::assertFalse($this->container->getParameter('centrifugo.fake_mode'));
- self::assertNotEmpty($this->container->getParameter('centrifugo.api_key'));
- self::assertNotEmpty($this->container->getParameter('centrifugo.api_endpoint'));
- self::assertNotEmpty($this->container->getParameter('centrifugo.secret'));
+ $this->assertTrue($this->container->hasParameter('centrifugo.channel_max_length'));
+ $this->assertSame(255, $this->container->getParameter('centrifugo.channel_max_length'));
+ $this->assertTrue($this->container->hasParameter('centrifugo.jwt.ttl'));
+ $this->assertNull($this->container->getParameter('centrifugo.jwt.ttl'));
+ $this->assertFalse($this->container->getParameter('centrifugo.fake_mode'));
+ $this->assertNotEmpty($this->container->getParameter('centrifugo.api_key'));
+ $this->assertNotEmpty($this->container->getParameter('centrifugo.api_endpoint'));
+ $this->assertNotEmpty($this->container->getParameter('centrifugo.secret'));
$childDefinitions = $this->container->getAutoconfiguredInstanceof();
foreach ($childDefinitions as $childDefinition) {
- self::assertTrue($childDefinition->hasTag('centrifugo.channel_authenticator'));
+ $this->assertTrue($childDefinition->hasTag('centrifugo.channel_authenticator'));
}
}
diff --git a/Tests/Exception/CentrifugoErrorExceptionTest.php b/Tests/Exception/CentrifugoErrorExceptionTest.php
index 457e896..ff32b58 100755
--- a/Tests/Exception/CentrifugoErrorExceptionTest.php
+++ b/Tests/Exception/CentrifugoErrorExceptionTest.php
@@ -48,19 +48,19 @@ protected function tearDown(): void
#[Test]
public function getCommand(): void
{
- self::assertSame($this->command, $this->exception->getCommand());
+ $this->assertSame($this->command, $this->exception->getCommand());
}
#[Test]
public function getResponse(): void
{
- self::assertSame($this->response, $this->exception->getResponse());
+ $this->assertSame($this->response, $this->exception->getResponse());
}
#[Test]
public function exception(): void
{
- self::assertInstanceOf(CentrifugoException::class, $this->exception);
- self::assertInstanceOf(ExceptionInterface::class, $this->exception);
+ $this->assertInstanceOf(CentrifugoException::class, $this->exception);
+ $this->assertInstanceOf(ExceptionInterface::class, $this->exception);
}
}
diff --git a/Tests/Exception/CentrifugoExceptionTest.php b/Tests/Exception/CentrifugoExceptionTest.php
index a551e3f..59c3f26 100755
--- a/Tests/Exception/CentrifugoExceptionTest.php
+++ b/Tests/Exception/CentrifugoExceptionTest.php
@@ -27,7 +27,6 @@
final class CentrifugoExceptionTest extends TestCase
{
private CentrifugoException $exception;
-
private ResponseInterface|MockObject $response;
protected function setUp(): void
@@ -45,13 +44,13 @@ protected function tearDown(): void
#[Test]
public function getResponse(): void
{
- self::assertSame($this->response, $this->exception->getResponse());
+ $this->assertSame($this->response, $this->exception->getResponse());
}
#[Test]
public function exception(): void
{
- self::assertInstanceOf(\Exception::class, $this->exception);
- self::assertInstanceOf(ExceptionInterface::class, $this->exception);
+ $this->assertInstanceOf(\Exception::class, $this->exception);
+ $this->assertInstanceOf(ExceptionInterface::class, $this->exception);
}
}
diff --git a/Tests/Exception/InvalidArgumentExceptionTest.php b/Tests/Exception/InvalidArgumentExceptionTest.php
index 8e773a6..f70b116 100755
--- a/Tests/Exception/InvalidArgumentExceptionTest.php
+++ b/Tests/Exception/InvalidArgumentExceptionTest.php
@@ -39,7 +39,7 @@ protected function tearDown(): void
#[Test]
public function exception(): void
{
- self::assertInstanceOf(ExceptionInterface::class, $this->exception);
- self::assertInstanceOf(\InvalidArgumentException::class, $this->exception);
+ $this->assertInstanceOf(ExceptionInterface::class, $this->exception);
+ $this->assertInstanceOf(\InvalidArgumentException::class, $this->exception);
}
}
diff --git a/Tests/Exception/LogicExceptionTest.php b/Tests/Exception/LogicExceptionTest.php
index ca7f797..78d051f 100755
--- a/Tests/Exception/LogicExceptionTest.php
+++ b/Tests/Exception/LogicExceptionTest.php
@@ -39,7 +39,7 @@ protected function tearDown(): void
#[Test]
public function exception(): void
{
- self::assertInstanceOf(ExceptionInterface::class, $this->exception);
- self::assertInstanceOf(\LogicException::class, $this->exception);
+ $this->assertInstanceOf(ExceptionInterface::class, $this->exception);
+ $this->assertInstanceOf(\LogicException::class, $this->exception);
}
}
diff --git a/Tests/Exception/UnexpectedValueExceptionTest.php b/Tests/Exception/UnexpectedValueExceptionTest.php
index 728ebe9..f5c43a4 100755
--- a/Tests/Exception/UnexpectedValueExceptionTest.php
+++ b/Tests/Exception/UnexpectedValueExceptionTest.php
@@ -39,7 +39,7 @@ protected function tearDown(): void
#[Test]
public function exception(): void
{
- self::assertInstanceOf(ExceptionInterface::class, $this->exception);
- self::assertInstanceOf(\UnexpectedValueException::class, $this->exception);
+ $this->assertInstanceOf(ExceptionInterface::class, $this->exception);
+ $this->assertInstanceOf(\UnexpectedValueException::class, $this->exception);
}
}
diff --git a/Tests/FreshCentrifugoBundleTest.php b/Tests/FreshCentrifugoBundleTest.php
index 23646fb..7bf965a 100755
--- a/Tests/FreshCentrifugoBundleTest.php
+++ b/Tests/FreshCentrifugoBundleTest.php
@@ -30,9 +30,9 @@ public function build(): void
{
$containerBuilder = $this->createMock(ContainerBuilder::class);
$containerBuilder
- ->expects(self::once())
+ ->expects($this->once())
->method('addCompilerPass')
- ->with(self::isInstanceOf(RegisterCentrifugoPass::class))
+ ->with($this->isInstanceOf(RegisterCentrifugoPass::class))
;
$bundle = new FreshCentrifugoBundle();
diff --git a/Tests/Logger/CommandHistoryLoggerTest.php b/Tests/Logger/CommandHistoryLoggerTest.php
index d98bcc9..5033146 100755
--- a/Tests/Logger/CommandHistoryLoggerTest.php
+++ b/Tests/Logger/CommandHistoryLoggerTest.php
@@ -39,25 +39,25 @@ protected function tearDown(): void
#[Test]
public function constructor(): void
{
- self::assertCount(0, $this->commandHistoryLogger->getCommandHistory());
- self::assertSame(0, $this->commandHistoryLogger->getCommandsCount());
- self::assertSame(0, $this->commandHistoryLogger->getRequestsCount());
- self::assertSame(0, $this->commandHistoryLogger->getSuccessfulCommandsCount());
- self::assertSame(0, $this->commandHistoryLogger->getFailedCommandsCount());
+ $this->assertCount(0, $this->commandHistoryLogger->getCommandHistory());
+ $this->assertSame(0, $this->commandHistoryLogger->getCommandsCount());
+ $this->assertSame(0, $this->commandHistoryLogger->getRequestsCount());
+ $this->assertSame(0, $this->commandHistoryLogger->getSuccessfulCommandsCount());
+ $this->assertSame(0, $this->commandHistoryLogger->getFailedCommandsCount());
}
#[Test]
public function requestCount(): void
{
- self::assertSame(0, $this->commandHistoryLogger->getRequestsCount());
+ $this->assertSame(0, $this->commandHistoryLogger->getRequestsCount());
$this->commandHistoryLogger->increaseRequestsCount();
- self::assertSame(1, $this->commandHistoryLogger->getRequestsCount());
+ $this->assertSame(1, $this->commandHistoryLogger->getRequestsCount());
$this->commandHistoryLogger->increaseRequestsCount();
- self::assertSame(2, $this->commandHistoryLogger->getRequestsCount());
+ $this->assertSame(2, $this->commandHistoryLogger->getRequestsCount());
$this->commandHistoryLogger->clearCommandHistory();
- self::assertSame(0, $this->commandHistoryLogger->getRequestsCount());
+ $this->assertSame(0, $this->commandHistoryLogger->getRequestsCount());
}
#[Test]
@@ -65,29 +65,29 @@ public function fullFlow(): void
{
$command = new PublishCommand([], 'channelA');
$this->commandHistoryLogger->logCommand($command, true, ['test']);
- self::assertCount(1, $this->commandHistoryLogger->getCommandHistory());
- self::assertSame(
+ $this->assertCount(1, $this->commandHistoryLogger->getCommandHistory());
+ $this->assertSame(
[
'command' => $command,
'result' => ['test'],
'success' => true,
],
- $this->commandHistoryLogger->getCommandHistory()[0]
+ $this->commandHistoryLogger->getCommandHistory()[0],
);
- self::assertSame(1, $this->commandHistoryLogger->getCommandsCount());
- self::assertSame(1, $this->commandHistoryLogger->getSuccessfulCommandsCount());
- self::assertSame(0, $this->commandHistoryLogger->getFailedCommandsCount());
+ $this->assertSame(1, $this->commandHistoryLogger->getCommandsCount());
+ $this->assertSame(1, $this->commandHistoryLogger->getSuccessfulCommandsCount());
+ $this->assertSame(0, $this->commandHistoryLogger->getFailedCommandsCount());
$this->commandHistoryLogger->logCommand(new PublishCommand([], 'channelB'), false, []);
- self::assertCount(2, $this->commandHistoryLogger->getCommandHistory());
- self::assertSame(2, $this->commandHistoryLogger->getCommandsCount());
- self::assertSame(1, $this->commandHistoryLogger->getSuccessfulCommandsCount());
- self::assertSame(1, $this->commandHistoryLogger->getFailedCommandsCount());
+ $this->assertCount(2, $this->commandHistoryLogger->getCommandHistory());
+ $this->assertSame(2, $this->commandHistoryLogger->getCommandsCount());
+ $this->assertSame(1, $this->commandHistoryLogger->getSuccessfulCommandsCount());
+ $this->assertSame(1, $this->commandHistoryLogger->getFailedCommandsCount());
$this->commandHistoryLogger->clearCommandHistory();
- self::assertCount(0, $this->commandHistoryLogger->getCommandHistory());
- self::assertSame(0, $this->commandHistoryLogger->getCommandsCount());
- self::assertSame(0, $this->commandHistoryLogger->getSuccessfulCommandsCount());
- self::assertSame(0, $this->commandHistoryLogger->getFailedCommandsCount());
+ $this->assertCount(0, $this->commandHistoryLogger->getCommandHistory());
+ $this->assertSame(0, $this->commandHistoryLogger->getCommandsCount());
+ $this->assertSame(0, $this->commandHistoryLogger->getSuccessfulCommandsCount());
+ $this->assertSame(0, $this->commandHistoryLogger->getFailedCommandsCount());
}
}
diff --git a/Tests/Model/BatchRequestTest.php b/Tests/Model/BatchRequestTest.php
index cf0e4c2..9868726 100755
--- a/Tests/Model/BatchRequestTest.php
+++ b/Tests/Model/BatchRequestTest.php
@@ -45,23 +45,23 @@ protected function tearDown(): void
public function getCommands(): void
{
$commands = $this->command->getCommands();
- self::assertInstanceOf(PublishCommand::class, $commands->current());
+ $this->assertInstanceOf(PublishCommand::class, $commands->current());
$commands->next();
- self::assertInstanceOf(BroadcastCommand::class, $commands->current());
+ $this->assertInstanceOf(BroadcastCommand::class, $commands->current());
}
#[Test]
public function addCommandAndGetNumberOfCommands(): void
{
- self::assertEquals(2, $this->command->getNumberOfCommands());
+ $this->assertEquals(2, $this->command->getNumberOfCommands());
$this->command->addCommand(new InfoCommand());
- self::assertEquals(3, $this->command->getNumberOfCommands());
+ $this->assertEquals(3, $this->command->getNumberOfCommands());
$commands = $this->command->getCommands();
$commands->next();
$commands->next();
- self::assertInstanceOf(InfoCommand::class, $commands->current());
+ $this->assertInstanceOf(InfoCommand::class, $commands->current());
}
#[Test]
@@ -77,26 +77,26 @@ public function constructorWithException(): void
public function getChannels(): void
{
$channels = $this->command->getChannels();
- self::assertEquals('channelA', $channels->current());
+ $this->assertEquals('channelA', $channels->current());
$channels->next();
- self::assertEquals('channelB', $channels->current());
+ $this->assertEquals('channelB', $channels->current());
$channels->next();
- self::assertEquals('channelC', $channels->current());
+ $this->assertEquals('channelC', $channels->current());
}
#[Test]
public function prepareLineDelimitedJsonWithEmptyBatchRequest(): void
{
$batchRequest = new BatchRequest();
- self::assertEquals('{}', $batchRequest->prepareLineDelimitedJson());
+ $this->assertEquals('{}', $batchRequest->prepareLineDelimitedJson());
}
#[Test]
public function prepareLineDelimitedJsonWithNonEmptyBatchRequest(): void
{
- self::assertJsonStringEqualsJsonString(
+ $this->assertJsonStringEqualsJsonString(
expectedJson: <<<'JSON'
{
"commands": [
diff --git a/Tests/Model/BroadcastCommandTest.php b/Tests/Model/BroadcastCommandTest.php
index 998d5a6..3ba6d92 100755
--- a/Tests/Model/BroadcastCommandTest.php
+++ b/Tests/Model/BroadcastCommandTest.php
@@ -33,8 +33,8 @@ public function interfaces(): void
data: ['baz' => 'qux'],
channels: ['foo', 'bar'],
);
- self::assertInstanceOf(SerializableCommandInterface::class, $command);
- self::assertInstanceOf(CommandInterface::class, $command);
+ $this->assertInstanceOf(SerializableCommandInterface::class, $command);
+ $this->assertInstanceOf(CommandInterface::class, $command);
}
#[Test]
@@ -44,9 +44,9 @@ public function constructor(): void
data: ['baz' => 'qux'],
channels: ['foo', 'bar'],
);
- self::assertEquals(Method::BROADCAST, $command->getMethod());
- self::assertEquals(['channels' => ['foo', 'bar'], 'data' => ['baz' => 'qux']], $command->getParams());
- self::assertEquals(['foo', 'bar'], $command->getChannels());
+ $this->assertEquals(Method::BROADCAST, $command->getMethod());
+ $this->assertEquals(['channels' => ['foo', 'bar'], 'data' => ['baz' => 'qux']], $command->getParams());
+ $this->assertEquals(['foo', 'bar'], $command->getChannels());
}
#[Test]
@@ -56,7 +56,7 @@ public function serializationRequiredData(): void
data: ['baz' => 'qux'],
channels: ['foo', 'bar'],
);
- self::assertJsonStringEqualsJsonString(
+ $this->assertJsonStringEqualsJsonString(
<<<'JSON'
{
"channels": ["foo", "bar"],
@@ -65,7 +65,7 @@ public function serializationRequiredData(): void
}
}
JSON,
- \json_encode($command, \JSON_THROW_ON_ERROR | \JSON_FORCE_OBJECT)
+ \json_encode($command, \JSON_THROW_ON_ERROR),
);
}
@@ -79,7 +79,7 @@ public function serializationAllData(): void
tags: ['tag' => 'value'],
base64data: 'qwerty',
);
- self::assertJsonStringEqualsJsonString(
+ $this->assertJsonStringEqualsJsonString(
<<<'JSON'
{
"channels": ["foo", "bar"],
@@ -93,7 +93,7 @@ public function serializationAllData(): void
"base64data": "qwerty"
}
JSON,
- \json_encode($command, \JSON_THROW_ON_ERROR | \JSON_FORCE_OBJECT)
+ \json_encode($command, \JSON_THROW_ON_ERROR),
);
}
}
diff --git a/Tests/Model/ChannelsCommandTest.php b/Tests/Model/ChannelsCommandTest.php
index ee16241..1cc2563 100755
--- a/Tests/Model/ChannelsCommandTest.php
+++ b/Tests/Model/ChannelsCommandTest.php
@@ -30,28 +30,28 @@ final class ChannelsCommandTest extends TestCase
public function interfaces(): void
{
$command = new ChannelsCommand();
- self::assertInstanceOf(SerializableCommandInterface::class, $command);
- self::assertInstanceOf(CommandInterface::class, $command);
+ $this->assertInstanceOf(SerializableCommandInterface::class, $command);
+ $this->assertInstanceOf(CommandInterface::class, $command);
}
#[Test]
public function constructor(): void
{
$command = new ChannelsCommand();
- self::assertEquals(Method::CHANNELS, $command->getMethod());
- self::assertEquals([], $command->getParams());
- self::assertEquals([], $command->getChannels());
+ $this->assertEquals(Method::CHANNELS, $command->getMethod());
+ $this->assertEquals([], $command->getParams());
+ $this->assertEquals([], $command->getChannels());
}
#[Test]
public function serializationWithoutPattern(): void
{
$command = new ChannelsCommand();
- self::assertJsonStringEqualsJsonString(
+ $this->assertJsonStringEqualsJsonString(
<<<'JSON'
{}
JSON,
- \json_encode($command, \JSON_THROW_ON_ERROR | \JSON_FORCE_OBJECT)
+ \json_encode($command, \JSON_THROW_ON_ERROR | \JSON_FORCE_OBJECT),
);
}
@@ -60,13 +60,13 @@ public function serializationWithPattern(): void
{
$command = new ChannelsCommand(pattern: 'abc');
- self::assertJsonStringEqualsJsonString(
+ $this->assertJsonStringEqualsJsonString(
<<<'JSON'
{
"pattern": "abc"
}
JSON,
- \json_encode($command, \JSON_THROW_ON_ERROR | \JSON_FORCE_OBJECT)
+ \json_encode($command, \JSON_THROW_ON_ERROR | \JSON_FORCE_OBJECT),
);
}
@@ -74,6 +74,6 @@ public function serializationWithPattern(): void
public function processResponse(): void
{
$command = new ChannelsCommand();
- self::assertEquals(['foo' => 'bar'], $command->processResponse(['foo' => 'bar']));
+ $this->assertEquals(['foo' => 'bar'], $command->processResponse(['foo' => 'bar']));
}
}
diff --git a/Tests/Model/DisconnectCommandTest.php b/Tests/Model/DisconnectCommandTest.php
index a506b33..2527620 100755
--- a/Tests/Model/DisconnectCommandTest.php
+++ b/Tests/Model/DisconnectCommandTest.php
@@ -31,30 +31,30 @@ final class DisconnectCommandTest extends TestCase
public function interfaces(): void
{
$command = new DisconnectCommand(user: 'foo');
- self::assertInstanceOf(SerializableCommandInterface::class, $command);
- self::assertInstanceOf(CommandInterface::class, $command);
+ $this->assertInstanceOf(SerializableCommandInterface::class, $command);
+ $this->assertInstanceOf(CommandInterface::class, $command);
}
#[Test]
public function constructor(): void
{
$command = new DisconnectCommand(user: 'foo');
- self::assertEquals(Method::DISCONNECT, $command->getMethod());
- self::assertEquals(['user' => 'foo'], $command->getParams());
- self::assertEquals([], $command->getChannels());
+ $this->assertEquals(Method::DISCONNECT, $command->getMethod());
+ $this->assertEquals(['user' => 'foo'], $command->getParams());
+ $this->assertEquals([], $command->getChannels());
}
#[Test]
public function serializationRequiredData(): void
{
$command = new DisconnectCommand(user: 'foo');
- self::assertJsonStringEqualsJsonString(
+ $this->assertJsonStringEqualsJsonString(
<<<'JSON'
{
"user": "foo"
}
JSON,
- \json_encode($command, \JSON_THROW_ON_ERROR | \JSON_FORCE_OBJECT)
+ \json_encode($command, \JSON_THROW_ON_ERROR | \JSON_FORCE_OBJECT),
);
}
@@ -68,7 +68,7 @@ public function serializationAllData(): void
session: 'sessionID1',
disconnectObject: new Disconnect(code: 999, reason: 'some reason'),
);
- self::assertJsonStringEqualsJsonString(
+ $this->assertJsonStringEqualsJsonString(
<<<'JSON'
{
"user": "foo",
@@ -81,7 +81,7 @@ public function serializationAllData(): void
}
}
JSON,
- \json_encode($command, \JSON_THROW_ON_ERROR | \JSON_FORCE_OBJECT)
+ \json_encode($command, \JSON_THROW_ON_ERROR),
);
}
}
diff --git a/Tests/Model/DisconnectTest.php b/Tests/Model/DisconnectTest.php
index bf50cdd..772cae4 100755
--- a/Tests/Model/DisconnectTest.php
+++ b/Tests/Model/DisconnectTest.php
@@ -27,7 +27,7 @@ final class DisconnectTest extends TestCase
public function constructor(): void
{
$disconnectObject = new Disconnect(999, 'some reason');
- self::assertSame(999, $disconnectObject->getCode());
- self::assertSame('some reason', $disconnectObject->getReason());
+ $this->assertSame(999, $disconnectObject->getCode());
+ $this->assertSame('some reason', $disconnectObject->getReason());
}
}
diff --git a/Tests/Model/HistoryCommandTest.php b/Tests/Model/HistoryCommandTest.php
index 0b5c60e..9542ea2 100755
--- a/Tests/Model/HistoryCommandTest.php
+++ b/Tests/Model/HistoryCommandTest.php
@@ -31,30 +31,30 @@ final class HistoryCommandTest extends TestCase
public function interfaces(): void
{
$command = new HistoryCommand(channel: 'foo');
- self::assertInstanceOf(SerializableCommandInterface::class, $command);
- self::assertInstanceOf(CommandInterface::class, $command);
+ $this->assertInstanceOf(SerializableCommandInterface::class, $command);
+ $this->assertInstanceOf(CommandInterface::class, $command);
}
#[Test]
public function constructor(): void
{
$command = new HistoryCommand(channel: 'foo');
- self::assertEquals(Method::HISTORY, $command->getMethod());
- self::assertEquals(['channel' => 'foo'], $command->getParams());
- self::assertEquals(['foo'], $command->getChannels());
+ $this->assertEquals(Method::HISTORY, $command->getMethod());
+ $this->assertEquals(['channel' => 'foo'], $command->getParams());
+ $this->assertEquals(['foo'], $command->getChannels());
}
#[Test]
public function serializationRequiredData(): void
{
$command = new HistoryCommand(channel: 'foo');
- self::assertJsonStringEqualsJsonString(
+ $this->assertJsonStringEqualsJsonString(
<<<'JSON'
{
"channel": "foo"
}
JSON,
- \json_encode($command, \JSON_THROW_ON_ERROR | \JSON_FORCE_OBJECT)
+ \json_encode($command, \JSON_THROW_ON_ERROR | \JSON_FORCE_OBJECT),
);
}
@@ -67,7 +67,7 @@ public function serializationAllData(): void
limit: 10,
streamPosition: new StreamPosition(offset: 5, epoch: 'test'),
);
- self::assertJsonStringEqualsJsonString(
+ $this->assertJsonStringEqualsJsonString(
<<<'JSON'
{
"channel": "foo",
@@ -79,7 +79,7 @@ public function serializationAllData(): void
}
}
JSON,
- \json_encode($command, \JSON_THROW_ON_ERROR | \JSON_FORCE_OBJECT)
+ \json_encode($command, \JSON_THROW_ON_ERROR | \JSON_FORCE_OBJECT),
);
}
@@ -92,14 +92,14 @@ public function serializationWithZeroValues(): void
limit: 0,
streamPosition: new StreamPosition(offset: null, epoch: null),
);
- self::assertJsonStringEqualsJsonString(
+ $this->assertJsonStringEqualsJsonString(
<<<'JSON'
{
"channel": "foo",
"reverse": true
}
JSON,
- \json_encode($command, \JSON_THROW_ON_ERROR | \JSON_FORCE_OBJECT)
+ \json_encode($command, \JSON_THROW_ON_ERROR | \JSON_FORCE_OBJECT),
);
}
@@ -112,6 +112,6 @@ public function processResponse(): void
limit: 0,
streamPosition: new StreamPosition(offset: null, epoch: null),
);
- self::assertEquals(['foo' => 'bar'], $command->processResponse(['result' => ['foo' => 'bar']]));
+ $this->assertEquals(['foo' => 'bar'], $command->processResponse(['result' => ['foo' => 'bar']]));
}
}
diff --git a/Tests/Model/HistoryRemoveCommandTest.php b/Tests/Model/HistoryRemoveCommandTest.php
index d4c0682..dce7697 100755
--- a/Tests/Model/HistoryRemoveCommandTest.php
+++ b/Tests/Model/HistoryRemoveCommandTest.php
@@ -30,30 +30,30 @@ final class HistoryRemoveCommandTest extends TestCase
public function interfaces(): void
{
$command = new HistoryRemoveCommand(channel: 'foo');
- self::assertInstanceOf(SerializableCommandInterface::class, $command);
- self::assertInstanceOf(CommandInterface::class, $command);
+ $this->assertInstanceOf(SerializableCommandInterface::class, $command);
+ $this->assertInstanceOf(CommandInterface::class, $command);
}
#[Test]
public function constructor(): void
{
$command = new HistoryRemoveCommand(channel: 'foo');
- self::assertEquals(Method::HISTORY_REMOVE, $command->getMethod());
- self::assertEquals(['channel' => 'foo'], $command->getParams());
- self::assertEquals(['foo'], $command->getChannels());
+ $this->assertEquals(Method::HISTORY_REMOVE, $command->getMethod());
+ $this->assertEquals(['channel' => 'foo'], $command->getParams());
+ $this->assertEquals(['foo'], $command->getChannels());
}
#[Test]
public function serialization(): void
{
$command = new HistoryRemoveCommand(channel: 'foo');
- self::assertJsonStringEqualsJsonString(
+ $this->assertJsonStringEqualsJsonString(
<<<'JSON'
{
"channel": "foo"
}
JSON,
- \json_encode($command, \JSON_THROW_ON_ERROR | \JSON_FORCE_OBJECT)
+ \json_encode($command, \JSON_THROW_ON_ERROR | \JSON_FORCE_OBJECT),
);
}
}
diff --git a/Tests/Model/InfoCommandTest.php b/Tests/Model/InfoCommandTest.php
index efced7d..77167fd 100755
--- a/Tests/Model/InfoCommandTest.php
+++ b/Tests/Model/InfoCommandTest.php
@@ -32,28 +32,28 @@ final class InfoCommandTest extends TestCase
public function interfaces(): void
{
$command = new InfoCommand();
- self::assertInstanceOf(SerializableCommandInterface::class, $command);
- self::assertInstanceOf(CommandInterface::class, $command);
+ $this->assertInstanceOf(SerializableCommandInterface::class, $command);
+ $this->assertInstanceOf(CommandInterface::class, $command);
}
#[Test]
public function constructor(): void
{
$command = new InfoCommand();
- self::assertEquals(Method::INFO, $command->getMethod());
- self::assertEquals([], $command->getParams());
- self::assertEquals([], $command->getChannels());
+ $this->assertEquals(Method::INFO, $command->getMethod());
+ $this->assertEquals([], $command->getParams());
+ $this->assertEquals([], $command->getChannels());
}
#[Test]
public function serialization(): void
{
$command = new InfoCommand();
- self::assertJsonStringEqualsJsonString(
+ $this->assertJsonStringEqualsJsonString(
<<<'JSON'
{}
JSON,
- \json_encode($command, \JSON_THROW_ON_ERROR | \JSON_FORCE_OBJECT)
+ \json_encode($command, \JSON_THROW_ON_ERROR | \JSON_FORCE_OBJECT),
);
}
@@ -61,6 +61,6 @@ public function serialization(): void
public function processResponse(): void
{
$command = new InfoCommand();
- self::assertEquals(['foo' => 'bar'], $command->processResponse(['result' => ['foo' => 'bar']]));
+ $this->assertEquals(['foo' => 'bar'], $command->processResponse(['result' => ['foo' => 'bar']]));
}
}
diff --git a/Tests/Model/PresenceCommandTest.php b/Tests/Model/PresenceCommandTest.php
index 01a88fe..d486234 100755
--- a/Tests/Model/PresenceCommandTest.php
+++ b/Tests/Model/PresenceCommandTest.php
@@ -31,30 +31,30 @@ final class PresenceCommandTest extends TestCase
public function interfaces(): void
{
$command = new PresenceCommand(channel: 'foo');
- self::assertInstanceOf(SerializableCommandInterface::class, $command);
- self::assertInstanceOf(CommandInterface::class, $command);
+ $this->assertInstanceOf(SerializableCommandInterface::class, $command);
+ $this->assertInstanceOf(CommandInterface::class, $command);
}
#[Test]
public function constructor(): void
{
$command = new PresenceCommand(channel: 'foo');
- self::assertEquals(Method::PRESENCE, $command->getMethod());
- self::assertEquals(['channel' => 'foo'], $command->getParams());
- self::assertEquals(['foo'], $command->getChannels());
+ $this->assertEquals(Method::PRESENCE, $command->getMethod());
+ $this->assertEquals(['channel' => 'foo'], $command->getParams());
+ $this->assertEquals(['foo'], $command->getChannels());
}
#[Test]
public function serialization(): void
{
$command = new PresenceCommand(channel: 'foo');
- self::assertJsonStringEqualsJsonString(
+ $this->assertJsonStringEqualsJsonString(
<<<'JSON'
{
"channel": "foo"
}
JSON,
- \json_encode($command, \JSON_THROW_ON_ERROR | \JSON_FORCE_OBJECT)
+ \json_encode($command, \JSON_THROW_ON_ERROR | \JSON_FORCE_OBJECT),
);
}
@@ -62,6 +62,6 @@ public function serialization(): void
public function processResponse(): void
{
$command = new PresenceCommand(channel: 'foo');
- self::assertEquals(['foo' => 'bar'], $command->processResponse(['result' => ['presence' => ['foo' => 'bar']]]));
+ $this->assertEquals(['foo' => 'bar'], $command->processResponse(['result' => ['presence' => ['foo' => 'bar']]]));
}
}
diff --git a/Tests/Model/PresenceStatsCommandTest.php b/Tests/Model/PresenceStatsCommandTest.php
index cfd5ba2..2efdae1 100755
--- a/Tests/Model/PresenceStatsCommandTest.php
+++ b/Tests/Model/PresenceStatsCommandTest.php
@@ -31,30 +31,30 @@ final class PresenceStatsCommandTest extends TestCase
public function interfaces(): void
{
$command = new PresenceStatsCommand(channel: 'foo');
- self::assertInstanceOf(SerializableCommandInterface::class, $command);
- self::assertInstanceOf(CommandInterface::class, $command);
+ $this->assertInstanceOf(SerializableCommandInterface::class, $command);
+ $this->assertInstanceOf(CommandInterface::class, $command);
}
#[Test]
public function constructor(): void
{
$command = new PresenceStatsCommand(channel: 'foo');
- self::assertEquals(Method::PRESENCE_STATS, $command->getMethod());
- self::assertEquals(['channel' => 'foo'], $command->getParams());
- self::assertEquals(['foo'], $command->getChannels());
+ $this->assertEquals(Method::PRESENCE_STATS, $command->getMethod());
+ $this->assertEquals(['channel' => 'foo'], $command->getParams());
+ $this->assertEquals(['foo'], $command->getChannels());
}
#[Test]
public function serialization(): void
{
$command = new PresenceStatsCommand(channel: 'foo');
- self::assertJsonStringEqualsJsonString(
+ $this->assertJsonStringEqualsJsonString(
<<<'JSON'
{
"channel": "foo"
}
JSON,
- \json_encode($command, \JSON_THROW_ON_ERROR | \JSON_FORCE_OBJECT)
+ \json_encode($command, \JSON_THROW_ON_ERROR | \JSON_FORCE_OBJECT),
);
}
@@ -62,6 +62,6 @@ public function serialization(): void
public function processResponse(): void
{
$command = new PresenceStatsCommand(channel: 'foo');
- self::assertEquals(['foo' => 'bar'], $command->processResponse(['result' => ['foo' => 'bar']]));
+ $this->assertEquals(['foo' => 'bar'], $command->processResponse(['result' => ['foo' => 'bar']]));
}
}
diff --git a/Tests/Model/PublishCommandTest.php b/Tests/Model/PublishCommandTest.php
index 57df2a0..c2562c7 100755
--- a/Tests/Model/PublishCommandTest.php
+++ b/Tests/Model/PublishCommandTest.php
@@ -33,8 +33,8 @@ public function interfaces(): void
data: ['bar' => 'baz'],
channel: 'foo',
);
- self::assertInstanceOf(SerializableCommandInterface::class, $command);
- self::assertInstanceOf(CommandInterface::class, $command);
+ $this->assertInstanceOf(SerializableCommandInterface::class, $command);
+ $this->assertInstanceOf(CommandInterface::class, $command);
}
#[Test]
@@ -44,9 +44,9 @@ public function constructor(): void
data: ['bar' => 'baz'],
channel: 'foo',
);
- self::assertEquals(Method::PUBLISH, $command->getMethod());
- self::assertEquals(['channel' => 'foo', 'data' => ['bar' => 'baz']], $command->getParams());
- self::assertEquals(['foo'], $command->getChannels());
+ $this->assertEquals(Method::PUBLISH, $command->getMethod());
+ $this->assertEquals(['channel' => 'foo', 'data' => ['bar' => 'baz']], $command->getParams());
+ $this->assertEquals(['foo'], $command->getChannels());
}
#[Test]
@@ -56,7 +56,7 @@ public function serializationRequiredData(): void
data: ['bar' => 'baz'],
channel: 'foo',
);
- self::assertJsonStringEqualsJsonString(
+ $this->assertJsonStringEqualsJsonString(
<<<'JSON'
{
"channel": "foo",
@@ -65,7 +65,7 @@ public function serializationRequiredData(): void
}
}
JSON,
- \json_encode($command, \JSON_THROW_ON_ERROR | \JSON_FORCE_OBJECT)
+ \json_encode($command, \JSON_THROW_ON_ERROR | \JSON_FORCE_OBJECT),
);
}
@@ -79,7 +79,7 @@ public function serializationAllData(): void
tags: ['tag' => 'value'],
base64data: 'qwerty',
);
- self::assertJsonStringEqualsJsonString(
+ $this->assertJsonStringEqualsJsonString(
<<<'JSON'
{
"channel": "foo",
@@ -93,7 +93,7 @@ public function serializationAllData(): void
"b64data": "qwerty"
}
JSON,
- \json_encode($command, \JSON_THROW_ON_ERROR | \JSON_FORCE_OBJECT)
+ \json_encode($command, \JSON_THROW_ON_ERROR | \JSON_FORCE_OBJECT),
);
}
}
diff --git a/Tests/Model/RefreshCommandTest.php b/Tests/Model/RefreshCommandTest.php
index 1d5c8f1..b62e80d 100755
--- a/Tests/Model/RefreshCommandTest.php
+++ b/Tests/Model/RefreshCommandTest.php
@@ -30,30 +30,30 @@ final class RefreshCommandTest extends TestCase
public function interfaces(): void
{
$command = new RefreshCommand(user: 'foo');
- self::assertInstanceOf(SerializableCommandInterface::class, $command);
- self::assertInstanceOf(CommandInterface::class, $command);
+ $this->assertInstanceOf(SerializableCommandInterface::class, $command);
+ $this->assertInstanceOf(CommandInterface::class, $command);
}
#[Test]
public function constructor(): void
{
$command = new RefreshCommand(user: 'foo');
- self::assertEquals(Method::REFRESH, $command->getMethod());
- self::assertEquals(['user' => 'foo'], $command->getParams());
- self::assertEquals([], $command->getChannels());
+ $this->assertEquals(Method::REFRESH, $command->getMethod());
+ $this->assertEquals(['user' => 'foo'], $command->getParams());
+ $this->assertEquals([], $command->getChannels());
}
#[Test]
public function serializationRequiredData(): void
{
$command = new RefreshCommand(user: 'foo');
- self::assertJsonStringEqualsJsonString(
+ $this->assertJsonStringEqualsJsonString(
<<<'JSON'
{
"user": "foo"
}
JSON,
- \json_encode($command, \JSON_THROW_ON_ERROR | \JSON_FORCE_OBJECT)
+ \json_encode($command, \JSON_THROW_ON_ERROR | \JSON_FORCE_OBJECT),
);
}
@@ -67,7 +67,7 @@ public function serializationAllData(): void
expired: true,
expireAt: 1234567890,
);
- self::assertJsonStringEqualsJsonString(
+ $this->assertJsonStringEqualsJsonString(
<<<'JSON'
{
"user": "foo",
@@ -77,7 +77,7 @@ public function serializationAllData(): void
"expire_at": 1234567890
}
JSON,
- \json_encode($command, \JSON_THROW_ON_ERROR | \JSON_FORCE_OBJECT)
+ \json_encode($command, \JSON_THROW_ON_ERROR | \JSON_FORCE_OBJECT),
);
}
}
diff --git a/Tests/Model/StreamPositionTest.php b/Tests/Model/StreamPositionTest.php
index 2e4bfba..854ea92 100755
--- a/Tests/Model/StreamPositionTest.php
+++ b/Tests/Model/StreamPositionTest.php
@@ -27,7 +27,7 @@ final class StreamPositionTest extends TestCase
public function constructor(): void
{
$streamPosition = new StreamPosition(5, 'ABCD');
- self::assertSame(5, $streamPosition->getOffset());
- self::assertSame('ABCD', $streamPosition->getEpoch());
+ $this->assertSame(5, $streamPosition->getOffset());
+ $this->assertSame('ABCD', $streamPosition->getEpoch());
}
}
diff --git a/Tests/Model/SubscribeCommandTest.php b/Tests/Model/SubscribeCommandTest.php
index 1970d14..9f5b79e 100755
--- a/Tests/Model/SubscribeCommandTest.php
+++ b/Tests/Model/SubscribeCommandTest.php
@@ -35,8 +35,8 @@ public function interfaces(): void
user: 'user123',
channel: 'foo',
);
- self::assertInstanceOf(SerializableCommandInterface::class, $command);
- self::assertInstanceOf(CommandInterface::class, $command);
+ $this->assertInstanceOf(SerializableCommandInterface::class, $command);
+ $this->assertInstanceOf(CommandInterface::class, $command);
}
#[Test]
@@ -46,9 +46,9 @@ public function constructor(): void
user: 'user123',
channel: 'foo',
);
- self::assertEquals(Method::SUBSCRIBE, $command->getMethod());
- self::assertEquals(['user' => 'user123', 'channel' => 'foo'], $command->getParams());
- self::assertEquals(['foo'], $command->getChannels());
+ $this->assertEquals(Method::SUBSCRIBE, $command->getMethod());
+ $this->assertEquals(['user' => 'user123', 'channel' => 'foo'], $command->getParams());
+ $this->assertEquals(['foo'], $command->getChannels());
}
#[Test]
@@ -58,14 +58,14 @@ public function serializationRequiredData(): void
user: 'user123',
channel: 'foo',
);
- self::assertJsonStringEqualsJsonString(
+ $this->assertJsonStringEqualsJsonString(
<<<'JSON'
{
"user": "user123",
"channel": "foo"
}
JSON,
- \json_encode($command, \JSON_THROW_ON_ERROR | \JSON_FORCE_OBJECT)
+ \json_encode($command, \JSON_THROW_ON_ERROR | \JSON_FORCE_OBJECT),
);
}
@@ -90,7 +90,7 @@ public function serializationAllData(): void
forceRecovery: true,
),
);
- self::assertJsonStringEqualsJsonString(
+ $this->assertJsonStringEqualsJsonString(
<<<'JSON'
{
"user": "user123",
@@ -118,7 +118,7 @@ public function serializationAllData(): void
}
}
JSON,
- \json_encode($command, \JSON_THROW_ON_ERROR | \JSON_FORCE_OBJECT)
+ \json_encode($command, \JSON_THROW_ON_ERROR | \JSON_FORCE_OBJECT),
);
}
@@ -136,7 +136,7 @@ public function serializationWithZeroValues(): void
base64Data: '',
recoverSince: new StreamPosition(offset: null, epoch: null),
);
- self::assertJsonStringEqualsJsonString(
+ $this->assertJsonStringEqualsJsonString(
<<<'JSON'
{
"user": "user123",
@@ -151,7 +151,7 @@ public function serializationWithZeroValues(): void
}
}
JSON,
- \json_encode($command, \JSON_THROW_ON_ERROR | \JSON_FORCE_OBJECT)
+ \json_encode($command, \JSON_THROW_ON_ERROR | \JSON_FORCE_OBJECT),
);
}
}
diff --git a/Tests/Model/UnsubscribeCommandTest.php b/Tests/Model/UnsubscribeCommandTest.php
index 96e2481..cfddae3 100755
--- a/Tests/Model/UnsubscribeCommandTest.php
+++ b/Tests/Model/UnsubscribeCommandTest.php
@@ -33,8 +33,8 @@ public function interfaces(): void
user: 'bar',
channel: 'foo',
);
- self::assertInstanceOf(SerializableCommandInterface::class, $command);
- self::assertInstanceOf(CommandInterface::class, $command);
+ $this->assertInstanceOf(SerializableCommandInterface::class, $command);
+ $this->assertInstanceOf(CommandInterface::class, $command);
}
#[Test]
@@ -44,9 +44,9 @@ public function constructor(): void
user: 'bar',
channel: 'foo',
);
- self::assertEquals(Method::UNSUBSCRIBE, $command->getMethod());
- self::assertEquals(['channel' => 'foo', 'user' => 'bar'], $command->getParams());
- self::assertEquals(['foo'], $command->getChannels());
+ $this->assertEquals(Method::UNSUBSCRIBE, $command->getMethod());
+ $this->assertEquals(['channel' => 'foo', 'user' => 'bar'], $command->getParams());
+ $this->assertEquals(['foo'], $command->getChannels());
}
#[Test]
@@ -56,14 +56,14 @@ public function serializationRequiredData(): void
user: 'bar',
channel: 'foo',
);
- self::assertJsonStringEqualsJsonString(
+ $this->assertJsonStringEqualsJsonString(
<<<'JSON'
{
"channel": "foo",
"user": "bar"
}
JSON,
- \json_encode($command, \JSON_THROW_ON_ERROR | \JSON_FORCE_OBJECT)
+ \json_encode($command, \JSON_THROW_ON_ERROR | \JSON_FORCE_OBJECT),
);
}
@@ -76,7 +76,7 @@ public function serializationAllData(): void
client: 'abc',
session: 'qwerty',
);
- self::assertJsonStringEqualsJsonString(
+ $this->assertJsonStringEqualsJsonString(
<<<'JSON'
{
"channel": "foo",
@@ -85,7 +85,7 @@ public function serializationAllData(): void
"session": "qwerty"
}
JSON,
- \json_encode($command, \JSON_THROW_ON_ERROR | \JSON_FORCE_OBJECT)
+ \json_encode($command, \JSON_THROW_ON_ERROR | \JSON_FORCE_OBJECT),
);
}
}
diff --git a/Tests/Service/CentrifugoCheckerTest.php b/Tests/Service/CentrifugoCheckerTest.php
index d659715..4492d9c 100755
--- a/Tests/Service/CentrifugoCheckerTest.php
+++ b/Tests/Service/CentrifugoCheckerTest.php
@@ -27,9 +27,7 @@
*/
final class CentrifugoCheckerTest extends TestCase
{
- /** @var ResponseInterface|MockObject */
private ResponseInterface|MockObject $response;
-
private CentrifugoChecker $centrifugoChecker;
protected function setUp(): void
@@ -67,14 +65,14 @@ public function invalidChannelNameLength(): void
#[Test]
public function validChannelName(): void
{
- self::assertTrue($this->centrifugoChecker->assertValidChannelName('1234567890'));
+ $this->assertTrue($this->centrifugoChecker->assertValidChannelName('1234567890'));
}
#[Test]
public function invalidResponseStatusCode(): void
{
$this->response
- ->expects(self::once())
+ ->expects($this->once())
->method('getStatusCode')
->willReturn(500)
;
@@ -89,7 +87,7 @@ public function invalidResponseStatusCode(): void
public function validResponseStatusCode(): void
{
$this->response
- ->expects(self::once())
+ ->expects($this->once())
->method('getStatusCode')
->willReturn(200)
;
@@ -101,7 +99,7 @@ public function validResponseStatusCode(): void
public function invalidResponseHeaders(): void
{
$this->response
- ->expects(self::once())
+ ->expects($this->once())
->method('getHeaders')
->with(false)
->willReturn([])
@@ -117,7 +115,7 @@ public function invalidResponseHeaders(): void
public function validResponseHeaders(): void
{
$this->response
- ->expects(self::once())
+ ->expects($this->once())
->method('getHeaders')
->with(false)
->willReturn(['content-type' => []])
@@ -130,7 +128,7 @@ public function validResponseHeaders(): void
public function invalidResponseContentType(): void
{
$this->response
- ->expects(self::once())
+ ->expects($this->once())
->method('getHeaders')
->with(false)
->willReturn(['content-type' => ['text/html']])
@@ -146,7 +144,7 @@ public function invalidResponseContentType(): void
public function validResponseContentType(): void
{
$this->response
- ->expects(self::once())
+ ->expects($this->once())
->method('getHeaders')
->with(false)
->willReturn(['content-type' => ['application/json']])
diff --git a/Tests/Service/CentrifugoTest.php b/Tests/Service/CentrifugoTest.php
index 51cd634..33ea8e8 100755
--- a/Tests/Service/CentrifugoTest.php
+++ b/Tests/Service/CentrifugoTest.php
@@ -36,24 +36,12 @@ final class CentrifugoTest extends TestCase
{
use ConsecutiveParams;
- /** @var HttpClientInterface|MockObject */
private HttpClientInterface|MockObject $httpClient;
-
- /** @var ResponseInterface|MockObject */
private ResponseInterface|MockObject $response;
-
- /** @var ResponseProcessor|MockObject */
private ResponseProcessor|MockObject $responseProcessor;
-
- /** @var CommandHistoryLogger|MockObject */
private CommandHistoryLogger|MockObject $commandHistoryLogger;
-
- /** @var CentrifugoChecker|MockObject */
private CentrifugoChecker|MockObject $centrifugoChecker;
-
- /** @var Profiler|MockObject */
private Profiler|MockObject $profiler;
-
private Centrifugo $centrifugo;
protected function setUp(): void
@@ -71,7 +59,7 @@ protected function setUp(): void
$this->responseProcessor,
$this->commandHistoryLogger,
$this->centrifugoChecker,
- $this->profiler
+ $this->profiler,
);
}
@@ -92,26 +80,26 @@ protected function tearDown(): void
public function publishCommand(): void
{
$this->centrifugoChecker
- ->expects(self::once())
+ ->expects($this->once())
->method('assertValidChannelName')
->with('channelA')
;
$this->httpClient
- ->expects(self::once())
+ ->expects($this->once())
->method('request')
->willReturn($this->response)
;
$this->commandHistoryLogger
- ->expects(self::once())
+ ->expects($this->once())
->method('increaseRequestsCount')
;
$this->responseProcessor
- ->expects(self::once())
+ ->expects($this->once())
->method('processResponse')
- ->with(self::isInstanceOf(Model\PublishCommand::class), $this->response)
+ ->with($this->isInstanceOf(Model\PublishCommand::class), $this->response)
->willReturn(null)
;
@@ -128,7 +116,7 @@ public function publishCommand(): void
public function broadcastCommand(): void
{
$this->centrifugoChecker
- ->expects(self::exactly(2))
+ ->expects($this->exactly(2))
->method('assertValidChannelName')
->with(...self::withConsecutive(
['channelA'],
@@ -137,20 +125,20 @@ public function broadcastCommand(): void
;
$this->httpClient
- ->expects(self::once())
+ ->expects($this->once())
->method('request')
->willReturn($this->response)
;
$this->commandHistoryLogger
- ->expects(self::once())
+ ->expects($this->once())
->method('increaseRequestsCount')
;
$this->responseProcessor
- ->expects(self::once())
+ ->expects($this->once())
->method('processResponse')
- ->with(self::isInstanceOf(Model\BroadcastCommand::class), $this->response)
+ ->with($this->isInstanceOf(Model\BroadcastCommand::class), $this->response)
->willReturn(null)
;
@@ -167,26 +155,26 @@ public function broadcastCommand(): void
public function unsubscribeCommand(): void
{
$this->centrifugoChecker
- ->expects(self::once())
+ ->expects($this->once())
->method('assertValidChannelName')
->with('channelA')
;
$this->httpClient
- ->expects(self::once())
+ ->expects($this->once())
->method('request')
->willReturn($this->response)
;
$this->commandHistoryLogger
- ->expects(self::once())
+ ->expects($this->once())
->method('increaseRequestsCount')
;
$this->responseProcessor
- ->expects(self::once())
+ ->expects($this->once())
->method('processResponse')
- ->with(self::isInstanceOf(Model\UnsubscribeCommand::class), $this->response)
+ ->with($this->isInstanceOf(Model\UnsubscribeCommand::class), $this->response)
->willReturn(null)
;
@@ -202,26 +190,26 @@ public function unsubscribeCommand(): void
public function subscribeCommand(): void
{
$this->centrifugoChecker
- ->expects(self::once())
+ ->expects($this->once())
->method('assertValidChannelName')
->with('channelA')
;
$this->httpClient
- ->expects(self::once())
+ ->expects($this->once())
->method('request')
->willReturn($this->response)
;
$this->commandHistoryLogger
- ->expects(self::once())
+ ->expects($this->once())
->method('increaseRequestsCount')
;
$this->responseProcessor
- ->expects(self::once())
+ ->expects($this->once())
->method('processResponse')
- ->with(self::isInstanceOf(Model\SubscribeCommand::class), $this->response)
+ ->with($this->isInstanceOf(Model\SubscribeCommand::class), $this->response)
->willReturn(null)
;
@@ -249,25 +237,25 @@ public function subscribeCommand(): void
public function disconnectCommand(): void
{
$this->centrifugoChecker
- ->expects(self::never())
+ ->expects($this->never())
->method('assertValidChannelName')
;
$this->httpClient
- ->expects(self::once())
+ ->expects($this->once())
->method('request')
->willReturn($this->response)
;
$this->commandHistoryLogger
- ->expects(self::once())
+ ->expects($this->once())
->method('increaseRequestsCount')
;
$this->responseProcessor
- ->expects(self::once())
+ ->expects($this->once())
->method('processResponse')
- ->with(self::isInstanceOf(Model\DisconnectCommand::class), $this->response)
+ ->with($this->isInstanceOf(Model\DisconnectCommand::class), $this->response)
->willReturn(null)
;
@@ -284,25 +272,25 @@ public function disconnectCommand(): void
public function refreshCommand(): void
{
$this->centrifugoChecker
- ->expects(self::never())
+ ->expects($this->never())
->method('assertValidChannelName')
;
$this->httpClient
- ->expects(self::once())
+ ->expects($this->once())
->method('request')
->willReturn($this->response)
;
$this->commandHistoryLogger
- ->expects(self::once())
+ ->expects($this->once())
->method('increaseRequestsCount')
;
$this->responseProcessor
- ->expects(self::once())
+ ->expects($this->once())
->method('processResponse')
- ->with(self::isInstanceOf(Model\RefreshCommand::class), $this->response)
+ ->with($this->isInstanceOf(Model\RefreshCommand::class), $this->response)
->willReturn(null)
;
@@ -319,26 +307,26 @@ public function refreshCommand(): void
public function presenceCommand(): void
{
$this->centrifugoChecker
- ->expects(self::once())
+ ->expects($this->once())
->method('assertValidChannelName')
->with('channelA')
;
$this->httpClient
- ->expects(self::once())
+ ->expects($this->once())
->method('request')
->willReturn($this->response)
;
$this->commandHistoryLogger
- ->expects(self::once())
+ ->expects($this->once())
->method('increaseRequestsCount')
;
$this->responseProcessor
- ->expects(self::once())
+ ->expects($this->once())
->method('processResponse')
- ->with(self::isInstanceOf(Model\PresenceCommand::class), $this->response)
+ ->with($this->isInstanceOf(Model\PresenceCommand::class), $this->response)
->willReturn([])
;
@@ -349,26 +337,26 @@ public function presenceCommand(): void
public function presenceStatsCommand(): void
{
$this->centrifugoChecker
- ->expects(self::once())
+ ->expects($this->once())
->method('assertValidChannelName')
->with('channelA')
;
$this->httpClient
- ->expects(self::once())
+ ->expects($this->once())
->method('request')
->willReturn($this->response)
;
$this->commandHistoryLogger
- ->expects(self::once())
+ ->expects($this->once())
->method('increaseRequestsCount')
;
$this->responseProcessor
- ->expects(self::once())
+ ->expects($this->once())
->method('processResponse')
- ->with(self::isInstanceOf(Model\PresenceStatsCommand::class), $this->response)
+ ->with($this->isInstanceOf(Model\PresenceStatsCommand::class), $this->response)
->willReturn([])
;
@@ -379,26 +367,26 @@ public function presenceStatsCommand(): void
public function historyCommand(): void
{
$this->centrifugoChecker
- ->expects(self::once())
+ ->expects($this->once())
->method('assertValidChannelName')
->with('channelA')
;
$this->httpClient
- ->expects(self::once())
+ ->expects($this->once())
->method('request')
->willReturn($this->response)
;
$this->commandHistoryLogger
- ->expects(self::once())
+ ->expects($this->once())
->method('increaseRequestsCount')
;
$this->responseProcessor
- ->expects(self::once())
+ ->expects($this->once())
->method('processResponse')
- ->with(self::isInstanceOf(Model\HistoryCommand::class), $this->response)
+ ->with($this->isInstanceOf(Model\HistoryCommand::class), $this->response)
->willReturn([])
;
@@ -414,26 +402,26 @@ public function historyCommand(): void
public function historyRemoveCommand(): void
{
$this->centrifugoChecker
- ->expects(self::once())
+ ->expects($this->once())
->method('assertValidChannelName')
->with('channelA')
;
$this->httpClient
- ->expects(self::once())
+ ->expects($this->once())
->method('request')
->willReturn($this->response)
;
$this->commandHistoryLogger
- ->expects(self::once())
+ ->expects($this->once())
->method('increaseRequestsCount')
;
$this->responseProcessor
- ->expects(self::once())
+ ->expects($this->once())
->method('processResponse')
- ->with(self::isInstanceOf(Model\HistoryRemoveCommand::class), $this->response)
+ ->with($this->isInstanceOf(Model\HistoryRemoveCommand::class), $this->response)
->willReturn(null)
;
@@ -444,25 +432,25 @@ public function historyRemoveCommand(): void
public function channelsCommand(): void
{
$this->centrifugoChecker
- ->expects(self::never())
+ ->expects($this->never())
->method('assertValidChannelName')
;
$this->httpClient
- ->expects(self::once())
+ ->expects($this->once())
->method('request')
->willReturn($this->response)
;
$this->commandHistoryLogger
- ->expects(self::once())
+ ->expects($this->once())
->method('increaseRequestsCount')
;
$this->responseProcessor
- ->expects(self::once())
+ ->expects($this->once())
->method('processResponse')
- ->with(self::isInstanceOf(Model\ChannelsCommand::class), $this->response)
+ ->with($this->isInstanceOf(Model\ChannelsCommand::class), $this->response)
->willReturn([])
;
@@ -473,25 +461,25 @@ public function channelsCommand(): void
public function infoCommand(): void
{
$this->centrifugoChecker
- ->expects(self::never())
+ ->expects($this->never())
->method('assertValidChannelName')
;
$this->httpClient
- ->expects(self::once())
+ ->expects($this->once())
->method('request')
->willReturn($this->response)
;
$this->commandHistoryLogger
- ->expects(self::once())
+ ->expects($this->once())
->method('increaseRequestsCount')
;
$this->responseProcessor
- ->expects(self::once())
+ ->expects($this->once())
->method('processResponse')
- ->with(self::isInstanceOf(Model\InfoCommand::class), $this->response)
+ ->with($this->isInstanceOf(Model\InfoCommand::class), $this->response)
->willReturn([])
;
@@ -502,7 +490,7 @@ public function infoCommand(): void
public function batchRequest(): void
{
$this->centrifugoChecker
- ->expects(self::exactly(2))
+ ->expects($this->exactly(2))
->method('assertValidChannelName')
->with(
...self::withConsecutive(
@@ -513,20 +501,20 @@ public function batchRequest(): void
;
$this->httpClient
- ->expects(self::once())
+ ->expects($this->once())
->method('request')
->willReturn($this->response)
;
$this->commandHistoryLogger
- ->expects(self::once())
+ ->expects($this->once())
->method('increaseRequestsCount')
;
$this->responseProcessor
- ->expects(self::once())
+ ->expects($this->once())
->method('processResponse')
- ->with(self::isInstanceOf(Model\BatchRequest::class), $this->response)
+ ->with($this->isInstanceOf(Model\BatchRequest::class), $this->response)
->willReturn([])
;
diff --git a/Tests/Service/ChannelAuthenticator/PrivateChannelAuthenticatorTest.php b/Tests/Service/ChannelAuthenticator/PrivateChannelAuthenticatorTest.php
index e3a88ed..2cbd433 100755
--- a/Tests/Service/ChannelAuthenticator/PrivateChannelAuthenticatorTest.php
+++ b/Tests/Service/ChannelAuthenticator/PrivateChannelAuthenticatorTest.php
@@ -32,15 +32,9 @@ final class PrivateChannelAuthenticatorTest extends TestCase
{
use ConsecutiveParams;
- /** @var Request|MockObject */
private Request|MockObject $request;
-
- /** @var ChannelAuthenticatorInterface|MockObject */
private ChannelAuthenticatorInterface|MockObject $customerChannelAuthenticator;
-
- /** @var CredentialsGenerator|MockObject */
private CredentialsGenerator|MockObject $credentialsGenerator;
-
private PrivateChannelAuthenticator $privateChannelAuthenticator;
protected function setUp(): void
@@ -50,7 +44,7 @@ protected function setUp(): void
$this->customerChannelAuthenticator = $this->createMock(ChannelAuthenticatorInterface::class);
$this->privateChannelAuthenticator = new PrivateChannelAuthenticator(
$this->credentialsGenerator,
- [$this->customerChannelAuthenticator]
+ [$this->customerChannelAuthenticator],
);
}
@@ -68,20 +62,20 @@ protected function tearDown(): void
public function invalidJsonRequest(): void
{
$this->request
- ->expects(self::once())
+ ->expects($this->once())
->method('getContent')
->willReturn('bla bla')
;
$this->customerChannelAuthenticator
- ->expects(self::never())
+ ->expects($this->never())
->method('supports')
;
$this->expectException(BadRequestHttpException::class);
$this->expectExceptionMessage('Invalid JSON.');
- self::assertEquals(['channels' => []], $this->privateChannelAuthenticator->authChannelsForClientFromRequest($this->request));
+ $this->assertEquals(['channels' => []], $this->privateChannelAuthenticator->authChannelsForClientFromRequest($this->request));
}
#[Test]
@@ -89,20 +83,20 @@ public function invalidJsonRequest(): void
public function testInvalidClientInRequest(string $content): void
{
$this->request
- ->expects(self::once())
+ ->expects($this->once())
->method('getContent')
->willReturn($content)
;
$this->customerChannelAuthenticator
- ->expects(self::never())
+ ->expects($this->never())
->method('supports')
;
$this->expectException(BadRequestHttpException::class);
$this->expectExceptionMessage('Client must be set in request.');
- self::assertEquals(['channels' => []], $this->privateChannelAuthenticator->authChannelsForClientFromRequest($this->request));
+ $this->assertEquals(['channels' => []], $this->privateChannelAuthenticator->authChannelsForClientFromRequest($this->request));
}
public static function dataProviderForTestInvalidClientInRequest(): iterable
@@ -147,20 +141,20 @@ public static function dataProviderForTestInvalidClientInRequest(): iterable
public function testInvalidChannelsInRequest(string $content): void
{
$this->request
- ->expects(self::once())
+ ->expects($this->once())
->method('getContent')
->willReturn($content)
;
$this->customerChannelAuthenticator
- ->expects(self::never())
+ ->expects($this->never())
->method('supports')
;
$this->expectException(BadRequestHttpException::class);
$this->expectExceptionMessage('Channels must be set in request.');
- self::assertEquals(['channels' => []], $this->privateChannelAuthenticator->authChannelsForClientFromRequest($this->request));
+ $this->assertEquals(['channels' => []], $this->privateChannelAuthenticator->authChannelsForClientFromRequest($this->request));
}
public static function dataProviderForTestInvalidChannelsInRequest(): iterable
@@ -196,7 +190,7 @@ public static function dataProviderForTestInvalidChannelsInRequest(): iterable
public function nonStringChannelInRequest(): void
{
$this->request
- ->expects(self::once())
+ ->expects($this->once())
->method('getContent')
->willReturn(<<<'JSON'
{
@@ -207,41 +201,41 @@ public function nonStringChannelInRequest(): void
;
$this->customerChannelAuthenticator
- ->expects(self::never())
+ ->expects($this->never())
->method('supports')
;
$this->expectException(BadRequestHttpException::class);
$this->expectExceptionMessage('Channel must be a string.');
- self::assertEquals(['channels' => []], $this->privateChannelAuthenticator->authChannelsForClientFromRequest($this->request));
+ $this->assertEquals(['channels' => []], $this->privateChannelAuthenticator->authChannelsForClientFromRequest($this->request));
}
#[Test]
public function exceptionOnGetContent(): void
{
$this->request
- ->expects(self::once())
+ ->expects($this->once())
->method('getContent')
->willThrowException(new \Exception('test'))
;
$this->customerChannelAuthenticator
- ->expects(self::never())
+ ->expects($this->never())
->method('supports')
;
$this->expectException(\Exception::class);
$this->expectExceptionMessage('test');
- self::assertEquals(['channels' => []], $this->privateChannelAuthenticator->authChannelsForClientFromRequest($this->request));
+ $this->assertEquals(['channels' => []], $this->privateChannelAuthenticator->authChannelsForClientFromRequest($this->request));
}
#[Test]
public function noChannelAuthenticator(): void
{
$this->request
- ->expects(self::once())
+ ->expects($this->once())
->method('getContent')
->willReturn(<<<'JSON'
{
@@ -252,20 +246,20 @@ public function noChannelAuthenticator(): void
;
$this->customerChannelAuthenticator
- ->expects(self::once())
+ ->expects($this->once())
->method('supports')
->with('avengers')
->willReturn(false)
;
- self::assertEquals(['channels' => []], $this->privateChannelAuthenticator->authChannelsForClientFromRequest($this->request));
+ $this->assertEquals(['channels' => []], $this->privateChannelAuthenticator->authChannelsForClientFromRequest($this->request));
}
#[Test]
public function successChannelAuthenticator(): void
{
$this->request
- ->expects(self::once())
+ ->expects($this->once())
->method('getContent')
->willReturn(<<<'JSON'
{
@@ -276,7 +270,7 @@ public function successChannelAuthenticator(): void
;
$this->customerChannelAuthenticator
- ->expects(self::exactly(2))
+ ->expects($this->exactly(2))
->method('supports')
->with(
...self::withConsecutive(
@@ -288,7 +282,7 @@ public function successChannelAuthenticator(): void
;
$this->customerChannelAuthenticator
- ->expects(self::exactly(2))
+ ->expects($this->exactly(2))
->method('hasAccessToChannel')
->with(
...self::withConsecutive(
@@ -300,7 +294,7 @@ public function successChannelAuthenticator(): void
;
$this->credentialsGenerator
- ->expects(self::exactly(2))
+ ->expects($this->exactly(2))
->method('generateJwtTokenForPrivateChannel')
->with(
...self::withConsecutive(
@@ -311,7 +305,7 @@ public function successChannelAuthenticator(): void
->willReturnOnConsecutiveCalls('test1', 'test2')
;
- self::assertEquals(
+ $this->assertEquals(
[
'channels' => [
[
diff --git a/Tests/Service/Credentials/CredentialsGeneratorTest.php b/Tests/Service/Credentials/CredentialsGeneratorTest.php
index 76caa28..f0cbad7 100755
--- a/Tests/Service/Credentials/CredentialsGeneratorTest.php
+++ b/Tests/Service/Credentials/CredentialsGeneratorTest.php
@@ -31,12 +31,8 @@
*/
final class CredentialsGeneratorTest extends TestCase
{
- /** @var JwtGenerator|MockObject */
private JwtGenerator|MockObject $jwtGenerator;
-
- /** @var DateTimeHelper|MockObject */
private DateTimeHelper|MockObject $dateTimeHelper;
-
private CredentialsGenerator $credentialsGenerator;
protected function setUp(): void
@@ -59,15 +55,15 @@ protected function tearDown(): void
public function generateJwtTokenForAnonymous(): void
{
$this->dateTimeHelper
- ->expects(self::once())
+ ->expects($this->once())
->method('getCurrentDatetimeUtc')
->willReturn(new \DateTime('2000-01-01 00:00:00', new \DateTimeZone('UTC')))
;
$this->jwtGenerator
- ->expects(self::once())
+ ->expects($this->once())
->method('generateToken')
- ->with(self::callback(static function (JwtPayload $jwtPayload) {
+ ->with($this->callback(static function (JwtPayload $jwtPayload) {
return '' === $jwtPayload->getSubject()
&& [] === $jwtPayload->getInfo()
&& [] === $jwtPayload->getMeta()
@@ -79,39 +75,39 @@ public function generateJwtTokenForAnonymous(): void
->willReturn('test1')
;
- self::assertEquals('test1', $this->credentialsGenerator->generateJwtTokenForAnonymous());
+ $this->assertEquals('test1', $this->credentialsGenerator->generateJwtTokenForAnonymous());
}
#[Test]
public function generateJwtTokenForUser(): void
{
$this->dateTimeHelper
- ->expects(self::once())
+ ->expects($this->once())
->method('getCurrentDatetimeUtc')
->willReturn(new \DateTime('2000-02-02 00:00:00', new \DateTimeZone('UTC')))
;
$user = $this->createMock(CentrifugoUserInterface::class);
$user
- ->expects(self::once())
+ ->expects($this->once())
->method('getCentrifugoSubject')
->willReturn('spiderman')
;
$user
- ->expects(self::once())
+ ->expects($this->once())
->method('getCentrifugoUserInfo')
->willReturn(
[
'name' => 'Peter Parker',
'email' => 'spiderman@marvel.com',
- ]
+ ],
)
;
$this->jwtGenerator
- ->expects(self::once())
+ ->expects($this->once())
->method('generateToken')
- ->with(self::callback(static function (JwtPayload $jwtPayload) {
+ ->with($this->callback(static function (JwtPayload $jwtPayload) {
return 'spiderman' === $jwtPayload->getSubject()
&& ['name' => 'Peter Parker', 'email' => 'spiderman@marvel.com'] === $jwtPayload->getInfo()
&& 949449610 === $jwtPayload->getExpirationTime() // 2000-02-02 00:00:10
@@ -122,26 +118,26 @@ public function generateJwtTokenForUser(): void
->willReturn('test2')
;
- self::assertEquals('test2', $this->credentialsGenerator->generateJwtTokenForUser($user, 'qwerty', ['channelA']));
+ $this->assertEquals('test2', $this->credentialsGenerator->generateJwtTokenForUser($user, 'qwerty', ['channelA']));
}
#[Test]
public function generateJwtTokenForUserWithMeta(): void
{
$this->dateTimeHelper
- ->expects(self::once())
+ ->expects($this->once())
->method('getCurrentDatetimeUtc')
->willReturn(new \DateTime('2000-02-02 00:00:00', new \DateTimeZone('UTC')))
;
$user = $this->createMock(CentrifugoUserMetaInterface::class);
$user
- ->expects(self::once())
+ ->expects($this->once())
->method('getCentrifugoSubject')
->willReturn('spiderman')
;
$user
- ->expects(self::once())
+ ->expects($this->once())
->method('getCentrifugoUserInfo')
->willReturn(
[
@@ -151,7 +147,7 @@ public function generateJwtTokenForUserWithMeta(): void
)
;
$user
- ->expects(self::once())
+ ->expects($this->once())
->method('getCentrifugoUserMeta')
->willReturn(
[
@@ -161,9 +157,9 @@ public function generateJwtTokenForUserWithMeta(): void
;
$this->jwtGenerator
- ->expects(self::once())
+ ->expects($this->once())
->method('generateToken')
- ->with(self::callback(static function (JwtPayload $jwtPayload) {
+ ->with($this->callback(static function (JwtPayload $jwtPayload) {
return 'spiderman' === $jwtPayload->getSubject()
&& ['name' => 'Peter Parker', 'email' => 'spiderman@marvel.com'] === $jwtPayload->getInfo()
&& ['foo' => 'bar'] === $jwtPayload->getMeta()
@@ -175,22 +171,22 @@ public function generateJwtTokenForUserWithMeta(): void
->willReturn('test2')
;
- self::assertEquals('test2', $this->credentialsGenerator->generateJwtTokenForUser($user, 'qwerty', ['channelA']));
+ $this->assertEquals('test2', $this->credentialsGenerator->generateJwtTokenForUser($user, 'qwerty', ['channelA']));
}
#[Test]
public function generateJwtTokenForPrivateChannel(): void
{
$this->dateTimeHelper
- ->expects(self::once())
+ ->expects($this->once())
->method('getCurrentDatetimeUtc')
->willReturn(new \DateTime('2000-03-03 00:00:00', new \DateTimeZone('UTC')))
;
$this->jwtGenerator
- ->expects(self::once())
+ ->expects($this->once())
->method('generateToken')
- ->with(self::callback(static function (JwtPayloadForPrivateChannel $jwtPayloadForPrivateChannel) {
+ ->with($this->callback(static function (JwtPayloadForPrivateChannel $jwtPayloadForPrivateChannel) {
return 'spiderman' === $jwtPayloadForPrivateChannel->getClient()
&& 'avengers' === $jwtPayloadForPrivateChannel->getChannel()
&& [] === $jwtPayloadForPrivateChannel->getInfo()
@@ -203,29 +199,29 @@ public function generateJwtTokenForPrivateChannel(): void
->willReturn('test3')
;
- self::assertEquals('test3', $this->credentialsGenerator->generateJwtTokenForPrivateChannel('spiderman', 'avengers', null, true));
+ $this->assertEquals('test3', $this->credentialsGenerator->generateJwtTokenForPrivateChannel('spiderman', 'avengers', null, true));
}
#[Test]
public function generateJwtTokenForChannel(): void
{
$this->dateTimeHelper
- ->expects(self::once())
+ ->expects($this->once())
->method('getCurrentDatetimeUtc')
->willReturn(new \DateTime('2000-03-03 00:00:00', new \DateTimeZone('UTC')))
;
$user = $this->createMock(CentrifugoUserInterface::class);
$user
- ->expects(self::once())
+ ->expects($this->once())
->method('getCentrifugoSubject')
->willReturn('spiderman')
;
$this->jwtGenerator
- ->expects(self::once())
+ ->expects($this->once())
->method('generateToken')
- ->with(self::callback(static function (JwtPayloadForChannel $jwtPayloadForChannel) {
+ ->with($this->callback(static function (JwtPayloadForChannel $jwtPayloadForChannel) {
return 'spiderman' === $jwtPayloadForChannel->getSubject()
&& 'avengers' === $jwtPayloadForChannel->getChannel()
&& [] === $jwtPayloadForChannel->getInfo()
@@ -243,6 +239,6 @@ public function generateJwtTokenForChannel(): void
->willReturn('test4')
;
- self::assertEquals('test4', $this->credentialsGenerator->generateJwtTokenForChannel($user, 'avengers'));
+ $this->assertEquals('test4', $this->credentialsGenerator->generateJwtTokenForChannel($user, 'avengers'));
}
}
diff --git a/Tests/Service/FakeCentrifugoTest.php b/Tests/Service/FakeCentrifugoTest.php
index 1e8dafc..1a4b3f8 100755
--- a/Tests/Service/FakeCentrifugoTest.php
+++ b/Tests/Service/FakeCentrifugoTest.php
@@ -47,21 +47,21 @@ public function allMethods(): void
$this->centrifugo->disconnect('user123');
$this->centrifugo->subscribe('user123', 'channelA');
$this->centrifugo->refresh('user123');
- self::assertSame([], $this->centrifugo->presence('channelA'));
- self::assertSame([], $this->centrifugo->presenceStats('channelA'));
- self::assertSame([], $this->centrifugo->history('channelA'));
+ $this->assertSame([], $this->centrifugo->presence('channelA'));
+ $this->assertSame([], $this->centrifugo->presenceStats('channelA'));
+ $this->assertSame([], $this->centrifugo->history('channelA'));
$this->centrifugo->historyRemove('channelA');
- self::assertSame([], $this->centrifugo->channels());
- self::assertSame([], $this->centrifugo->channels('pattern'));
- self::assertSame([], $this->centrifugo->info());
- self::assertSame(
+ $this->assertSame([], $this->centrifugo->channels());
+ $this->assertSame([], $this->centrifugo->channels('pattern'));
+ $this->assertSame([], $this->centrifugo->info());
+ $this->assertSame(
[],
$this->centrifugo->batchRequest(
[
new Model\PublishCommand([], 'channelA'),
new Model\PublishCommand([], 'channelB'),
- ]
- )
+ ],
+ ),
);
}
}
diff --git a/Tests/Service/Jwt/JwtGeneratorTest.php b/Tests/Service/Jwt/JwtGeneratorTest.php
index 5a38923..9a96582 100755
--- a/Tests/Service/Jwt/JwtGeneratorTest.php
+++ b/Tests/Service/Jwt/JwtGeneratorTest.php
@@ -53,10 +53,10 @@ public function generateTokenForAllClaims(): void
],
123,
'test',
- ['avengers']
+ ['avengers'],
);
- self::assertEquals(
+ $this->assertEquals(
'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJzcGlkZXJtYW4iLCJleHAiOjEyMywiaW5mbyI6eyJuYW1lIjoiUGV0ZXIgUGFya2VyIiwiZW1haWwiOiJzcGlkZXJtYW5AbWFydmVsLmNvbSJ9LCJtZXRhIjp7ImZvbyI6ImJhciJ9LCJiNjRpbmZvIjoidGVzdCIsImNoYW5uZWxzIjpbImF2ZW5nZXJzIl19.4GtuKq_znrDoZ9zINRK0BoAJm13Hf1Rp4iR1RHfMNPQ',
$this->jwtGenerator->generateToken($jwtPayload)
);
@@ -67,9 +67,9 @@ public function generateTokenForOnlyRequiredClaims(): void
{
$jwtPayload = new JwtPayload('spiderman');
- self::assertSame(
+ $this->assertSame(
'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJzcGlkZXJtYW4ifQ.L9EM5Iw3MKRNnEPnWiBf_CLDtSmjG5dprKx28XPBdm4',
- $this->jwtGenerator->generateToken($jwtPayload)
+ $this->jwtGenerator->generateToken($jwtPayload),
);
}
@@ -88,12 +88,12 @@ public function generateTokenForPrivateChannelForAllClaims(): void
],
123,
'test',
- true
+ true,
);
- self::assertEquals(
+ $this->assertEquals(
'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJjbGllbnQiOiJzcGlkZXJtYW4iLCJjaGFubmVsIjoiYXZlbmdlcnMiLCJleHAiOjEyMywiaW5mbyI6eyJuYW1lIjoiUGV0ZXIgUGFya2VyIiwiZW1haWwiOiJzcGlkZXJtYW5AbWFydmVsLmNvbSJ9LCJtZXRhIjp7ImZvbyI6ImJhciJ9LCJiNjRpbmZvIjoidGVzdCIsImV0byI6dHJ1ZX0.UKYGy0wlUFrWL6dkQhPsS4I4NTUh1NlpI8tYULW1ZbM',
- $this->jwtGenerator->generateToken($jwtPayloadForPrivateChannel)
+ $this->jwtGenerator->generateToken($jwtPayloadForPrivateChannel),
);
}
@@ -102,9 +102,9 @@ public function generateTokenForPrivateChannelForOnlyRequiredClaims(): void
{
$jwtPayloadForPrivateChannel = new JwtPayloadForPrivateChannel('spiderman', 'avengers');
- self::assertSame(
+ $this->assertSame(
'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJjbGllbnQiOiJzcGlkZXJtYW4iLCJjaGFubmVsIjoiYXZlbmdlcnMifQ.x2UWWlh823m_EelPCSuoIuik0s4DuYRX9_vRhXEVaeQ',
- $this->jwtGenerator->generateToken($jwtPayloadForPrivateChannel)
+ $this->jwtGenerator->generateToken($jwtPayloadForPrivateChannel),
);
}
@@ -128,12 +128,12 @@ public function generateTokenForChannelForAllClaims(): void
'issuer',
456,
'jwtId',
- new JwtPayloadForChannelOverride(true, false, true, false, true)
+ new JwtPayloadForChannelOverride(true, false, true, false, true),
);
- self::assertEquals(
+ $this->assertEquals(
'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJzcGlkZXJtYW4iLCJjaGFubmVsIjoiYXZlbmdlcnMiLCJpbmZvIjp7Im5hbWUiOiJQZXRlciBQYXJrZXIiLCJlbWFpbCI6InNwaWRlcm1hbkBtYXJ2ZWwuY29tIn0sIm1ldGEiOnsiZm9vIjoiYmFyIn0sImI2NGluZm8iOiJ0ZXN0IiwiZXhwIjoxMjMsImV4cGlyZV9hdCI6MzIxLCJhdWQiOlsiYXVkaWVuY2UiXSwiaXNzIjoiaXNzdWVyIiwiaWF0Ijo0NTYsImp0aSI6Imp3dElkIiwib3ZlcnJpZGUiOnsicHJlc2VuY2UiOnsidmFsdWUiOnRydWV9LCJqb2luX2xlYXZlIjp7InZhbHVlIjpmYWxzZX0sImZvcmNlX3B1c2hfam9pbl9sZWF2ZSI6eyJ2YWx1ZSI6dHJ1ZX0sImZvcmNlX3JlY292ZXJ5Ijp7InZhbHVlIjpmYWxzZX0sImZvcmNlX3Bvc3RpbmciOnsidmFsdWUiOnRydWV9fX0.NNULjr95eGRt-KMwKel8ZORjD4fyT1j1P5UiszbC-Zo',
- $this->jwtGenerator->generateToken($jwtPayloadForChannel)
+ $this->jwtGenerator->generateToken($jwtPayloadForChannel),
);
}
@@ -142,9 +142,9 @@ public function generateTokenForChannelForOnlyRequiredClaims(): void
{
$jwtPayloadForChannel = new JwtPayloadForChannel('spiderman', 'avengers');
- self::assertSame(
+ $this->assertSame(
'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJzcGlkZXJtYW4iLCJjaGFubmVsIjoiYXZlbmdlcnMifQ.OYI-kcfDwuE-V06M-jkIX1-Rvdna1l9PXdMkmc_BTGY',
- $this->jwtGenerator->generateToken($jwtPayloadForChannel)
+ $this->jwtGenerator->generateToken($jwtPayloadForChannel),
);
}
}
diff --git a/Tests/Service/ResponseProcessorTest.php b/Tests/Service/ResponseProcessorTest.php
index 55fb918..8869c17 100755
--- a/Tests/Service/ResponseProcessorTest.php
+++ b/Tests/Service/ResponseProcessorTest.php
@@ -40,18 +40,10 @@ final class ResponseProcessorTest extends TestCase
{
use ConsecutiveParams;
- /** @var ResponseInterface|MockObject */
private ResponseInterface|MockObject $response;
-
- /** @var CentrifugoChecker|MockObject */
private CentrifugoChecker|MockObject $centrifugoChecker;
-
- /** @var CommandHistoryLogger|MockObject */
private CommandHistoryLogger|MockObject $commandHistoryLogger;
-
- /** @var Profiler|MockObject */
private Profiler|MockObject $profiler;
-
private ResponseProcessor $responseProcessor;
protected function setUp(): void
@@ -63,7 +55,7 @@ protected function setUp(): void
$this->responseProcessor = new ResponseProcessor(
$this->centrifugoChecker,
$this->commandHistoryLogger,
- $this->profiler
+ $this->profiler,
);
}
@@ -82,23 +74,23 @@ protected function tearDown(): void
public function processingBatchRequest(): void
{
$this->centrifugoChecker
- ->expects(self::once())
+ ->expects($this->once())
->method('assertValidResponseStatusCode')
->with($this->response)
;
$this->centrifugoChecker
- ->expects(self::once())
+ ->expects($this->once())
->method('assertValidResponseHeaders')
->with($this->response)
;
$this->centrifugoChecker
- ->expects(self::once())
+ ->expects($this->once())
->method('assertValidResponseContentType')
->with($this->response)
;
$this->response
- ->expects(self::once())
+ ->expects($this->once())
->method('getContent')
->willReturn(<<<'JSON'
{
@@ -113,13 +105,13 @@ public function processingBatchRequest(): void
;
$this->commandHistoryLogger
- ->expects(self::exactly(3))
+ ->expects($this->exactly(3))
->method('logCommand')
->with(
...self::withConsecutive(
- [self::isInstanceOf(PublishCommand::class), true, null],
- [self::isInstanceOf(BroadcastCommand::class), true, null],
- [self::isInstanceOf(ChannelsCommand::class), true, ['chat', 'notification']],
+ [$this->isInstanceOf(PublishCommand::class), true, null],
+ [$this->isInstanceOf(BroadcastCommand::class), true, null],
+ [$this->isInstanceOf(ChannelsCommand::class), true, ['chat', 'notification']],
)
)
;
@@ -132,15 +124,15 @@ public function processingBatchRequest(): void
new ChannelsCommand(),
]
),
- $this->response
+ $this->response,
);
- self::assertSame(
+ $this->assertSame(
[
null,
null,
['chat', 'notification'],
],
- $result
+ $result,
);
}
@@ -148,7 +140,7 @@ public function processingBatchRequest(): void
public function logicException(): void
{
$this->response
- ->expects(self::once())
+ ->expects($this->once())
->method('getContent')
->willReturn(<<<'JSON'
{
@@ -171,7 +163,7 @@ public function logicException(): void
new ChannelsCommand(),
]
),
- $this->response
+ $this->response,
);
}
@@ -179,23 +171,23 @@ public function logicException(): void
public function processingResultableCommand(): void
{
$this->centrifugoChecker
- ->expects(self::once())
+ ->expects($this->once())
->method('assertValidResponseStatusCode')
->with($this->response)
;
$this->centrifugoChecker
- ->expects(self::once())
+ ->expects($this->once())
->method('assertValidResponseHeaders')
->with($this->response)
;
$this->centrifugoChecker
- ->expects(self::once())
+ ->expects($this->once())
->method('assertValidResponseContentType')
->with($this->response)
;
$this->response
- ->expects(self::once())
+ ->expects($this->once())
->method('getContent')
->willReturn(<<<'JSON'
["foo", "bar"]
@@ -206,36 +198,36 @@ public function processingResultableCommand(): void
$command = new ChannelsCommand();
$this->commandHistoryLogger
- ->expects(self::once())
+ ->expects($this->once())
->method('logCommand')
->with($command, true, ['foo', 'bar'])
;
$result = $this->responseProcessor->processResponse($command, $this->response);
- self::assertSame(['foo', 'bar'], $result);
+ $this->assertSame(['foo', 'bar'], $result);
}
#[Test]
public function processingNonResultableCommand(): void
{
$this->centrifugoChecker
- ->expects(self::once())
+ ->expects($this->once())
->method('assertValidResponseStatusCode')
->with($this->response)
;
$this->centrifugoChecker
- ->expects(self::once())
+ ->expects($this->once())
->method('assertValidResponseHeaders')
->with($this->response)
;
$this->centrifugoChecker
- ->expects(self::once())
+ ->expects($this->once())
->method('assertValidResponseContentType')
->with($this->response)
;
$this->response
- ->expects(self::once())
+ ->expects($this->once())
->method('getContent')
->willReturn(<<<'JSON'
{
@@ -252,20 +244,20 @@ public function processingNonResultableCommand(): void
$command = new PublishCommand(['foo' => 'bar'], 'test');
$this->commandHistoryLogger
- ->expects(self::once())
+ ->expects($this->once())
->method('logCommand')
->with($command, true, null)
;
$result = $this->responseProcessor->processResponse($command, $this->response);
- self::assertNull($result);
+ $this->assertNull($result);
}
#[Test]
public function invalidResponse(): void
{
$this->response
- ->expects(self::once())
+ ->expects($this->once())
->method('getContent')
->willReturn('invalid json')
;
@@ -275,7 +267,7 @@ public function invalidResponse(): void
$this->responseProcessor->processResponse(
$this->createStub(ResultableCommandInterface::class),
- $this->response
+ $this->response,
);
}
@@ -283,7 +275,7 @@ public function invalidResponse(): void
public function processingCentrifugoErrorForSingleCommand(): void
{
$this->response
- ->expects(self::once())
+ ->expects($this->once())
->method('getContent')
->willReturn('{"error":{"message":"test message","code":123}}')
;
@@ -291,7 +283,7 @@ public function processingCentrifugoErrorForSingleCommand(): void
$command = $this->createStub(CommandInterface::class);
$this->commandHistoryLogger
- ->expects(self::once())
+ ->expects($this->once())
->method('logCommand')
->with($command, false, ['error' => ['message' => 'test message', 'code' => '123']])
;
@@ -307,7 +299,7 @@ public function processingCentrifugoErrorForSingleCommand(): void
public function processingCentrifugoErrorForBatchRequest(): void
{
$this->response
- ->expects(self::once())
+ ->expects($this->once())
->method('getContent')
->willReturn(<<<'JSON'
{
@@ -322,13 +314,13 @@ public function processingCentrifugoErrorForBatchRequest(): void
;
$this->commandHistoryLogger
- ->expects(self::exactly(3))
+ ->expects($this->exactly(3))
->method('logCommand')
->with(
...self::withConsecutive(
- [self::isInstanceOf(PublishCommand::class), false, ['error' => ['message' => 'test message 2', 'code' => 456]]],
- [self::isInstanceOf(BroadcastCommand::class), true, null],
- [self::isInstanceOf(ChannelsCommand::class), true, ['chat', 'notification']],
+ [$this->isInstanceOf(PublishCommand::class), false, ['error' => ['message' => 'test message 2', 'code' => 456]]],
+ [$this->isInstanceOf(BroadcastCommand::class), true, null],
+ [$this->isInstanceOf(ChannelsCommand::class), true, ['chat', 'notification']],
)
)
;
@@ -345,7 +337,7 @@ public function processingCentrifugoErrorForBatchRequest(): void
new ChannelsCommand(),
]
),
- $this->response
+ $this->response,
);
}
}
diff --git a/Tests/Token/JwtPayloadForChannelTest.php b/Tests/Token/JwtPayloadForChannelTest.php
index 05bfa73..c361615 100755
--- a/Tests/Token/JwtPayloadForChannelTest.php
+++ b/Tests/Token/JwtPayloadForChannelTest.php
@@ -45,35 +45,35 @@ public function constructor(): void
new JwtPayloadForChannelOverride(true, false, true, false, true),
);
- self::assertInstanceOf(JwtPayloadForChannel::class, $jwtPayloadForChannel);
- self::assertSame('spiderman', $jwtPayloadForChannel->getSubject());
- self::assertSame('avengers', $jwtPayloadForChannel->getChannel());
- self::assertSame(
+ $this->assertInstanceOf(JwtPayloadForChannel::class, $jwtPayloadForChannel);
+ $this->assertSame('spiderman', $jwtPayloadForChannel->getSubject());
+ $this->assertSame('avengers', $jwtPayloadForChannel->getChannel());
+ $this->assertSame(
[
'name' => 'Peter Parker',
'email' => 'spiderman@marvel.com',
],
$jwtPayloadForChannel->getInfo(),
);
- self::assertSame(
+ $this->assertSame(
[
'foo' => 'bar',
],
$jwtPayloadForChannel->getMeta(),
);
- self::assertSame(123, $jwtPayloadForChannel->getExpirationTime());
- self::assertSame('test', $jwtPayloadForChannel->getBase64Info());
- self::assertSame(321, $jwtPayloadForChannel->getSubscriptionExpirationTime());
- self::assertSame(['audience'], $jwtPayloadForChannel->getAudiences());
- self::assertSame('issuer', $jwtPayloadForChannel->getIssuer());
- self::assertSame(456, $jwtPayloadForChannel->getIssuedAt());
- self::assertSame('jwtId', $jwtPayloadForChannel->getJwtId());
- self::assertInstanceOf(JwtPayloadForChannelOverride::class, $jwtPayloadForChannel->getOverride());
- self::assertTrue($jwtPayloadForChannel->getOverride()->getPresence());
- self::assertFalse($jwtPayloadForChannel->getOverride()->getJoinLeave());
- self::assertTrue($jwtPayloadForChannel->getOverride()->getForcePushJoinLeave());
- self::assertFalse($jwtPayloadForChannel->getOverride()->getForceRecovery());
- self::assertTrue($jwtPayloadForChannel->getOverride()->getForcePosting());
+ $this->assertSame(123, $jwtPayloadForChannel->getExpirationTime());
+ $this->assertSame('test', $jwtPayloadForChannel->getBase64Info());
+ $this->assertSame(321, $jwtPayloadForChannel->getSubscriptionExpirationTime());
+ $this->assertSame(['audience'], $jwtPayloadForChannel->getAudiences());
+ $this->assertSame('issuer', $jwtPayloadForChannel->getIssuer());
+ $this->assertSame(456, $jwtPayloadForChannel->getIssuedAt());
+ $this->assertSame('jwtId', $jwtPayloadForChannel->getJwtId());
+ $this->assertInstanceOf(JwtPayloadForChannelOverride::class, $jwtPayloadForChannel->getOverride());
+ $this->assertTrue($jwtPayloadForChannel->getOverride()->getPresence());
+ $this->assertFalse($jwtPayloadForChannel->getOverride()->getJoinLeave());
+ $this->assertTrue($jwtPayloadForChannel->getOverride()->getForcePushJoinLeave());
+ $this->assertFalse($jwtPayloadForChannel->getOverride()->getForceRecovery());
+ $this->assertTrue($jwtPayloadForChannel->getOverride()->getForcePosting());
}
#[Test]
@@ -99,7 +99,7 @@ public function getPayloadDataWithAllClaims(): void
new JwtPayloadForChannelOverride(false, true, false, true, false),
);
- self::assertEquals(
+ $this->assertEquals(
[
'sub' => 'spiderman',
'channel' => 'avengers',
@@ -147,7 +147,7 @@ public function getPayloadDataWithOnlyRequiredClaims(): void
'avengers',
);
- self::assertEquals(
+ $this->assertEquals(
[
'sub' => 'spiderman',
'channel' => 'avengers',
diff --git a/Tests/Token/JwtPayloadForPrivateChannelTest.php b/Tests/Token/JwtPayloadForPrivateChannelTest.php
index f03b796..3f2bb7f 100755
--- a/Tests/Token/JwtPayloadForPrivateChannelTest.php
+++ b/Tests/Token/JwtPayloadForPrivateChannelTest.php
@@ -42,25 +42,25 @@ public function constructor(): void
true,
);
- self::assertInstanceOf(AbstractJwtPayload::class, $jwtPayloadForPrivateChannel);
- self::assertSame('spiderman', $jwtPayloadForPrivateChannel->getClient());
- self::assertSame('avengers', $jwtPayloadForPrivateChannel->getChannel());
- self::assertSame(
+ $this->assertInstanceOf(AbstractJwtPayload::class, $jwtPayloadForPrivateChannel);
+ $this->assertSame('spiderman', $jwtPayloadForPrivateChannel->getClient());
+ $this->assertSame('avengers', $jwtPayloadForPrivateChannel->getChannel());
+ $this->assertSame(
[
'name' => 'Peter Parker',
'email' => 'spiderman@marvel.com',
],
$jwtPayloadForPrivateChannel->getInfo(),
);
- self::assertSame(
+ $this->assertSame(
[
'foo' => 'bar',
],
$jwtPayloadForPrivateChannel->getMeta(),
);
- self::assertSame(123, $jwtPayloadForPrivateChannel->getExpirationTime());
- self::assertSame('test', $jwtPayloadForPrivateChannel->getBase64Info());
- self::assertTrue($jwtPayloadForPrivateChannel->isEto());
+ $this->assertSame(123, $jwtPayloadForPrivateChannel->getExpirationTime());
+ $this->assertSame('test', $jwtPayloadForPrivateChannel->getBase64Info());
+ $this->assertTrue($jwtPayloadForPrivateChannel->isEto());
}
#[Test]
@@ -81,7 +81,7 @@ public function getPayloadDataWithAllClaims(): void
true,
);
- self::assertEquals(
+ $this->assertEquals(
[
'client' => 'spiderman',
'channel' => 'avengers',
@@ -108,7 +108,7 @@ public function getPayloadDataWithOnlyRequiredClaims(): void
'avengers',
);
- self::assertEquals(
+ $this->assertEquals(
[
'client' => 'spiderman',
'channel' => 'avengers',
diff --git a/Tests/Token/JwtPayloadTest.php b/Tests/Token/JwtPayloadTest.php
index e50989e..999ea7c 100755
--- a/Tests/Token/JwtPayloadTest.php
+++ b/Tests/Token/JwtPayloadTest.php
@@ -41,24 +41,24 @@ public function constructor(): void
['avengers'],
);
- self::assertInstanceOf(AbstractJwtPayload::class, $jwtPayload);
- self::assertSame('spiderman', $jwtPayload->getSubject());
- self::assertSame(
+ $this->assertInstanceOf(AbstractJwtPayload::class, $jwtPayload);
+ $this->assertSame('spiderman', $jwtPayload->getSubject());
+ $this->assertSame(
[
'name' => 'Peter Parker',
'email' => 'spiderman@marvel.com',
],
$jwtPayload->getInfo(),
);
- self::assertSame(
+ $this->assertSame(
[
'foo' => 'bar',
],
$jwtPayload->getMeta(),
);
- self::assertSame(123, $jwtPayload->getExpirationTime());
- self::assertSame('test', $jwtPayload->getBase64Info());
- self::assertSame(['avengers'], $jwtPayload->getChannels());
+ $this->assertSame(123, $jwtPayload->getExpirationTime());
+ $this->assertSame('test', $jwtPayload->getBase64Info());
+ $this->assertSame(['avengers'], $jwtPayload->getChannels());
}
#[Test]
@@ -78,7 +78,7 @@ public function getPayloadDataWithAllClaims(): void
['avengers'],
);
- self::assertEquals(
+ $this->assertEquals(
[
'sub' => 'spiderman',
'info' => [
@@ -103,7 +103,7 @@ public function getPayloadDataWithOnlyRequiredClaims(): void
'spiderman'
);
- self::assertEquals(
+ $this->assertEquals(
[
'sub' => 'spiderman',
],
diff --git a/composer.json b/composer.json
index cda79e7..ecc29bc 100755
--- a/composer.json
+++ b/composer.json
@@ -36,12 +36,14 @@
},
"require-dev": {
"escapestudios/symfony2-coding-standard": "^3.13",
+ "friendsofphp/php-cs-fixer": "^v3.64",
"jetbrains/phpstorm-attributes": "^1.0",
"phpstan/phpstan": "^1.12",
"phpstan/phpstan-deprecation-rules": "^1.1",
"phpstan/phpstan-phpunit": "^1.4",
"phpstan/phpstan-symfony": "^1.4",
"phpunit/phpunit": "^11.3",
+ "roave/security-advisories": "dev-latest",
"seec/phpunit-consecutive-params": "^1.1",
"slam/phpstan-extensions": "^6.4"
},
@@ -58,6 +60,28 @@
"Fresh\\CentrifugoBundle\\Tests\\": "Tests/"
}
},
+ "scripts": {
+ "ci:pack": [
+ "@ci:composer-validate",
+ "@ci:psr-check",
+ "@ci:code-style",
+ "@ci:static-analysis",
+ "@ci:phpunit"
+ ],
+ "ci:composer-validate": "@composer validate --no-check-all",
+ "ci:psr-check": "@composer dump-autoload --dry-run --strict-psr --optimize",
+ "ci:code-style": [
+ "vendor/bin/phpcs --standard=phpcs.xml",
+ "vendor/bin/php-cs-fixer fix --dry-run --config=.php-cs-fixer.php -v"
+ ],
+ "ci:static-analysis": [
+ "XDEBUG_MODE=off vendor/bin/phpstan analyse -l 9 --no-progress -c phpstan.neon ./"
+ ],
+ "ci:phpunit": [
+ "export XDEBUG_MODE=coverage && vendor/bin/phpunit -c phpunit.xml --coverage-clover=clover-coverage.xml",
+ "vendor/bin/coverage-check clover-coverage.xml 100"
+ ]
+ },
"config": {
"sort-packages": true,
"allow-plugins": {
diff --git a/docker-compose.yml b/docker-compose.yml
new file mode 100644
index 0000000..e251d79
--- /dev/null
+++ b/docker-compose.yml
@@ -0,0 +1,11 @@
+services:
+ fresh_centrifugo_bundle_php:
+ container_name: "fresh_centrifugo_bundle_php"
+ image: fresh-centrifugo-bundle-php:1.0
+ stdin_open: true
+ tty: true
+ build:
+ context: .
+ dockerfile: ./Dockerfile
+ volumes:
+ - .:/var/www/bundle
diff --git a/phpcs.xml b/phpcs.xml
new file mode 100644
index 0000000..7208d1d
--- /dev/null
+++ b/phpcs.xml
@@ -0,0 +1,58 @@
+
+
+
+
+
+
+
+
+
+
+
+ ./
+
+ vendor/
+ composer-setup.php
+ .php-cs-fixer.php
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ./Tests/
+
+
+ ./Tests/
+
+
+
+
+ error
+
+
+
+
+ error
+
+
+ error
+
+
+
+
+
+