48 lines
		
	
	
		
			1.2 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
			
		
		
	
	
			48 lines
		
	
	
		
			1.2 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
<?php
 | 
						|
namespace nur\ldap\syntaxes;
 | 
						|
 | 
						|
use nur\ldap\app\TLdapApplication;
 | 
						|
use nur\ldap\LdapConn;
 | 
						|
use nur\ldap\syntaxes\pri\MyValue;
 | 
						|
use nur\t\TestCase;
 | 
						|
 | 
						|
class CompositeSyntaxTest extends TestCase {
 | 
						|
  use TLdapApplication;
 | 
						|
 | 
						|
  const LOAD_PARAMS = false;
 | 
						|
 | 
						|
  protected function setUp(): void {
 | 
						|
    parent::setUp();
 | 
						|
    if ($this->config === null) $this->config = __DIR__.'/../../tbin/default.ldapconf';
 | 
						|
    $this->conn = $this->getConn();
 | 
						|
  }
 | 
						|
 | 
						|
  /** @var LdapConn */
 | 
						|
  protected $conn;
 | 
						|
 | 
						|
  const LDAP_VALUE1 = "[mvalue=first \\28value\\29][mdate=20230718200000Z]";
 | 
						|
 | 
						|
  function testQuote() {
 | 
						|
    $mv = new MyValue();
 | 
						|
    $mv->setup($this->conn);
 | 
						|
 | 
						|
    $mv->reset(null);
 | 
						|
    self::assertSame("", $mv->mvalue);
 | 
						|
    self::assertSame(null, $mv->mdate);
 | 
						|
 | 
						|
    $mv->reset([
 | 
						|
      "mvalue" => "first (value)",
 | 
						|
      "mdate" => "19/07/2023",
 | 
						|
    ]);
 | 
						|
    self::assertSame("first (value)", $mv->mvalue);
 | 
						|
    self::assertSame("19/07/2023", $mv->mdate);
 | 
						|
    self::assertSame(self::LDAP_VALUE1, $mv->formatLdap());
 | 
						|
 | 
						|
    $mv->reset(null);
 | 
						|
    $mv->parseLdap(self::LDAP_VALUE1);
 | 
						|
    self::assertSame("first (value)", $mv->mvalue);
 | 
						|
    self::assertSame("19/07/2023", $mv->mdate);
 | 
						|
    self::assertSame(self::LDAP_VALUE1, $mv->formatLdap());
 | 
						|
  }
 | 
						|
}
 |