[homekit-connector] Refactoring commands (#216) #374
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/API/V1Parser.php#L53
Escaped Mutant for Mutator "Throw_":
--- Original
+++ New
@@ @@
public static function parse(Uuid\UuidInterface $connector, string $topic, string $payload, bool $retained = false) : array
{
if (!V1Validator::validate($topic)) {
- throw new Exceptions\ParseMessage('Provided topic is not valid');
+ new Exceptions\ParseMessage('Provided topic is not valid');
}
if (V1Validator::validateDeviceAttribute($topic)) {
return array_merge(self::parseDeviceAttribute($connector, $topic, $payload), ['retained' => $retained]);
|
Test for mutants (8.2, ubuntu-latest):
src/API/V1Parser.php#L155
Escaped Mutant for Mutator "UnwrapStrToLower":
--- Original
+++ New
@@ @@
{
preg_match(V1Validator::DEVICE_HW_INFO_REGEXP, $topic, $matches);
[, $device, $hardware] = $matches;
- return ['connector' => $connector, 'device' => $device, 'extension' => Types\ExtensionType::FASTYBIRD_HARDWARE, 'parameter' => $hardware, 'value' => Helpers\Payload::cleanName(strtolower($payload))];
+ return ['connector' => $connector, 'device' => $device, 'extension' => Types\ExtensionType::FASTYBIRD_HARDWARE, 'parameter' => $hardware, 'value' => Helpers\Payload::cleanName($payload)];
}
/**
* @return array<string, Uuid\UuidInterface|string>
|
Test for mutants (8.2, ubuntu-latest):
src/API/V1Parser.php#L176
Escaped Mutant for Mutator "UnwrapStrToLower":
--- Original
+++ New
@@ @@
{
preg_match(V1Validator::DEVICE_FW_INFO_REGEXP, $topic, $matches);
[, $device, $firmware] = $matches;
- return ['connector' => $connector, 'device' => $device, 'extension' => Types\ExtensionType::FASTYBIRD_FIRMWARE, 'parameter' => $firmware, 'value' => Helpers\Payload::cleanName(strtolower($payload))];
+ return ['connector' => $connector, 'device' => $device, 'extension' => Types\ExtensionType::FASTYBIRD_FIRMWARE, 'parameter' => $firmware, 'value' => Helpers\Payload::cleanName($payload)];
}
/**
* @return array<string, Uuid\UuidInterface|string|array<int, array<string, string>>|null>
|
Test for mutants (8.2, ubuntu-latest):
src/API/V1Validator.php#L70
Escaped Mutant for Mutator "UnwrapTrim":
--- Original
+++ New
@@ @@
public static function validate(string $topic) : bool
{
// Check if message is sent from broker
- if (str_contains(trim($topic, FbMqtt\Constants::MQTT_TOPIC_DELIMITER), FbMqtt\Constants::MQTT_TOPIC_DELIMITER . 'set')) {
+ if (str_contains($topic, FbMqtt\Constants::MQTT_TOPIC_DELIMITER . 'set')) {
return false;
}
// Check for valid convention prefix
|
Test for mutants (8.2, ubuntu-latest):
src/API/V1Validator.php#L71
Escaped Mutant for Mutator "Concat":
--- Original
+++ New
@@ @@
public static function validate(string $topic) : bool
{
// Check if message is sent from broker
- if (str_contains(trim($topic, FbMqtt\Constants::MQTT_TOPIC_DELIMITER), FbMqtt\Constants::MQTT_TOPIC_DELIMITER . 'set')) {
+ if (str_contains(trim($topic, FbMqtt\Constants::MQTT_TOPIC_DELIMITER), 'set' . FbMqtt\Constants::MQTT_TOPIC_DELIMITER)) {
return false;
}
// Check for valid convention prefix
|
Test for mutants (8.2, ubuntu-latest):
src/API/V1Validator.php#L116
Escaped Mutant for Mutator "PublicVisibility":
--- Original
+++ New
@@ @@
}
return false;
}
- public static function validateConvention(string $topic) : bool
+ protected static function validateConvention(string $topic) : bool
{
return preg_match(self::CONVENTION_PREFIX_REGEXP, $topic) === 1;
}
|
Test for mutants (8.2, ubuntu-latest):
src/Commands/Execute.php#L61
Escaped Mutant for Mutator "MethodCallRemoval":
--- Original
+++ New
@@ @@
public const NAME = 'fb:fb-mqtt-connector:execute';
public function __construct(private readonly DevicesModels\Entities\Connectors\ConnectorsRepository $connectorsRepository, private readonly Localization\Translator $translator, string|null $name = null)
{
- parent::__construct($name);
+
}
/**
* @throws Console\Exception\InvalidArgumentException
|
Test for mutants (8.2, ubuntu-latest):
src/Commands/Execute.php#L69
Escaped Mutant for Mutator "MethodCallRemoval":
--- Original
+++ New
@@ @@
*/
protected function configure() : void
{
- $this->setName(self::NAME)->setDescription('FB MQTT connector service')->setDefinition(new Input\InputDefinition([new Input\InputOption('connector', 'c', Input\InputOption::VALUE_OPTIONAL, 'Run devices module connector', true)]));
+
}
/**
* @throws Console\Exception\ExceptionInterface
|
Test for mutants (8.2, ubuntu-latest):
src/Commands/Execute.php#L73
Escaped Mutant for Mutator "ArrayItemRemoval":
--- Original
+++ New
@@ @@
*/
protected function configure() : void
{
- $this->setName(self::NAME)->setDescription('FB MQTT connector service')->setDefinition(new Input\InputDefinition([new Input\InputOption('connector', 'c', Input\InputOption::VALUE_OPTIONAL, 'Run devices module connector', true)]));
+ $this->setName(self::NAME)->setDescription('FB MQTT connector service')->setDefinition(new Input\InputDefinition([]));
}
/**
* @throws Console\Exception\ExceptionInterface
|
Test for mutants (8.2, ubuntu-latest):
src/Commands/Execute.php#L79
Escaped Mutant for Mutator "TrueValue":
--- Original
+++ New
@@ @@
*/
protected function configure() : void
{
- $this->setName(self::NAME)->setDescription('FB MQTT connector service')->setDefinition(new Input\InputDefinition([new Input\InputOption('connector', 'c', Input\InputOption::VALUE_OPTIONAL, 'Run devices module connector', true)]));
+ $this->setName(self::NAME)->setDescription('FB MQTT connector service')->setDefinition(new Input\InputDefinition([new Input\InputOption('connector', 'c', Input\InputOption::VALUE_OPTIONAL, 'Run devices module connector', false)]));
}
/**
* @throws Console\Exception\ExceptionInterface
|
Artifacts
Produced during runtime
Name | Size | |
---|---|---|
Logs - Mutations
Expired
|
1.55 MB |
|