Skip to content

Commit 17322f7

Browse files
committed
feat: ri-aggiunta unit test su generator
1 parent 5c1e88b commit 17322f7

2 files changed

Lines changed: 5 additions & 1 deletion

File tree

src/Util/Generator.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,10 @@ public static function generate($pattern, $last = null, $quantity = 1, $values =
9494
*/
9595
public static function complete($pattern, $values = [], $date = null)
9696
{
97+
if ($pattern == null) {
98+
return null;
99+
}
100+
97101
// Costruzione del pattern
98102
$replaces = array_merge(self::getReplaces($date), $values);
99103

tests/GeneratorTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ protected function test($prefix = null, $suffix = null)
4444

4545
$previous = null;
4646
for ($i = 0; $i < 10000; $i = $i + $step) {
47-
$value = $prefix_value.$this->pad($i + 1, $length).$suffix_value;
47+
$value = $prefix_value.($i + 1).$suffix_value;
4848
$this->assertEquals($value, Generator::generate($pattern, $previous, $step, $info));
4949

5050
$previous = $value;

0 commit comments

Comments
 (0)