Lines 55-64
$retrieved_news_item_1->delete;
Link Here
|
55 |
is( Koha::News->search->count, $nb_of_news + 1, 'Delete should have deleted the news_item' ); |
55 |
is( Koha::News->search->count, $nb_of_news + 1, 'Delete should have deleted the news_item' ); |
56 |
|
56 |
|
57 |
subtest '->author' => sub { |
57 |
subtest '->author' => sub { |
58 |
plan tests => 1; |
58 |
plan tests => 3; |
59 |
|
59 |
|
60 |
my $news_item = $builder->build_object({ class => 'Koha::News' }); |
60 |
my $news_item = $builder->build_object({ class => 'Koha::News' }); |
61 |
is( ref($news_item->author), 'Koha::Patron', 'Koha::NewsItem->author returns a Koha::Patron object' ); |
61 |
my $author = $news_item->author; |
|
|
62 |
is( ref($author), 'Koha::Patron', 'Koha::NewsItem->author returns a Koha::Patron object' ); |
63 |
|
64 |
$author->delete; |
65 |
|
66 |
$news_item = Koha::News->find($news_item->idnew); |
67 |
is( ref($news_item), 'Koha::NewsItem', 'News are not deleted alongwith the author' ); |
68 |
is( $news_item->author, undef, '->author returns undef is the author has been deleted' ); |
62 |
}; |
69 |
}; |
63 |
|
70 |
|
64 |
$schema->storage->txn_rollback; |
71 |
$schema->storage->txn_rollback; |
65 |
- |
|
|