working module sending
[scpubgit/Object-Remote.git] / t / sender.t
1 use strictures 1;
2 use Test::More;
3
4 use Object::Remote::Connector::Local;
5 use Object::Remote;
6 use Object::Remote::ModuleSender;
7
8 $ENV{PERL5LIB} = join(
9   ':', ($ENV{PERL5LIB} ? $ENV{PERL5LIB} : ()), qw(lib)
10 );
11
12 my $connection = Object::Remote::Connector::Local->new->connect;
13
14 my $ms = Object::Remote::ModuleSender->new(
15   dir_list => [ 't/lib' ]
16 );
17
18 my $ml = Object::Remote->new(
19   connection => $connection,
20   class => 'Object::Remote::ModuleLoader',
21   args => { module_sender => $ms },
22 );
23
24 my $proxy = Object::Remote->new(
25   connection => $connection,
26   class => 'ORTestClass'
27 )->proxy;
28
29 isnt($$, $proxy->pid, 'Different pid on the other side');
30
31 is($proxy->counter, 0, 'Counter at 0');
32
33 is($proxy->increment, 1, 'Increment to 1');
34
35 is($proxy->counter, 1, 'Counter at 1');
36
37 done_testing;