Skip to content

Commit

Permalink
Lint
Browse files Browse the repository at this point in the history
  • Loading branch information
fabio-ivona authored and github-actions[bot] committed Jun 20, 2023
1 parent 8f8a68c commit c0225fa
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion src/DTO/Message.php
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ public static function fromArray(array $data): Message

if (isset($data['web_app_data']['data'])) {
$webAppData = json_decode($data['web_app_data']['data'], true);

if(!$webAppData) {
$webAppData = $data['web_app_data']['data'];
}
Expand Down
22 changes: 11 additions & 11 deletions tests/Unit/DTO/MessageTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -248,8 +248,8 @@
],
'web_app_data' => [
"button" => "CustomButton",
"data" => "Data"
]
"data" => "Data",
],
]);

$array = $dto->toArray();
Expand All @@ -260,22 +260,22 @@
}
});

it("extract web_app_data of string type", function(){
it("extract web_app_data of string type", function () {
$dto = Message::fromArray([
'message_id' => 2,
'date' => now()->timestamp,
'web_app_data' => [
"button" => "SendString",
"data" => "Data"
]
"data" => "Data",
],
]);
$webAppData = $dto->webAppData();

expect($webAppData)->toBe("Data");
});


it("extract web_app_data of json type", function(){
it("extract web_app_data of json type", function () {
$dto = Message::fromArray([
'message_id' => 2,
'date' => now()->timestamp,
Expand All @@ -288,8 +288,8 @@
{
"a" : "b"
}
]'
]
]',
],
]);
$webAppData = $dto->webAppData();

Expand All @@ -298,7 +298,7 @@
1,
"string",
[
"a" => "b"
]
"a" => "b",
],
]);
});
});

0 comments on commit c0225fa

Please sign in to comment.