source: wiki-toolkit-plugin-categoriser/trunk/t/nested_categories.t @ 382

Last change on this file since 382 was 382, checked in by kake, 14 years ago

Explicitly skip tests if no backends configured, to avoid spurious test failure reports.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 1.0 KB
Line 
1use strict;
2use Wiki::Toolkit::Plugin::Categoriser;
3use Wiki::Toolkit::TestLib;
4use Test::More;
5
6my $iterator = Wiki::Toolkit::TestLib->new_wiki_maker;
7if ( $iterator->number ) {
8    plan tests => ( $iterator->number * 1 );
9} else {
10    plan skip_all => "No backends configured.";
11}
12
13while ( my $wiki = $iterator->new_wiki ) {
14    print "#\n##### TEST CONFIG: Store: " . (ref $wiki->store) . "\n";
15
16    my $categoriser = Wiki::Toolkit::Plugin::Categoriser->new;
17    $wiki->register_plugin( plugin => $categoriser );
18
19    $wiki->write_node( "Pub Food", "pubs that serve food", undef,
20                        { category => [ "Pubs", "Food", "Category" ] } )
21      or die "Can't write node";
22
23    $wiki->write_node( "Restaurants", "places that serve food", undef,
24                        { category => [ "Food", "Category" ] } )
25      or die "Can't write node";
26
27    my @subcategories = $categoriser->subcategories( category => "Pubs" );
28    is_deeply( \@subcategories, [ "Pub Food" ],
29     "->subcategories returns things that belong, and not things that don't" );
30}
Note: See TracBrowser for help on using the repository browser.