my
$self
= {
'key'
=>
'foo'
,
};
eval
{
check_array_object(
$self
,
'key'
,
'Foo'
,
'Foo'
);
};
is(
$EVAL_ERROR
,
"Parameter 'key' must be a array.\n"
,
"Parameter 'key' must be a array."
);
clean();
$self
= {
'key'
=> [
'foo'
],
};
eval
{
check_array_object(
$self
,
'key'
,
'Foo'
,
'Foo'
);
};
is(
$EVAL_ERROR
,
"Foo isn't 'Foo' object.\n"
,
"Foo isn't 'Foo' object."
);
clean();
my
$mock
= Test::MockObject->new;
$mock
->fake_module(
'Foo'
,
'new'
=>
sub
{
return
$self
,
'Foo'
; },
);
my
$foo
= Foo->new;
$self
= {
'key'
=> [
$foo
],
};
my
$ret
= check_array_object(
$self
,
'key'
,
'Foo'
,
'Foo'
);
is(
$ret
,
undef
,
'Right structure.'
);
$self
= {};
$ret
= check_array_object(
$self
,
'key'
,
'Foo'
,
'Foo'
);
is(
$ret
,
undef
,
'Right not exist key.'
);