The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

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.

The "data" is stored in memory.

METHODS & 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".

all_records

The all_records method returns a list of all the records. It dereferences "records".

number_of_records

The number_of_records method returns the count of records currently in the list.

Called from "process" in ETL::Pipeline

write_record

Saves the current record into "records".

configure

configure doesn't actually do anything. But it is required by "process" in ETL::Pipeline.

finish

finish doesn't actually do anything. But it is required by "process" in ETL::Pipeline. "records" persists so that the unit test can check its values.

Other methods & attributes

default_fields

Initialize "current" for the next record.

SEE ALSO

ETL::Pipeline, ETL::Pipeline::Output, ETL::Pipeline::Output::Storage::Hash, ETL::Pipeline::Input::UnitTest

AUTHOR

Robert Wohlfarth <robert.j.wohlfarth@vanderbilt.edu>

LICENSE

Copyright 2016 (c) Vanderbilt University

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.