Skip to content

Commit e05e2f8

Browse files
committed
Remove jsonEquals method and test as per request
1 parent aa0ec73 commit e05e2f8

3 files changed

Lines changed: 0 additions & 86 deletions

File tree

README.md

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -178,9 +178,6 @@ fact('invalid-email')->isValidEmail(); // Fails
178178

179179
fact('01ARZ3NDEKTSV4RRFFQ69G5FAV')->ulid(); // Passes (if valid ULID)
180180
fact('invalid-ulid')->ulid(); // Fails
181-
182-
fact('{"key": "value"}')->jsonEquals('{"key": "value"}'); // Passes
183-
fact('{"key": "value"}')->jsonEquals('{"key": "different"}'); // Fails
184181
```
185182

186183
### Type Checking assertions

src/Traits/StringAssertions.php

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -334,39 +334,7 @@ public function isValidEmail(string $message = ''): self
334334
return $this;
335335
}
336336

337-
/**
338-
* Asserts that two JSON strings are equal.
339-
*
340-
* This method decodes both JSON strings and compares the resulting data structures.
341-
*
342-
* Example usage:
343-
* fact('{"key": "value"}')->jsonEquals('{"key": "value"}'); // Passes
344-
* fact('{"key": "value"}')->jsonEquals('{"key": "different"}'); // Fails
345-
*
346-
* @param string $expectedJson The expected JSON string.
347-
* @param string $message Optional custom error message.
348-
*
349-
* @return self Enables fluent chaining of assertion methods.
350-
*/
351-
public function jsonEquals(string $expectedJson, string $message = ''): self
352-
{
353-
$actual = json_decode($this->variable, true);
354-
$actualError = json_last_error();
355-
356-
$expected = json_decode($expectedJson, true);
357-
$expectedError = json_last_error();
358-
359-
if ($actualError !== JSON_ERROR_NONE) {
360-
Assert::assertTrue(false, $message ?: 'Actual JSON is invalid.');
361-
}
362-
if ($expectedError !== JSON_ERROR_NONE) {
363-
Assert::assertTrue(false, $message ?: 'Expected JSON is invalid.');
364-
}
365-
366-
Assert::assertEquals($expected, $actual, $message ?: 'JSON strings are not equal.');
367337

368-
return $this;
369-
}
370338

371339
/**
372340
* Asserts that a variable is a valid ULID.

tests/FluentAssertions/Asserts/JsonEquals/JsonEqualsTest.php

Lines changed: 0 additions & 51 deletions
This file was deleted.

0 commit comments

Comments
 (0)