Skip to content

Commit

Permalink
Fix some test failures
Browse files Browse the repository at this point in the history
  • Loading branch information
Marshall Roch committed Aug 26, 2005
1 parent 7b4b793 commit 0f4f1fc
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 4 deletions.
19 changes: 16 additions & 3 deletions t/Bric/Biz/AssetType/DevTest.pm
Expand Up @@ -58,7 +58,7 @@ sub test_lookup : Test(2) {

##############################################################################
# Test the list() method.
sub test_list : Test(36) {
sub test_list : Test(38) {
my $self = shift;

# Create a new element group.
Expand Down Expand Up @@ -315,6 +315,7 @@ sub test_ic : Test(60) {

# Add a new input channel.
ok( my $ic = Bric::Biz::InputChannel->new({name => 'Foober',
key_name => 'foober',
site_id => 100}),
"Create 'Foober' IC" );
ok( $ic->save, "Save Foober" );
Expand Down Expand Up @@ -363,7 +364,7 @@ sub test_ic : Test(60) {

# Now try to delete the input channel when it is still selected
throws_ok {
$at->delete_output_channels([$ic]);
$at->delete_input_channels([$ic]);
} qr/Cannot delete a primary input channel/,
"Check that you can't delete an input channel that is primary";

Expand Down Expand Up @@ -414,7 +415,7 @@ sub test_ic : Test(60) {
##############################################################################
# Test Site methods.
##############################################################################
sub test_site : Test(27) {
sub test_site : Test(32) {
my $self = shift;

#dependant on intial values
Expand Down Expand Up @@ -454,6 +455,14 @@ sub test_site : Test(27) {
my $site2_id = $site2->get_id;
$self->add_del_ids($site2_id, 'site');

ok( my $ic2 = Bric::Biz::InputChannel->new({ key_name => __PACKAGE__ . "2",
name => __PACKAGE__ . "2",
site_id => $site2_id }),
"Create IC2" );
ok( $ic2->save, "Save IC2" );
ok( my $ic2_id = $ic2->get_id, "Get IC ID2" );
$self->add_del_ids($ic2_id, 'input_channel');

ok( my $oc2 = Bric::Biz::OutputChannel->new({ name => __PACKAGE__ . "2",
site_id => $site2_id }),
"Create OC2" );
Expand Down Expand Up @@ -498,8 +507,12 @@ sub test_site : Test(27) {
"Associate primary OC1" );

is($site2->get_id, $top_level_element->add_site($site2_id)->get_id, "Add a new site");
ok( $top_level_element->add_input_channels([$ic2_id]),
"Associate IC2" );
ok( $top_level_element->add_output_channels([$oc2_id]),
"Associate OC2" );
ok( $top_level_element->set_primary_ic_id($ic2_id, $site2_id),
"Associate primary IC2" );
ok( $top_level_element->set_primary_oc_id($oc2_id, $site2_id),
"Associate primary OC2" );

Expand Down
33 changes: 32 additions & 1 deletion t/Bric/Util/DBI/Test.pm
Expand Up @@ -371,14 +371,15 @@ sub test_order_by: Test(6) {

}

sub testclean_params: Test(8) {
sub testclean_params: Test(10) {
my $self = shift;
my $exp;
$exp = {
active => 1,
_no_return_versions => 1,
_not_simple => 1,
_checked_in_or_out => 1,
primary_ic => 1,
Order => 'cover_date',
};
is_deeply( clean_params($CLASS, undef), $exp, 'correct base params added');
Expand All @@ -387,6 +388,7 @@ sub testclean_params: Test(8) {
_no_return_versions => 1,
_not_simple => 1,
_checked_in_or_out => 1,
primary_ic => 1,
Order => 'slug',
};
is_deeply( clean_params($CLASS, { Order => 'slug' }), $exp, 'Order works right');
Expand All @@ -395,6 +397,7 @@ sub testclean_params: Test(8) {
return_versions => 1,
_not_simple => 1,
_checked_in_or_out => 1,
primary_ic => 1,
Order => 'cover_date',
};
is_deeply( clean_params($CLASS, { return_versions => 1 }), $exp, 'add return versions');
Expand All @@ -403,6 +406,7 @@ sub testclean_params: Test(8) {
_no_return_versions => 1,
simple => 1,
_checked_in_or_out => 1,
primary_ic => 1,
Order => 'cover_date',
};
is_deeply( clean_params($CLASS, {simple => 1}), $exp, 'simple sets itself and not _not_simple');
Expand All @@ -413,6 +417,7 @@ sub testclean_params: Test(8) {
_not_simple => 1,
inactive => 1,
_checked_in_or_out => 1,
primary_ic => 1,
Order => 'cover_date',
};
is_deeply( clean_params($CLASS, { inactive => 1 }), $exp, 'inactive sets active 0');
Expand All @@ -422,6 +427,7 @@ sub testclean_params: Test(8) {
_not_simple => 1,
user__id => 1,
_checked_out => 1,
primary_ic => 1,
Order => 'cover_date',
};
is_deeply( clean_params($CLASS, { user__id => 1 }), $exp, 'set _checked_out to 1 for user__id');
Expand All @@ -431,6 +437,7 @@ sub testclean_params: Test(8) {
_not_simple => 1,
_checked_out => 0,
_not_checked_out => 0,
primary_ic => 1,
Order => 'cover_date',
};
is_deeply( clean_params($CLASS, { checked_out => '' }), $exp,
Expand All @@ -441,10 +448,34 @@ sub testclean_params: Test(8) {
_not_simple => 1,
_null_workflow_id => 1,
_checked_in_or_out => 1,
primary_ic => 1,
Order => 'cover_date',
};
is_deeply( clean_params($CLASS, { workflow__id => undef }),
$exp, 'undef workflow__id sets _null_workflow_id');

$exp = {
active => 1,
_no_return_versions => 1,
_not_simple => 1,
_checked_in_or_out => 1,
input_channel_id => 1,
Order => 'cover_date',
};
is_deeply( clean_params($CLASS, { input_channel_id =>1 }), $exp,
"don't set primary_ic when input_channel_id is set");

$exp = {
active => 1,
_no_return_versions => 1,
_not_simple => 1,
_checked_in_or_out => 1,
primary_ic_id => 1,
Order => 'cover_date',
};
is_deeply( clean_params($CLASS, { primary_ic_id =>1 }), $exp,
"don't set primary_ic when primary_ic_id is set");

}


Expand Down

0 comments on commit 0f4f1fc

Please sign in to comment.