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

26 lines
989 B
PHP
Raw Normal View History

2024-04-04 22:21:20 +04:00
<?php
namespace nur\ldap\syntaxes;
use nur\t\TestCase;
class PostalAddressSyntaxTest extends TestCase {
function testPhp2ldap(): void {
$syn = new PostalAddressSyntax();
self::assertNull($syn->php2ldap(null));
self::assertSame('', $syn->php2ldap(''));
self::assertSame('mon adresse', $syn->php2ldap(' mon adresse '));
self::assertSame('mon adre\$\$e', $syn->php2ldap(' mon adre$$e '));
self::assertSame('mon $ adresse', $syn->php2ldap(" mon \n adresse "));
self::assertSame('mon $ adre\$\$e', $syn->php2ldap(" mon \n adre\$\$e "));
}
function testLdap2php(): void {
$syn = new PostalAddressSyntax();
self::assertSame('', $syn->ldap2php(''));
self::assertSame('mon adresse', $syn->ldap2php('mon adresse'));
self::assertSame('mon adre$$e', $syn->ldap2php('mon adre\$\$e'));
self::assertSame("mon\nadresse", $syn->ldap2php('mon $ adresse'));
self::assertSame("mon\nadre\$\$e", $syn->ldap2php('mon $ adre\$\$e'));
}
}