Skip to content

Commit ec2a74a

Browse files
mmokhinicolas-grekas
authored andcommitted
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.
1 parent 089da40 commit ec2a74a

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Tests/JsonResponseTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ public function testConstructorWithSimpleTypes()
5252
$this->assertSame('0', $response->getContent());
5353

5454
$response = new JsonResponse(0.1);
55-
$this->assertEquals('0.1', $response->getContent());
55+
$this->assertEquals(0.1, $response->getContent());
5656
$this->assertIsString($response->getContent());
5757

5858
$response = new JsonResponse(true);
@@ -141,7 +141,7 @@ public function testStaticCreateWithSimpleTypes()
141141

142142
$response = JsonResponse::create(0.1);
143143
$this->assertInstanceOf('Symfony\Component\HttpFoundation\JsonResponse', $response);
144-
$this->assertEquals('0.1', $response->getContent());
144+
$this->assertEquals(0.1, $response->getContent());
145145
$this->assertIsString($response->getContent());
146146

147147
$response = JsonResponse::create(true);

0 commit comments

Comments
 (0)