Skip to content

Commit

Permalink
Merge pull request #47 from LibreSign/bugfix/prevent-handle-string-as…
Browse files Browse the repository at this point in the history
…-json

Prevent handle string as json
  • Loading branch information
vitormattos authored Dec 26, 2023
2 parents 2a5762a + 2c6c66a commit 30a99d0
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
6 changes: 6 additions & 0 deletions features/test.feature
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,12 @@ Feature: Test this extension
default
"""

Scenario: Test initial state with string
Then the response should contain the initial state "appid-string" with the following values:
"""
"text as json string"
"""

Scenario: Test initial state with boolean
Then the response should contain the initial state "appid-string" with the following values:
"""
Expand Down
4 changes: 4 additions & 0 deletions src/NextcloudApiContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,10 @@ public function theResponseShouldContainTheInitialStateWithTheFollowingValues(st
if ($this->isJson($expected)) {
Assert::assertJsonStringEqualsJsonString($expected, $actual);
} else {
if (trim($actual, '"') === json_decode($actual) && str_starts_with($actual, '"')) {
$actual = trim($actual, '"');
$expected = trim($expected, '"');
}
Assert::assertEquals($expected, $actual);
}
}
Expand Down

0 comments on commit 30a99d0

Please sign in to comment.