| 1 | package Test::PlugAuth::Plugin::Refresh; | ||||||||||
| 2 | |||||||||||
| 3 | 3 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | 3 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | 3 | ▶ | use PlugAuth; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | 3 | ▶ | use Clustericious::Config; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 7 | 3 | ▶ | use Test::PlugAuth::Plugin; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 8 | 3 | ▶ | use Test::Builder; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 9 | 3 | ▶ | use Role::Tiny (); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 10 | 3 | ▶ | use base qw( Exporter ); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 11 | |||||||||||
| 12 | 3 | our @EXPORT = qw( run_tests ); | |||||||||
| 13 | |||||||||||
| 14 | # ABSTRACT: Test a PlugAuth Refresh plugin for correctness | ||||||||||
| 15 | 3 | our $VERSION = '0.39'; # VERSION | |||||||||
| 16 | |||||||||||
| 17 | |||||||||||
| 18 | 3 | my $Test = Test::Builder->new; | |||||||||
| 19 | |||||||||||
| 20 | sub run_tests | ||||||||||
| 21 | 3 | ▶ | { | ||||||||
|
Subroutine
run_tests: called CC=4 SCAR=14.0
Pod
documented
| |||||||||||
| 22 | 3 | my($class) = @_; | |||||||||
| 23 | 3 | ▶ | $class = "PlugAuth::Plugin::$class" unless $class =~ /::/; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 24 | 3 | ▶ | eval qq{ use $class }; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 25 | 3 | ▶ | die $@ if $@; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 26 | |||||||||||
| 27 | 3 | $Test->plan( tests => 4); | |||||||||
| 28 | |||||||||||
| 29 | 3 | my $object = eval { $class->new(Clustericious::Config->new({}), Clustericious::Config->new({}), PlugAuth->new) }; | |||||||||
| 30 | 3 | my $error = $@; | |||||||||
| 31 | 3 | ▶ | if(ref $object) | ||||||||
|
Branch: 1 branch
| |||||||||||
| 32 | { | ||||||||||
| 33 | 0 | $Test->ok(1, "New returns a reference"); | |||||||||
| 34 | } | ||||||||||
| 35 | else | ||||||||||
| 36 | { | ||||||||||
| 37 | 3 | $Test->ok(0, "New returns a reference"); | |||||||||
| 38 | 3 | $Test->diag("ERROR: $error"); | |||||||||
| 39 | } | ||||||||||
| 40 | |||||||||||
| 41 | 3 | $Test->ok( Role::Tiny::does_role($object, 'PlugAuth::Role::Plugin'), 'does Plugin'); | |||||||||
| 42 | 3 | $Test->ok( Role::Tiny::does_role($object, 'PlugAuth::Role::Refresh'), 'does Refresh'); | |||||||||
| 43 | 3 | $Test->ok( eval { $object->can('refresh') }, "can refresh"); | |||||||||
| 44 | }; | ||||||||||
| 45 | |||||||||||
| 46 | 3 | 1; | |||||||||
| 47 | |||||||||||
| 48 | __END__ | ||||||||||