LDAPAccountManager/lam/tests/lib/modules/bindDLZTest.php

38 lines
1.2 KiB
PHP
Raw Permalink Normal View History

2018-11-16 17:50:33 +00:00
<?php
2019-11-28 20:18:25 +00:00
use PHPUnit\Framework\TestCase;
2018-11-16 17:50:33 +00:00
/*
This code is part of LDAP Account Manager (http://www.ldap-account-manager.org/)
2019-11-28 20:18:25 +00:00
Copyright (C) 2018 - 2019 Roland Gruber
2018-11-16 17:50:33 +00:00
*/
if (is_readable('lam/lib/modules/bindDLZ.inc')) {
include_once 'lam/lib/baseModule.inc';
include_once 'lam/lib/modules.inc';
include_once 'lam/lib/modules/bindDLZ.inc';
/**
* Checks the bindDLZ module.
*
* @author Roland Gruber
*/
2019-11-28 20:18:25 +00:00
class bindDLZTest extends TestCase {
2018-11-16 17:50:33 +00:00
public function testIncreaseSerial() {
$this->assertEquals('1', bindDLZ::increaseSerial(''));
$this->assertEquals('4', bindDLZ::increaseSerial('3'));
$this->assertEquals('10', bindDLZ::increaseSerial('9'));
$date = new DateTime('now', new DateTimeZone('UTC'));
$dateStr = $date->format('Ymd');
$this->assertEquals($dateStr . '2', bindDLZ::increaseSerial($dateStr . '1'));
$this->assertEquals($dateStr . '06', bindDLZ::increaseSerial($dateStr . '05'));
$this->assertEquals($dateStr . '0010', bindDLZ::increaseSerial($dateStr . '0009'));
$this->assertEquals($dateStr . '100', bindDLZ::increaseSerial($dateStr . '99'));
$this->assertEquals($dateStr . '001', bindDLZ::increaseSerial('20010517003'));
$this->assertEquals('20990517004', bindDLZ::increaseSerial('20990517003'));
}
}
}