test for bridge to local
Robert 'phaylon' Sedlacek [Wed, 30 May 2012 19:21:42 +0000 (19:21 +0000)]
t/bridged.t [new file with mode: 0644]
t/lib/ORTestBridge.pm [new file with mode: 0644]

diff --git a/t/bridged.t b/t/bridged.t
new file mode 100644 (file)
index 0000000..2c4c24b
--- /dev/null
@@ -0,0 +1,17 @@
+use strictures 1;
+use Test::More;
+use Test::Fatal;
+use FindBin;
+
+use lib "$FindBin::Bin/lib";
+
+use Object::Remote;
+
+is exception {
+  my $bridge = ORTestBridge->new::on('localhost');
+  is $bridge->call('counter'), 0;
+  $bridge->call('increment');
+  is $bridge->call('counter'), 1;
+}, undef, 'no error during bridge access';
+
+done_testing;
diff --git a/t/lib/ORTestBridge.pm b/t/lib/ORTestBridge.pm
new file mode 100644 (file)
index 0000000..26556c9
--- /dev/null
@@ -0,0 +1,15 @@
+package ORTestBridge;
+use Moo;
+
+use Object::Remote;
+
+has object => (is => 'lazy');
+
+sub _build_object { ORTestClass->new::on('-') }
+
+sub call {
+  my ($self, $method, @args) = @_;
+  return $self->object->$method(@args);
+}
+
+1;