spec\LdapTools\Ldif\Entry\LdifEntryAddSpec::it_should_get_the_ldif_representation_in_the_context_of_a_type_and_schema PHP Метод

it_should_get_the_ldif_representation_in_the_context_of_a_type_and_schema() публичный Метод

public it_should_get_the_ldif_representation_in_the_context_of_a_type_and_schema ( LdapTools\Connection\LdapConnectionInterface $connection, LdapObject $rootdse )
$connection LdapTools\Connection\LdapConnectionInterface
$rootdse LdapTools\Object\LdapObject
    function it_should_get_the_ldif_representation_in_the_context_of_a_type_and_schema(LdapConnectionInterface $connection, LdapObject $rootdse)
    {
        $domain = new DomainConfiguration('example.local');
        $domain->setUseTls(true);
        $connection->getConfig()->willReturn($domain);
        $connection->getRootDse()->willReturn($rootdse);
        $config = new Configuration();
        $parser = new SchemaYamlParser($config->getSchemaFolder());
        $schema = $parser->parse('ad', 'user');
        $this->beConstructedWith(null);
        $this->setLdapObjectSchema($schema);
        $this->setLdapConnection($connection);
        $this->setAttributes(['username' => 'John', 'password' => '12345']);
        $this->setLocation('ou=employees,dc=example,dc=local');
        $ldif = "dn: cn=John,ou=employees,dc=example,dc=local\r\n" . "changetype: add\r\n" . "cn: John\r\n" . "displayname: John\r\n" . "givenName: John\r\n" . "userPrincipalName: [email protected]\r\n" . "objectclass: top\r\n" . "objectclass: person\r\n" . "objectclass: organizationalPerson\r\n" . "objectclass: user\r\n" . "sAMAccountName: John\r\n" . "unicodePwd: IgAxADIAMwA0ADUAIgA=\r\n" . "userAccountControl: 512\r\n";
        $this->toString()->shouldBeEqualTo($ldif);
    }