use Koha::Acquisition::Booksellers;
use Koha::Acquisition::Orders;
use Koha::Biblios;
+use Koha::Exceptions;
use Koha::Items;
use Koha::Number::Price;
use Koha::Libraries;
my @rows;
if ($csv_profile_id) {
my $csv_profile = Koha::CsvProfiles->find( $csv_profile_id );
- die "There is no valid csv profile given" unless $csv_profile;
+ Koha::Exceptions::ObjectNotFound->throw( 'There is no valid csv profile given') unless $csv_profile;
my $csv = Text::CSV_XS->new({'quote_char'=>'"','escape_char'=>'"','sep_char'=>$csv_profile->csv_separator,'binary'=>1});
my $csv_profile_content = $csv_profile->content;
use CGI;
-use Test::More tests => 3;
+use Test::More tests => 4;
use C4::Acquisition;
use C4::Biblio;
use Koha::Database;
-use Koha::CsvProfile;
-
+use Koha::CsvProfiles;
use Koha::Acquisition::Orders;
+
use t::lib::Mocks;
+use Try::Tiny;
my $schema = Koha::Database->new()->schema();
$schema->storage->txn_begin();
"King, Stephen","Test Record",3
', 'CSV should be generated with user profile which does not have all headers defined');
+try {
+ my $basket_csv4 = C4::Acquisition::GetBasketAsCSV($basketno, $query, 'non_existant_profile_id');
+ fail("It is not possible to export basket using non-existant profile");
+} catch {
+ ok($_->isa("Koha::Exceptions::ObjectNotFound"), "Using non-existant profile should throw ObjectNotFound exception");
+};
+
$schema->storage->txn_rollback();