[sonoff-connector] Refactoring sonoff process (#185) #456
ci.yaml
on: push
Matrix: Code quality assurance
Matrix: Code static analysis
Matrix: Code linting
Matrix: Test for mutants
Matrix: Code tests
Matrix: Code tests with code coverage
Annotations
10 warnings
Test for mutants (8.2, ubuntu-latest):
src/Clients/Client.php#L46
Escaped Mutant for Mutator "ArrayItemRemoval":
--- Original
+++ New
@@ @@
private array $options;
public function __construct(Connections\Connection $connection)
{
- $this->options = ['scheme' => 'tcp', 'host' => $connection->getHost(), 'port' => $connection->getPort()];
+ $this->options = ['host' => $connection->getHost(), 'port' => $connection->getPort()];
if ($connection->getUsername() !== null) {
$this->options['username'] = $connection->getUsername();
}
|
Test for mutants (8.2, ubuntu-latest):
src/Clients/Client.php#L48
Escaped Mutant for Mutator "ArrayItem":
--- Original
+++ New
@@ @@
private array $options;
public function __construct(Connections\Connection $connection)
{
- $this->options = ['scheme' => 'tcp', 'host' => $connection->getHost(), 'port' => $connection->getPort()];
+ $this->options = ['scheme' => 'tcp', 'host' > $connection->getHost(), 'port' => $connection->getPort()];
if ($connection->getUsername() !== null) {
$this->options['username'] = $connection->getUsername();
}
|
Test for mutants (8.2, ubuntu-latest):
src/Clients/Client.php#L49
Escaped Mutant for Mutator "ArrayItem":
--- Original
+++ New
@@ @@
private array $options;
public function __construct(Connections\Connection $connection)
{
- $this->options = ['scheme' => 'tcp', 'host' => $connection->getHost(), 'port' => $connection->getPort()];
+ $this->options = ['scheme' => 'tcp', 'host' => $connection->getHost(), 'port' > $connection->getPort()];
if ($connection->getUsername() !== null) {
$this->options['username'] = $connection->getUsername();
}
|
Test for mutants (8.2, ubuntu-latest):
src/Clients/Client.php#L52
Escaped Mutant for Mutator "NotIdentical":
--- Original
+++ New
@@ @@
public function __construct(Connections\Connection $connection)
{
$this->options = ['scheme' => 'tcp', 'host' => $connection->getHost(), 'port' => $connection->getPort()];
- if ($connection->getUsername() !== null) {
+ if ($connection->getUsername() === null) {
$this->options['username'] = $connection->getUsername();
}
if ($connection->getPassword() !== null) {
|
Test for mutants (8.2, ubuntu-latest):
src/Clients/Client.php#L56
Escaped Mutant for Mutator "NotIdentical":
--- Original
+++ New
@@ @@
if ($connection->getUsername() !== null) {
$this->options['username'] = $connection->getUsername();
}
- if ($connection->getPassword() !== null) {
+ if ($connection->getPassword() === null) {
$this->options['password'] = $connection->getPassword();
}
}
|
Test for mutants (8.2, ubuntu-latest):
src/Connections/Connection.php#L35
Escaped Mutant for Mutator "DecrementInteger":
--- Original
+++ New
@@ @@
final class Connection
{
use Nette\SmartObject;
- public function __construct(private readonly string $host = '127.0.0.1', private readonly int $port = 6379, private readonly string|null $username = null, private readonly string|null $password = null)
+ public function __construct(private readonly string $host = '127.0.0.1', private readonly int $port = 6378, private readonly string|null $username = null, private readonly string|null $password = null)
{
}
public function getHost() : string
|
Test for mutants (8.2, ubuntu-latest):
src/Connections/Connection.php#L35
Escaped Mutant for Mutator "IncrementInteger":
--- Original
+++ New
@@ @@
final class Connection
{
use Nette\SmartObject;
- public function __construct(private readonly string $host = '127.0.0.1', private readonly int $port = 6379, private readonly string|null $username = null, private readonly string|null $password = null)
+ public function __construct(private readonly string $host = '127.0.0.1', private readonly int $port = 6380, private readonly string|null $username = null, private readonly string|null $password = null)
{
}
public function getHost() : string
|
Test for mutants (8.2, ubuntu-latest):
src/DI/RedisDbExtension.php#L63
Escaped Mutant for Mutator "DecrementInteger":
--- Original
+++ New
@@ @@
}
public function getConfigSchema() : Schema\Schema
{
- return Schema\Expect::structure(['client' => Schema\Expect::structure(['host' => Schema\Expect::string()->default('127.0.0.1'), 'port' => Schema\Expect::int(6379), 'username' => Schema\Expect::string()->nullable(), 'password' => Schema\Expect::string()->nullable()]), 'exchange' => Schema\Expect::structure(['channel' => Schema\Expect::string()->default(Metadata\Constants::EXCHANGE_CHANNEL_NAME)])]);
+ return Schema\Expect::structure(['client' => Schema\Expect::structure(['host' => Schema\Expect::string()->default('127.0.0.1'), 'port' => Schema\Expect::int(6378), 'username' => Schema\Expect::string()->nullable(), 'password' => Schema\Expect::string()->nullable()]), 'exchange' => Schema\Expect::structure(['channel' => Schema\Expect::string()->default(Metadata\Constants::EXCHANGE_CHANNEL_NAME)])]);
}
public function loadConfiguration() : void
{
|
Test for mutants (8.2, ubuntu-latest):
src/DI/RedisDbExtension.php#L63
Escaped Mutant for Mutator "IncrementInteger":
--- Original
+++ New
@@ @@
}
public function getConfigSchema() : Schema\Schema
{
- return Schema\Expect::structure(['client' => Schema\Expect::structure(['host' => Schema\Expect::string()->default('127.0.0.1'), 'port' => Schema\Expect::int(6379), 'username' => Schema\Expect::string()->nullable(), 'password' => Schema\Expect::string()->nullable()]), 'exchange' => Schema\Expect::structure(['channel' => Schema\Expect::string()->default(Metadata\Constants::EXCHANGE_CHANNEL_NAME)])]);
+ return Schema\Expect::structure(['client' => Schema\Expect::structure(['host' => Schema\Expect::string()->default('127.0.0.1'), 'port' => Schema\Expect::int(6380), 'username' => Schema\Expect::string()->nullable(), 'password' => Schema\Expect::string()->nullable()]), 'exchange' => Schema\Expect::structure(['channel' => Schema\Expect::string()->default(Metadata\Constants::EXCHANGE_CHANNEL_NAME)])]);
}
public function loadConfiguration() : void
{
|
Test for mutants (8.2, ubuntu-latest):
src/DI/RedisDbExtension.php#L79
Escaped Mutant for Mutator "MethodCallRemoval":
--- Original
+++ New
@@ @@
$builder = $this->getContainerBuilder();
$configuration = $this->getConfig();
assert($configuration instanceof stdClass);
- $builder->addDefinition($this->prefix('publisher'), new DI\Definitions\ServiceDefinition())->setType(Publishers\Publisher::class)->setArguments(['channel' => $configuration->exchange->channel]);
+
$builder->addDefinition($this->prefix('redis.connection'), new DI\Definitions\ServiceDefinition())->setType(Connections\Connection::class)->setArguments(['host' => $configuration->client->host, 'port' => $configuration->client->port, 'username' => $configuration->client->username, 'password' => $configuration->client->password]);
$builder->addDefinition($this->prefix('clients.sync'), new DI\Definitions\ServiceDefinition())->setType(Clients\Client::class);
$builder->addDefinition($this->prefix('clients.async.factory'), new DI\Definitions\ServiceDefinition())->setType(Clients\Factory::class)->setArguments(['channel' => $configuration->exchange->channel]);
|