NAME
ETL::Pipeline::Output::UnitTest - Output destination for unit tests
SYNOPSIS
use ETL::Pipeline;
ETL::Pipeline->new( {
input => ['UnitTest'],
mapping => {First => 'Header1', Second => 'Header2'},
output => ['UnitTest']
} )->process;
DESCRIPTION
ETL::Pipeline::Output::UnitTest is an output destination used by the unit tests. It proves that the ETL::Pipeline::Output role works. You should not use this destination in production code - only unit tests.
The data is stored in memory. The class provides methods to access the saved records.
METHODS & ATTRIBUTES
Arguments for "output" in ETL::Pipeline
None - there's no configuration for this destination. It's meant to be quick and light for unit testing.
Attributes
records
In ETL::Pipeline::Output::UnitTest, a record is a hash reference. records stores a list of record (hash references). The list survives after calling "finish". This allows you to check the results of a test after calling "process" in ETL::Pipeline.
The list is cleared after calling "configure".
Methods
all_records
Returns a list of all the records. It dereferences "records".
close
Prevents further storage of records. "write" will throw a fatal exception if it is called after close. This helps ensure that everything runs in the proper order.
get_record
Returns a single record from storage. Useful to check the values and make sure things were added in the correct order. It returns the ame hash reference passed into "write".
number_of_records
Returns the count of records currently in storage.
open
Allows storage of records. "write" will throw a fatal exception if it is called before open. This helps ensure that everything runs in the proper order.
write
Add the current record into the "records" attribute. Unit tests can then check what was saved, to make sure the pipeline completed.
SEE ALSO
ETL::Pipeline, ETL::Pipeline::Output, ETL::Pipeline::Input::UnitTest
AUTHOR
Robert Wohlfarth <robert.j.wohlfarth@vumc.org>
LICENSE
Copyright 2021 (c) Vanderbilt University
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.