NAME

Net::DBus::Test::MockConnection - mock connection object for unit testing

SYNOPSIS

use Net::DBus;

my $bus = Net::DBus->test

# Register a service, and the objec to be tested
use MyObject
my $service = $bus->export_service("org.example.MyService");
my $object = MyObject->new($service);


# Acquire the service & do tests
my $remote_service = $bus->get_service('org.example.MyService');
my $remote_object = $service->get_object("/org/example/MyObjct");

# This traverses the mock connection, eventually
# invoking 'testSomething' on the $object above.
$remote_object->testSomething()

DESCRIPTION

This object provides a fake implementation of the Net::DBus::Binding::Connection enabling a pure 'in-memory' message bus to be mocked up. This is intended to facilitate creation of unit tests for services which would otherwise need to call out to other object on a live message bus. It is used as a companion to the Net::DBus::Test::MockObject module which is how fake objects are to be provided on the fake bus.

METHODS

BUGS

It doesn't completely replicate the API of Net::DBus::Binding::Connection, merely enough to make the high level bindings work in a test scenario.

SEE ALSO

Net::DBus, Net::DBus::Test::MockObject, Net::DBus::Binding::Connection, http://www.mockobjects.com/Faq.html

COPYRIGHT

Copyright 2005 Daniel Berrange <dan@berrange.com>