Issue #2230909: Simple decimals fail to pass validation
8 unresolved threads
Closes #2230909
Merge request reports
Activity
added 1 commit
- d2529b31 - Only update storage entity settings if they changed
added 1 commit
- dae7a3f3 - Set "providerNormalize" and "provideCountSignificantDecimals" static
added 1 commit
- b95eceed - Fix typo in update hook, cast string values and adjust "scale" max value
added 1 commit
- 13dd43e3 - Update field storage schema through "updateFieldStorageDefinition")
73 * 74 * @dataProvider provideCountSignificantDecimals 75 * 76 * @param int $expected 77 * The expected number of significant decimals. 78 * @param int|float|string $number 79 * The number to test the count on. 80 */ 81 public function testCountSignificantDecimals($expected, $number) { 82 $this->assertEquals($expected, Number::countSignificantDecimals($number)); 83 } 84 85 /** 86 * Provides data to self::testCountSignificantDecimals(). 87 */ 88 public static function provideCountSignificantDecimals() { changed this line in version 8 of the diff
66 [1234.1234567800000000000000001, 1234.12345678], 67 ['1234.1234567800000000000000001', '1234.1234567800000000000000001'], 68 ]; 69 } 70 71 /** 72 * @covers ::countSignificantDecimals 73 * 74 * @dataProvider provideCountSignificantDecimals 75 * 76 * @param int $expected 77 * The expected number of significant decimals. 78 * @param int|float|string $number 79 * The number to test the count on. 80 */ 81 public function testCountSignificantDecimals($expected, $number) { changed this line in version 8 of the diff
41 * 42 * @param int|float|string $number 43 * The number to test the count on. 44 * @param int $expected 45 * The expected number of significant decimals. 46 * 47 * @dataProvider providerNormalize 48 */ 49 public function testNormalize($number, $expected) { 50 $this->assertEquals($expected, Number::normalize($number)); 51 } 52 53 /** 54 * Provides data to self::testNormalize(). 55 */ 56 public static function providerNormalize() { changed this line in version 9 of the diff
36 36 $this->assertEquals($expected, $return); 37 37 } 38 38 39 /** 40 * @covers \Drupal\Component\Utility\Number::normalize 41 * 42 * @param int|float|string $number 43 * The number to test the count on. 44 * @param int $expected 45 * The expected number of significant decimals. 46 * 47 * @dataProvider providerNormalize 48 */ 49 public function testNormalize($number, $expected) { changed this line in version 9 of the diff
11 11 function field_update_last_removed() { 12 12 return 8500; 13 13 } 14 15 /** 16 * Update existing DecimalItem fields to match the new maximum value. 17 */ 18 function field_update_10001() { changed this line in version 10 of the diff
14 15 /** 16 * Update existing DecimalItem fields to match the new maximum value. 17 */ 18 function field_update_10001(): void { 19 20 // Load all decimal field storage entities: 21 $decimalFieldStorageEntities = \Drupal::entityTypeManager()->getStorage('field_storage_config')->loadByProperties([ 22 'type' => 'decimal', 23 ]); 24 25 foreach ($decimalFieldStorageEntities as $decimalFieldStorageEntity) { 26 /** @var \Drupal\field\Entity\FieldStorageConfig $decimalFieldStorageEntity*/ 27 28 $precision = (int) ini_get('precision'); 29 $precisionMax = max($precision, 10); I guess we should remove the
max()
with 10 call here, as precision always has to be set in ini. Default is 14 (currently), see https://www.php.net/manual/de/ini.core.php
added 241 commits
-
dc6eff4d...be7c988b - 231 commits from branch
project:11.x
- 4f17ac23 - Apply rerolled patch "2230909-309.patch" by @szeidler
- 777d626a - Add update hook
- 5a563aa0 - Update field_update hook name
- 905d0363 - Only update storage entity settings if they changed
- f8df831c - Set "providerNormalize" and "provideCountSignificantDecimals" static
- 2fdde162 - Fix typo in update hook, cast string values and adjust "scale" max value
- cb38cde7 - Update field storage schema through "updateFieldStorageDefinition")
- 5aea096e - Update file NumberTest.php
- 060b3644 - Update file NumberTest.php
- 2114bc26 - Update file field.install
Toggle commit list-
dc6eff4d...be7c988b - 231 commits from branch
added 8 commits
-
4a41e572 - 1 commit from branch
project:11.x
- 7d9bbb4c - Apply rerolled patch "2230909-309.patch" by @szeidler
- f5a65a8a - Add update hook
- d78eb5ca - Update field_update hook name
- a0104bf8 - Only update storage entity settings if they changed
- 51341d63 - Set "providerNormalize" and "provideCountSignificantDecimals" static
- 884ec874 - Fix typo in update hook, cast string values and adjust "scale" max value
- b4798042 - Update field storage schema through "updateFieldStorageDefinition")
Toggle commit list-
4a41e572 - 1 commit from branch
added 445 commits
-
b4798042...e2b71bfe - 444 commits from branch
project:11.x
- 3f251eab - Merge branch drupal:11.x into 2230909-simple-decimals-fail
-
b4798042...e2b71bfe - 444 commits from branch
added 1 commit
- bba3f160 - Added $decimalFieldStorageEntity->setSetting('column_changes_handled', TRUE);...
Please register or sign in to reply