1
0
mirror of https://github.com/dg/dibi.git synced 2025-08-31 01:39:46 +02:00

support for 64bit numbers on 32bit platform [Closes #253] (BC break)

throws exception when given argument is not a number
This commit is contained in:
David Grudl
2017-07-21 23:20:30 +02:00
parent be3a0aa57d
commit 3253a5b092
18 changed files with 86 additions and 41 deletions

View File

@@ -0,0 +1,25 @@
<?php
use Dibi\Helpers;
use Tester\Assert;
require __DIR__ . '/bootstrap.php';
Assert::same(0, Helpers::intVal(0));
Assert::same(0, Helpers::intVal('0'));
Assert::same(-10, Helpers::intVal('-10'));
Assert::same('12345678901234567890123456879', Helpers::intVal('12345678901234567890123456879'));
Assert::same('-12345678901234567890123456879', Helpers::intVal('-12345678901234567890123456879'));
Assert::exception(function () {
Helpers::intVal('');
}, 'Dibi\Exception', "Expected number, '' given.");
Assert::exception(function () {
Helpers::intVal('not number');
}, 'Dibi\Exception', "Expected number, 'not number' given.");
Assert::exception(function () {
Helpers::intVal(null);
}, 'Dibi\Exception', "Expected number, '' given.");