File: isa.t

package info (click to toggle)
libtest-mockobject-perl 1.20200122-4
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 216 kB
  • sloc: perl: 1,260; makefile: 2
file content (27 lines) | stat: -rw-r--r-- 624 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#!/usr/bin/perl

use strict;
use warnings;

use Test::More tests => 7;

use_ok( 'Test::MockObject' );
my $mock = Test::MockObject->new();

can_ok( $mock, 'set_isa' );

# set_isa() should make isa() report true for the given parents
$mock->set_isa( 'CGI', 'Apache::Request', 'Apache' );

isa_ok( $mock, 'CGI' );
isa_ok( $mock, 'Apache' );

# ... it should be able to add parents
$mock->set_isa( 'Something' );
isa_ok( $mock, 'Something' );

# ... without overwriting previous parents
isa_ok( $mock, 'Apache::Request' );

# ... or reporting true for everything
ok( ! $mock->isa( 'Fail' ), '... this is not a "Fail" object' );