-
Notifications
You must be signed in to change notification settings - Fork 49
Open
Description
Given this class:
<?php
declare(strict_types=1);
namespace ApiPlatform\Core\Identifier\Normalizer;
use Symfony\Component\Serializer\Normalizer\DenormalizerInterface;
final class IntegerDenormalizer implements DenormalizerInterface
{
public function denormalize($data, $class, $format = null, array $context = []): int
{
return (int) $data;
}
}
And calling assertSame
like this:
<?php
declare(strict_types=1);
namespace ApiPlatform\Core\Tests\Identifier\Normalizer;
use ApiPlatform\Core\Identifier\Normalizer\IntegerDenormalizer;
use PHPUnit\Framework\TestCase;
class IntegerDenormalizerTest extends TestCase
{
public function testDenormalize()
{
$this->assertSame(2, (new IntegerDenormalizer())->denormalize('2', 'int'));
}
}
Gives an error such as:
------ -----------------------------------------------------------------------------------------------------
Line tests/Identifier/Normalizer/IntegerDenormalizerTest.php
------ -----------------------------------------------------------------------------------------------------
26 Call to method PHPUnit\Framework\Assert::assertSame() with 2 and int will always evaluate to false.
------ -----------------------------------------------------------------------------------------------------
Metadata
Metadata
Assignees
Labels
No labels
Activity
mabar commentedon Feb 15, 2022
I ran into the same issue with
assertSame()