LIRE::TEST::DLFANALYSERTESTCASE(3pm)
π Lire::Test::DlfAnalyserTestCase β NAME
ok so Lire::Test::DlfAnalyserTestCase is the base class for writing DlfAnalyser unit tests π§ͺβ¨ It's giving "I do the boring scaffolding so you can just vibe and test your analyser."
πΈ SYNOPSIS
use base qw/ Lire::Test::DlfAnalyserTestCase /;
use MyAnalyser;
use File::Basename;
sub create_analyser {
return new MyAnalyser();
}
sub schemasdir {
return dirname( __FILE__ ) . "../..";
}
sub registration_file {
return dirname( __FILE__ ) . "../../myanalyser_init";
}
Like, that's the whole vibe. Bestie, you just inherit and fill in three little methods. π«Ά
β¨ DESCRIPTION
So this is a Test::Unit::TestCase subclass, and its whole main-character job is making it easy to write tests for DlfAnalyser. π The class implements everything you need to provide the necessary fixture in set_up() and tear_down() β you literally don't have to think about it.
It brings you two base tests for free: test_api() and test_registration_file(). π
And your test class needs to implement three methods to help complete the fixture. That's it. Three. Iconic behaviour, no notes.
π¦ FIXTURES
These are the methods that subclasses will usually override to hand over the data so the DlfAnalyser test fixtures can be set up. Override them, slay, done. π
registration_file()
This one should return the script that's responsible for registering the analyser with the Lire::PluginManager. π§ It's used by the default test_registration_file().
schemasdir()
This method should return the directory that holds the schemas used by the analyser. π It gets added to the lr_schemas_path configuration variable. iykyk.
create_analyser()
This should return an instance of the Lire::DlfAnalyser instance to test. π Literally just hand it your analyser and go.
π§ͺ Mock Converter Process
create_mock_process( [ $store ])
This method returns a MockDlfAnalyserProcess which you can use to help test the DlfAnalyser. π₯ Everything passed to write_dlf() and error() gets saved, and you can query it all back through the dlf() and errors() methods.
Heads up: the dlf() method returns an array reference of array references. π« The first element in the inner arrays is the dlf, and the other elements are the related DLF id, if there is one.
The mock process's analyser_instance() method returns the DlfAnalyser created by create_analyser() and associated to its instance. Match made in heaven honestly.
The optional $store parameter should be a Lire::DlfStore instance, and it'll be available through the dlf_store() method. π
π DEFAULT TESTS
test_api()
Makes sure that all methods required by Lire::DlfAnalyser are implemented. β
It also tests that the src_schema() and dst_schema() are available.
Plus it checks that description() formats correctly as DocBook. π no cap, that's a real check.
test_registration_file()
Checks that the registration script correctly registers the analyser with the PluginManager. π― That's the whole test. Short, sweet, effective.
π SEE ALSO
Go read those too, bestie, they're right there. π
β AUTHOR
Francis J. Lacoste <flacoste@logreport.org> β the icon who wrote this π«Ά
π VERSION
$Id: DlfAnalyserTestCase.pm,v 1.3 2006/07/23 13:16:31 vanbaal Exp $
π COPYRIGHT
Copyright (C) 2004 Stichting LogReport Foundation LogReport@LogReport.org
This file is part of Lire.
Lire is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program (see COPYING); if not, check with http://www.gnu.org/copyleft/gpl.html.
β οΈ ok real talk for one sec: that warranty disclaimer is NOT a vibe, it's a legally binding "we are not responsible if this eats your data" β read it, don't skip it, kay? π
and that's the whole page, bestie! πΈ this lil beauty is from Lire 2.1.1, dated 2025-09-28, and yes the manual page name is DlfAnalyserTestCase(3pm) β drink water, write your tests, ily π
β¨
π¦ where this page comes from
- arch rolling: lire 2.1.1-8 Β· GPL-2.0-only
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms