LIRE::TEST::DLFANALYSERTESTCASE(3pm)

πŸ“¦ version 2.1.1, in arch rolling

πŸ’… 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 (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