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:
mmokhi 2019-09-11 11:18:08 +02:00 committed by Nicolas Grekas
parent 212f66827b
commit 6a8ab6cb73

View File

@ -52,7 +52,7 @@ class JsonResponseTest extends TestCase
$this->assertSame('0', $response->getContent());
$response = new JsonResponse(0.1);
$this->assertEquals('0.1', $response->getContent());
$this->assertEquals(0.1, $response->getContent());
$this->assertIsString($response->getContent());
$response = new JsonResponse(true);
@ -141,7 +141,7 @@ class JsonResponseTest extends TestCase
$response = JsonResponse::create(0.1);
$this->assertInstanceOf('Symfony\Component\HttpFoundation\JsonResponse', $response);
$this->assertEquals('0.1', $response->getContent());
$this->assertEquals(0.1, $response->getContent());
$this->assertIsString($response->getContent());
$response = JsonResponse::create(true);