use Carp qw( croak );
use Koha::Acquisition::Baskets;
+use Koha::Acquisition::Funds;
use Koha::Database;
use Koha::DateUtils qw( dt_from_string output_pref );
return Koha::Acquisition::Basket->_new_from_dbic( $basket_rs );
}
+=head3 fund
+
+ my $fund = $order->fund
+
+Returns the fund (aqbudgets) associated to the order.
+
+=cut
+
+sub fund {
+ my ( $self ) = @_;
+ my $fund_rs = $self->_result->budget;
+ return Koha::Acquisition::Fund->_new_from_dbic( $fund_rs );
+}
+
=head2 Internal methods
=head3 _type
use Modern::Perl;
-use Test::More tests => 2;
+use Test::More tests => 3;
use t::lib::TestBuilder;
use t::lib::Mocks;
};
$schema->storage->txn_rollback;
};
+
+subtest 'fund' => sub {
+ plan tests => 1;
+
+ $schema->storage->txn_begin;
+ my $o = $builder->build_object(
+ {
+ class => 'Koha::Acquisition::Orders',
+ }
+ );
+
+ my $order = Koha::Acquisition::Orders->find( $o->ordernumber );
+ is( ref( $order->fund ),
+ 'Koha::Acquisition::Fund',
+ '->fund should return a Koha::Acquisition::Fund object' );
+ $schema->storage->txn_rollback;
+};