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:
parent
5c1e88be34
commit
17322f7811
@ -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);
|
||||||
|
|
||||||
|
@ -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;
|
||||||
|
Loading…
Reference in New Issue
Block a user