spec\LdapTools\Ldif\Entry\LdifEntryModifySpec::it_should_get_the_ldif_string_representation_in_the_context_of_a_type_and_a_schema PHP Метод

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

public it_should_get_the_ldif_string_representation_in_the_context_of_a_type_and_a_schema ( LdapTools\Connection\LdapConnectionInterface $connection, LdapObject $rootdse )
$connection LdapTools\Connection\LdapConnectionInterface
$rootdse LdapTools\Object\LdapObject
    function it_should_get_the_ldif_string_representation_in_the_context_of_a_type_and_a_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');
        $dn = 'cn=foo,dc=foo,dc=bar';
        $this->beConstructedWith($dn);
        $this->setLdapObjectSchema($schema);
        $this->setLdapConnection($connection);
        $this->add('phoneNumber', '555-5555');
        $this->reset('lastName');
        $this->replace('firstName', 'bar');
        $this->delete('password', 'foo');
        $this->add('password', 'bar');
        $ldif = "dn: {$dn}\r\n" . "changetype: modify\r\n" . "add: telephoneNumber\r\n" . "telephoneNumber: 555-5555\r\n" . "-\r\n" . "delete: sn\r\n" . "-\r\n" . "replace: givenName\r\n" . "givenName: bar\r\n" . "-\r\n" . "delete: unicodePwd\r\n" . "unicodePwd: IgBmAG8AbwAiAA==\r\n" . "-\r\n" . "add: unicodePwd\r\n" . "unicodePwd: IgBiAGEAcgAiAA==\r\n" . "-\r\n";
        $this->toString()->shouldBeEqualTo($ldif);
    }