Show
Ignore:
Timestamp:
10/18/08 15:14:23 (4 years ago)
Author:
nick
Message:

Add store->list_metadata_names, which will tell you all the different metadata types (names)

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • wiki-toolkit/trunk/t/061_list_metadata_by_type.t

    r454 r457  
    66    plan skip_all => "no backends configured"; 
    77} else { 
    8     plan tests => ( 6 * scalar @Wiki::Toolkit::TestLib::wiki_info ); 
     8    plan tests => ( 9 * scalar @Wiki::Toolkit::TestLib::wiki_info ); 
    99} 
    1010 
     
    3333    $wiki->write_node( "Cafe Roma", "A cafe unmod", $node{"checksum"}, 
    3434        { category => [ "Cafe", "Oxford", "Unmoderated", "NotSeen" ], 
    35           latitude => "51.759", longitude => "-1.270" } 
     35          latitude => "51.759", longitude => "-1.270", 
     36          locale => [ "Oxford" ] }, 
    3637    ); 
    3738 
     
    3940    my @md; 
    4041 
     42 
    4143    # With nothing, get back undef 
    4244    is($wiki->store->list_metadata_by_type(), undef, "Needs a type given"); 
     45 
    4346 
    4447    # Postcode should be easy 
     
    4750       "Correct metadata listing" ); 
    4851 
     52 
    4953    # Latitude also 
    5054    @md = $wiki->store->list_metadata_by_type("latitude"); 
    5155    is_deeply( [sort @md], [ "51.759", "51.911" ], 
    5256       "Correct metadata listing" ); 
     57 
    5358 
    5459    # For category, will not see unmoderated versio 
     
    5762                           "Oxford", "Restaurant", "Thai Food" ], 
    5863       "Correct metadata listing" ); 
     64 
     65    @md = $wiki->store->list_metadata_names(); 
     66    is_deeply( [sort @md], [ "category", "latitude", "longitude", "postcode" ], 
     67       "Correct metadata names" ); 
     68 
    5969 
    6070    # Now moderate that one, see it come in 
     
    6575       "Correct metadata listing" ); 
    6676 
     77    @md = $wiki->store->list_metadata_names(); 
     78    is_deeply( [sort @md], [ "category", "latitude", "locale", 
     79                             "longitude", "postcode" ], 
     80       "Correct metadata names" ); 
     81 
     82 
    6783    # And un-moderate another, see its go away 
    6884    $wiki->store->dbh->do("UPDATE content SET moderated = 'f' WHERE version = 2"); 
     
    7187                           "Oxford", "Restaurant", "Thai Food" ], 
    7288       "Correct metadata listing" ); 
     89 
     90    @md = $wiki->store->list_metadata_names(); 
     91    is_deeply( [sort @md], [ "category", "latitude", "longitude", "postcode" ], 
     92       "Correct metadata names" ); 
    7393} 
    7494