Test-Net-LDAP

 view release on metacpan or  search on metacpan

lib/Test/Net/LDAP/Util.pm  view on Meta::CPAN

Inside the code block (recursively), all the occurrences of C<Net::LDAP::new>
are replaced by C<Test::Net::LDAP::Mock::new>.

Subclasses of C<Net::LDAP> are also mockified. C<Test::Net::LDAP::Mock> is inserted
into C<@ISA> of each subclass, only within the context of C<ldap_mockify>.

See L<Test::Net::LDAP::Mock> for more details.

=cut

sub ldap_mockify(&) {
    my ($callback) = @_;
    require Test::Net::LDAP::Mock;
    Test::Net::LDAP::Mock->mockify($callback);
}

=head2 ldap_dn_is

    ldap_dn_is($actual_dn, $expect_dn, $name);

Tests equality of two DNs that are not necessarily canonicalized.

t/12-test-names.t  view on Meta::CPAN

use warnings;

use Test::More tests => 4;

use Net::LDAP::Constant qw(
    LDAP_ALREADY_EXISTS
);
use Test::Builder;
use Test::Net::LDAP::Mock;

sub test_name_is(&$) {
    my ($callback, $expected) = @_;
    my $last_name;
    {
        no warnings 'redefine';
        
        local *Test::Builder::ok = sub {
            my ($self, $test, $name) = @_;
            $last_name = $name;
        };
        



( run in 1.312 second using v1.01-cache-2.11-cpan-49f99fa48dc )