Call AssertEquals with proper parameters
Since `$response->getContent()` returns string and our first parameter is already string as well, in some cases (with different precisions) it may "compare strings" as "strings" and this is not what the test wants. By changing the first parameter to actual number we force `AssertEquals` to compare them numerically rather than literally by string content.
This commit is contained in:
parent
212f66827b
commit
6a8ab6cb73
@ -52,7 +52,7 @@ class JsonResponseTest extends TestCase
|
|||||||
$this->assertSame('0', $response->getContent());
|
$this->assertSame('0', $response->getContent());
|
||||||
|
|
||||||
$response = new JsonResponse(0.1);
|
$response = new JsonResponse(0.1);
|
||||||
$this->assertEquals('0.1', $response->getContent());
|
$this->assertEquals(0.1, $response->getContent());
|
||||||
$this->assertIsString($response->getContent());
|
$this->assertIsString($response->getContent());
|
||||||
|
|
||||||
$response = new JsonResponse(true);
|
$response = new JsonResponse(true);
|
||||||
@ -141,7 +141,7 @@ class JsonResponseTest extends TestCase
|
|||||||
|
|
||||||
$response = JsonResponse::create(0.1);
|
$response = JsonResponse::create(0.1);
|
||||||
$this->assertInstanceOf('Symfony\Component\HttpFoundation\JsonResponse', $response);
|
$this->assertInstanceOf('Symfony\Component\HttpFoundation\JsonResponse', $response);
|
||||||
$this->assertEquals('0.1', $response->getContent());
|
$this->assertEquals(0.1, $response->getContent());
|
||||||
$this->assertIsString($response->getContent());
|
$this->assertIsString($response->getContent());
|
||||||
|
|
||||||
$response = JsonResponse::create(true);
|
$response = JsonResponse::create(true);
|
||||||
|
Reference in New Issue
Block a user