Skip to content

Commit ac25d94

Browse files
authored
Merge pull request #16 from SoapBox/testing/moar-coverage
[Testing] Adds missing tests for getContent on the Verifier
2 parents c1a4d13 + aa93104 commit ac25d94

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed

tests/Requests/VerifierTest.php

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -278,4 +278,40 @@ public function get_id_should_return_the_x_signed_id_value()
278278

279279
$this->assertSame($id, $request->getId());
280280
}
281+
282+
/**
283+
* @test
284+
*/
285+
public function get_content_returns_the_raw_content_if_it_is_not_valid_json()
286+
{
287+
$request = new class() extends Request
288+
{
289+
public function getContent($asResource = false)
290+
{
291+
return '"url":"http:\\/\\/google.com"';
292+
}
293+
};
294+
295+
$verifier = new Verifier($request);
296+
297+
$this->assertSame('"url":"http:\\/\\/google.com"', $verifier->getContent());
298+
}
299+
300+
/**
301+
* @test
302+
*/
303+
public function get_content_returns_the_content_from_the_request_without_escaping_the_slashes_if_the_content_is_valid_json()
304+
{
305+
$request = new class() extends Request
306+
{
307+
public function getContent($asResource = false)
308+
{
309+
return '{"url":"http:\\/\\/google.com"}';
310+
}
311+
};
312+
313+
$verifier = new Verifier($request);
314+
315+
$this->assertSame('{"url":"http://google.com"}', $verifier->getContent());
316+
}
281317
}

0 commit comments

Comments
 (0)