1
0
mirror of https://github.com/devcode-it/openstamanager.git synced 2025-01-18 18:20:11 +01:00

feat: ri-aggiunta unit test su generator

This commit is contained in:
FabioL 2024-12-20 17:17:47 +01:00
parent 5c1e88be34
commit 17322f7811
2 changed files with 5 additions and 1 deletions

View File

@ -94,6 +94,10 @@ class Generator
*/ */
public static function complete($pattern, $values = [], $date = null) public static function complete($pattern, $values = [], $date = null)
{ {
if ($pattern == null) {
return null;
}
// Costruzione del pattern // Costruzione del pattern
$replaces = array_merge(self::getReplaces($date), $values); $replaces = array_merge(self::getReplaces($date), $values);

View File

@ -44,7 +44,7 @@ class GeneratorTest extends \PHPUnit\Framework\TestCase
$previous = null; $previous = null;
for ($i = 0; $i < 10000; $i = $i + $step) { for ($i = 0; $i < 10000; $i = $i + $step) {
$value = $prefix_value.$this->pad($i + 1, $length).$suffix_value; $value = $prefix_value.($i + 1).$suffix_value;
$this->assertEquals($value, Generator::generate($pattern, $previous, $step, $info)); $this->assertEquals($value, Generator::generate($pattern, $previous, $step, $info));
$previous = $value; $previous = $value;