From e7dbd2a8b7683e78f9420d0e86e9dc651f067c2e Mon Sep 17 00:00:00 2001 From: Pedro Amorim Date: Fri, 27 Sep 2024 18:42:58 +0000 Subject: [PATCH] Bug 37856: Add new test to test platform is correctly added to build_url prove t/db\_dependent/Koha/ERM/EUsage/UsageDataProvider.t Signed-off-by: Katrin Fischer --- .../Koha/ERM/EUsage/UsageDataProvider.t | 37 ++++++++++++++++++- 1 file changed, 36 insertions(+), 1 deletion(-) diff --git a/t/db_dependent/Koha/ERM/EUsage/UsageDataProvider.t b/t/db_dependent/Koha/ERM/EUsage/UsageDataProvider.t index bde75ecbb7..2513b6f247 100755 --- a/t/db_dependent/Koha/ERM/EUsage/UsageDataProvider.t +++ b/t/db_dependent/Koha/ERM/EUsage/UsageDataProvider.t @@ -29,7 +29,7 @@ my $builder = t::lib::TestBuilder->new; subtest '_build_url_query' => sub { - plan tests => 1; + plan tests => 2; $schema->storage->txn_begin; @@ -70,6 +70,41 @@ subtest '_build_url_query' => sub { . substr( $usage_data_provider->{end_date}, 0, 7 ) ); + my $test_platform = 'www.whatever.com'; + + my $usage_data_provider_with_platform = $builder->build_object( + { + class => 'Koha::ERM::EUsage::UsageDataProviders', + value => { + service_url => $service_url, api_key => $api_key, requestor_id => $requestor_id, + customer_id => $customer_id, name => $name, service_platform => $test_platform + } + } + ); + + $usage_data_provider_with_platform->{report_type} = 'TR_J1'; + $usage_data_provider_with_platform->{begin_date} = '2023-08-01'; + $usage_data_provider_with_platform->{end_date} = '2023-09-30'; + + is( + $usage_data_provider_with_platform->_build_url_query, + $service_url + . '/reports/' + . lc( $usage_data_provider->{report_type} ) + . '?customer_id=' + . $customer_id + . '&requestor_id=' + . $requestor_id + . '&api_key=' + . $api_key + . '&begin_date=' + . substr( $usage_data_provider->{begin_date}, 0, 7 ) + . '&end_date=' + . substr( $usage_data_provider->{end_date}, 0, 7 ) + . '&platform=' + . $test_platform + ); + $schema->storage->txn_rollback; }; -- 2.39.5