nur-sery/nur_tests/ldap/syntaxes/DateSyntaxTest.php

21 lines
624 B
PHP
Raw Normal View History

2024-04-04 22:21:20 +04:00
<?php
namespace nur\ldap\syntaxes;
use nur\t\TestCase;
class DateSyntaxTest extends TestCase {
function testPhp2ldap(): void {
$syn = new DateSyntax();
self::assertSame(null, $syn->php2ldap(null));
self::assertSame(null, $syn->php2ldap(""));
self::assertSame("20230324200000Z", $syn->php2ldap("25/3/23"));
self::assertSame("20230325110000Z", $syn->php2ldap("25/3/23 15:0"));
}
function testLdap2php(): void {
$syn = new DateSyntax();
self::assertSame("25/03/2023", $syn->ldap2php("20230324200000Z"));
self::assertSame("25/03/2023 15:00:00", $syn->ldap2php("20230325110000Z"));
}
}