4 Commits

Author SHA1 Message Date
dd42c12d49 Orden 2025-04-30 10:38:20 -04:00
41ea5f5c15 Update prueba 2025-04-30 10:38:05 -04:00
eeb6f5bcd1 Se agrega condicion 2025-04-30 10:37:57 -04:00
2680f51167 Correccion migracion 2025-04-30 10:37:41 -04:00
4 changed files with 15 additions and 4 deletions

View File

@ -18,7 +18,7 @@ class CreateAgente extends Phinx\Migration\AbstractMigration
->addColumn('telefono', 'integer', ['length' => 11, 'default' => null, 'null' => true])
->addColumn('correo', 'string', ['length' => 50, 'default' => null, 'null' => true])
->addColumn('direccion', 'integer', ['length' => 11, 'default' => null, 'null' => true])
->addColumn('giro', 'mediumtext', ['default' => null, 'null' => true])
->addColumn('giro', 'text', ['default' => null, 'null' => true])
->addColumn('abreviacion', 'string', ['length' => 20, 'default' => null, 'null' => true])
->create();
$this->execute('SET unique_checks=1; SET foreign_key_checks=1;');

View File

@ -80,13 +80,16 @@ class Valor
if (strlen($parts[0]) > 3) { // 1000.000 || 1,000.000
return true;
}
if (strlen($parts[1]) < 3) { // #####.00
return true;
}
if (str_contains($value, ',')) {
if (strpos($value, ',') > strpos($value, '.')) { // 1.000,000
return false;
}
return true; // 1,000.000
}
if ((int) $parts[0] < 10) {
if ((int) $parts[0] < 10) { // 1.000
return true;
}
return false;

View File

@ -16,7 +16,6 @@ class Benchmark
echo implode(PHP_EOL, self::$queue), PHP_EOL;
self::$queue = [];
}
public static function execute(callable $callback, ?array $args = null, ?string $description = null): mixed
{
if (null === $description) {
@ -36,7 +35,6 @@ class Benchmark
self::$queue[$i] .= sprintf(" in %.2f seconds", $end - $start);
return $result;
}
public static function getCallableName(callable $callable): string
{
return match (true) {

View File

@ -22,6 +22,8 @@ class ValorTest extends TestCase
return [
['1.003.000,01', 1003000.01],
['4,273.84', 4273.84],
[443.75, 443.75],
['443.75', 443.75]
];
}
@ -36,6 +38,14 @@ class ValorTest extends TestCase
$this->assertEquals($expected, $result);
}
public static function ufsDataProvider(): array
{
return [
['1000000', 28.57143],
[443.75, 443.75]
];
}
public function testToUF()
{
$date = '2025-01-01';