Wiki::...estLib(3pm)

πŸ“¦
version 0.86 Β· 3 versions
, in debian bookworm, debian trixie, ubuntu jammy, ubuntu noble, ubuntu resolute, ubuntu stonking

✨ Wiki::Toolkit::TestLib ✨

Okay so this is the manual page for Wiki::Toolkit::TestLib, part of the User Contributed Perl Documentation. It's giving "test helper module realness" and honestly? We stan a utility queen. πŸ’…


🌸 NAME 🌸

Wiki::Toolkit::TestLib β€” literally just utilities for writing Wiki::Toolkit tests. That's it. That's the vibe. πŸŽ€


πŸ’– DESCRIPTION πŸ’–

So here's the tea, bestie: when you run perl Makefile.PL on a Wiki::Toolkit distribution, it goes around gathering info about test databases and stuff that you can use for running tests. And Wiki::Toolkit::TestLib? It gives you convenient access to all that info. No cap. 🫢


✨ SYNOPSIS ✨

use strict;
use Wiki::Toolkit::TestLib;
use Test::More;

my $iterator = Wiki::Toolkit::TestLib->new_wiki_maker;
plan tests => ( $iterator->number * 6 );

while ( my $wiki = $iterator->new_wiki ) {
    # put some test data in
    # run six tests
}

Every single time you call ->next on your iterator, you get a fresh blank wiki object. Iconic. The iterator will iterate over all configured search and storage backends.

Also important: the Lucy search backend is configured to index three metadata fields β€” address, category, and locale. Slay. πŸ”₯


πŸ‘‘ METHODS πŸ‘‘

πŸ¦‹ new_wiki_maker

my $iterator = Wiki::Toolkit::TestLib->new_wiki_maker;

This is the main character constructor. Makes you your iterator. Periodt.


🧚 number

use Test::More;
my $iterator = Wiki::Toolkit::TestLib->new_wiki_maker;
plan tests => ( $iterator->number * 6 );

Returns the number of new wikis that your iterator will be able to give you. Very "how many outfits do I have left" energy. πŸ’œ


🌈 new_wiki

my $wiki = $iterator->new_wiki;

Returns a fresh blank wiki object β€” or false if you've used up all the configured search and storage backends. So like, when it's empty, it's empty. Sad but true. 😭


πŸ“ configured_databases

my @configured_databases = $iterator->configured_databases;

Returns the @configured_databases array detailing configured test databases. Useful for very low-level testing only β€” like, do not come for this method unless you know what you're doing, iykyk. πŸ™ˆ


🌟 SEE ALSO 🌟

  • Wiki::Toolkit

πŸ’Œ AUTHOR πŸ’Œ

Kake Pugh (kake@earth.li). A legend. 🫑


Copyright (C) 2003-2004 Kake Pugh.  All Rights Reserved.
Copyright (C) 2008 the Wiki::Toolkit team. All Rights Reserved.

This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. So like, go off. 🌸


⚠️ CAVEATS ⚠️

Okay so if you have the Search::InvertedIndex backend configured (see Wiki::Toolkit::Search::SII), your tests will raise warnings like these in unexpected places:

(in cleanup) Search::InvertedIndex::DB::Mysql::lock() -
  testdb is not open. Can't lock.
at /usr/local/share/perl/5.6.1/Search/InvertedIndex.pm line 1348

or

(in cleanup) Can't call method "sync" on an undefined value
  at /usr/local/share/perl/5.6.1/Tie/DB_File/SplitHash.pm line 331
  during global destruction.

The author literally said: "I don't know whether this is a bug in me or in Search::InvertedIndex." And honestly? Same. πŸ’€ It's a whole mystery. Not me getting jump-scared by random warnings mid-test run. 🫠


βœ¨πŸ’– And that's the whole page, bestie! This was Wiki::Toolkit::TestLib, from perl v5.32.0, dated 2021-01-04. Go write some iconic tests. Mwah! πŸ’–βœ¨

πŸ“¦ where this page comes from