Skip to content

Commit b40cdbe

Browse files
committed
prefer the public API over reflection in test
1 parent 1f0995f commit b40cdbe

File tree

1 file changed

+1
-21
lines changed

1 file changed

+1
-21
lines changed

Tests/Extension/Core/DataTransformer/NumberToLocalizedStringTransformerTest.php

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -732,7 +732,7 @@ public function testReverseTransformDoesNotCauseIntegerPrecisionLoss()
732732
$this->markTestSkipped('Test is not applicable on 32-bit systems where no integer loses precision when cast to float.');
733733
}
734734

735-
$transformer = new NumberToLocalizedStringTransformer();
735+
$transformer = new NumberToLocalizedStringTransformer(2);
736736

737737
// Test a large integer that causes actual precision loss when cast to float
738738
$largeInt = \PHP_INT_MAX - 1; // This value loses precision when cast to float
@@ -741,24 +741,4 @@ public function testReverseTransformDoesNotCauseIntegerPrecisionLoss()
741741
$this->assertSame($largeInt, $result);
742742
$this->assertIsInt($result);
743743
}
744-
745-
public function testRoundMethodKeepsIntegersAsIntegers()
746-
{
747-
if (\PHP_INT_SIZE === 4) {
748-
$this->markTestSkipped('Test is not applicable on 32-bit systems where no integer loses precision when cast to float.');
749-
}
750-
751-
$transformer = new NumberToLocalizedStringTransformer(2); // scale=2 triggers rounding
752-
753-
// Use reflection to test the private round() method directly
754-
$reflection = new \ReflectionClass($transformer);
755-
$roundMethod = $reflection->getMethod('round');
756-
757-
$int = \PHP_INT_MAX - 1;
758-
$result = $roundMethod->invoke($transformer, $int);
759-
760-
// With the fix, integers should stay as integers, not be converted to floats
761-
$this->assertSame($int, $result);
762-
$this->assertIsInt($result);
763-
}
764744
}

0 commit comments

Comments
 (0)