Ignore:
Timestamp:
11/19/08 19:11:33 (4 years ago)
Author:
CrawfordCurrie
Message:

Item175: ported unit tests to new namespace. They all pass.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/UnitTestContrib/test/unit/Fn_IF.pm

    r664 r816  
    55package Fn_IF; 
    66 
    7 use base qw( TWikiFnTestCase ); 
    8  
    9 use TWiki; 
     7use base qw( FoswikiFnTestCase ); 
     8 
     9use Foswiki; 
    1010use Error qw( :try ); 
    1111 
     
    5959    $this->simpleTest( 
    6060        test => '$ WIKINAME = \'' 
    61           . TWiki::Func::getWikiName( $this->{twiki}->{user} ) . "'", 
     61          . Foswiki::Func::getWikiName( $this->{twiki}->{user} ) . "'", 
    6262        then => 1, 
    6363        else => 0 
     
    6969    $this->simpleTest( 
    7070        test => '$ \'WIKINAME\' = \'' 
    71           . TWiki::Func::getWikiName( $this->{twiki}->{user} ) . "'", 
     71          . Foswiki::Func::getWikiName( $this->{twiki}->{user} ) . "'", 
    7272        then => 1, 
    7373        else => 0 
     
    191191    my $this = shift; 
    192192    $this->simpleTest( 
    193         test => "\$PUBURLPATH='" . $TWiki::cfg{PubUrlPath} . "'", 
     193        test => "\$PUBURLPATH='" . $Foswiki::cfg{PubUrlPath} . "'", 
    194194        then => 1, 
    195195        else => 0 
     
    200200    my $this = shift; 
    201201    $this->simpleTest( 
    202         test => "\$'PUBURLPATH'='" . $TWiki::cfg{PubUrlPath} . "'", 
     202        test => "\$'PUBURLPATH'='" . $Foswiki::cfg{PubUrlPath} . "'", 
    203203        then => 1, 
    204204        else => 0 
     
    235235    $this->simpleTest( 
    236236        test => "d2n('2007-03-26')=" 
    237           . TWiki::Time::parseTime( '2007-03-26', 1 ), 
     237          . Foswiki::Time::parseTime( '2007-03-26', 1 ), 
    238238        then => 1, 
    239239        else => 0 
     
    280280    $this->simpleTest( 
    281281        test => "'" 
    282           . TWiki::Func::getWikiName( $this->{twiki}->{user} ) 
     282          . Foswiki::Func::getWikiName( $this->{twiki}->{user} ) 
    283283          . "' ingroup 'WikiGuest'", 
    284284        then => 0, 
     
    291291    $this->simpleTest( 
    292292        test => "'" 
    293           . TWiki::Func::wikiToUserName( 
    294             TWiki::Func::getWikiName( $this->{twiki}->{user} ) 
     293          . Foswiki::Func::wikiToUserName( 
     294            Foswiki::Func::getWikiName( $this->{twiki}->{user} ) 
    295295          ) 
    296296          . "' ingroup 'WikiGuest'", 
     
    314314    $this->simpleTest( 
    315315        test => "'" 
    316           . TWiki::Func::getWikiName( $this->{twiki}->{user} ) 
     316          . Foswiki::Func::getWikiName( $this->{twiki}->{user} ) 
    317317          . "' ingroup 'ThereHadBetterBeNoSuchGroup'", 
    318318        then => 0, 
     
    325325    $this->simpleTest( 
    326326        test => "'" 
    327           . TWiki::Func::wikiToUserName( 
    328             TWiki::Func::getWikiName( $this->{twiki}->{user} ) 
     327          . Foswiki::Func::wikiToUserName( 
     328            Foswiki::Func::getWikiName( $this->{twiki}->{user} ) 
    329329          ) 
    330330          . "' ingroup 'ThereHadBetterBeNoSuchGroup'", 
     
    350350    $this->simpleTest( 
    351351        test => "'" 
    352           . TWiki::Func::wikiToUserName( 
    353             TWiki::Func::getWikiName( $this->{twiki}->{user} ) 
     352          . Foswiki::Func::wikiToUserName( 
     353            Foswiki::Func::getWikiName( $this->{twiki}->{user} ) 
    354354          ) 
    355           . "' ingroup '$TWiki::cfg{SuperAdminGroup}'", 
     355          . "' ingroup '$Foswiki::cfg{SuperAdminGroup}'", 
    356356        then => 0, 
    357357        else => 1 
     
    363363    $this->simpleTest( 
    364364        test => "'" 
    365           . TWiki::Func::getWikiName( $this->{twiki}->{user} ) 
    366           . "' ingroup '$TWiki::cfg{SuperAdminGroup}'", 
     365          . Foswiki::Func::getWikiName( $this->{twiki}->{user} ) 
     366          . "' ingroup '$Foswiki::cfg{SuperAdminGroup}'", 
    367367        then => 0, 
    368368        else => 1 
     
    375375        test => "'" 
    376376          . $this->{twiki}->{user} 
    377           . "' ingroup '$TWiki::cfg{SuperAdminGroup}'", 
     377          . "' ingroup '$Foswiki::cfg{SuperAdminGroup}'", 
    378378        then => 0, 
    379379        else => 1 
     
    386386    $this->simpleTest( 
    387387        test => "'" 
    388           . TWiki::Func::wikiToUserName( 
    389             TWiki::Func::getWikiName( $this->{twiki}->{user} ) 
     388          . Foswiki::Func::wikiToUserName( 
     389            Foswiki::Func::getWikiName( $this->{twiki}->{user} ) 
    390390          ) 
    391391          . "' ingroup 'GropeGroup'", 
     
    399399    $this->simpleTest( 
    400400        test => "'" 
    401           . TWiki::Func::getWikiName( $this->{twiki}->{user} ) 
     401          . Foswiki::Func::getWikiName( $this->{twiki}->{user} ) 
    402402          . "' ingroup 'GropeGroup'", 
    403403        then => 1, 
     
    439439    my $this = shift; 
    440440    $this->simpleTest( 
    441         test => "'%USERNAME%' ingroup '$TWiki::cfg{SuperAdminGroup}'", 
     441        test => "'%USERNAME%' ingroup '$Foswiki::cfg{SuperAdminGroup}'", 
    442442        then => 0, 
    443443        else => 1 
     
    477477    $this->simpleTest( 
    478478        test => "'%USERINFO{format=\"\$username\"}%' ingroup '" 
    479           . $TWiki::cfg{SuperAdminGroup} . "'", 
     479          . $Foswiki::cfg{SuperAdminGroup} . "'", 
    480480        then => 0, 
    481481        else => 1 
     
    515515    $this->simpleTest( 
    516516        test => "'%USERINFO{format=\"\$wikiname\"}%' ingroup '" 
    517           . $TWiki::cfg{SuperAdminGroup} . "'", 
     517          . $Foswiki::cfg{SuperAdminGroup} . "'", 
    518518        then => 0, 
    519519        else => 1 
     
    553553    $this->simpleTest( 
    554554        test => "'%USERINFO{format=\"\$wikiusername\"}%' ingroup '" 
    555           . $TWiki::cfg{SuperAdminGroup} . "'", 
     555          . $Foswiki::cfg{SuperAdminGroup} . "'", 
    556556        then => 0, 
    557557        else => 1 
     
    572572    $this->simpleTest( 
    573573        test => "'" 
    574           . TWiki::Func::getWikiName( $this->{twiki}->{user} ) 
     574          . Foswiki::Func::getWikiName( $this->{twiki}->{user} ) 
    575575          . "' ingroup 'WikiGuest'", 
    576576        then => 0, 
     
    583583    $this->simpleTest( 
    584584        test => "'" 
    585           . TWiki::Func::getWikiName( $this->{twiki}->{user} ) 
     585          . Foswiki::Func::getWikiName( $this->{twiki}->{user} ) 
    586586          . "' ingroup 'ThereHadBetterBeNoSuchGroup'", 
    587587        then => 0, 
     
    594594    $this->simpleTest( 
    595595        test => "'" 
    596           . TWiki::Func::getWikiName( $this->{twiki}->{user} ) 
     596          . Foswiki::Func::getWikiName( $this->{twiki}->{user} ) 
    597597          . "' ingroup '" 
    598           . $TWiki::cfg{SuperAdminGroup} . "'", 
     598          . $Foswiki::cfg{SuperAdminGroup} . "'", 
    599599        then => 0, 
    600600        else => 1 
     
    606606    $this->simpleTest( 
    607607        test => "'" 
    608           . TWiki::Func::getWikiName( $this->{twiki}->{user} ) 
     608          . Foswiki::Func::getWikiName( $this->{twiki}->{user} ) 
    609609          . "' ingroup 'GropeGroup'", 
    610610        then => 1, 
     
    616616    my $this = shift; 
    617617    $this->simpleTest( 
    618         test => "'" . $TWiki::cfg{AdminUserWikiName} . "' ingroup 'WikiGuest'", 
     618        test => "'" . $Foswiki::cfg{AdminUserWikiName} . "' ingroup 'WikiGuest'", 
    619619        then => 0, 
    620620        else => 1 
     
    626626    $this->simpleTest( 
    627627        test => "'" 
    628           . $TWiki::cfg{AdminUserWikiName} 
     628          . $Foswiki::cfg{AdminUserWikiName} 
    629629          . "' ingroup 'ThereHadBetterBeNoSuchGroup'", 
    630630        then => 0, 
     
    637637    $this->simpleTest( 
    638638        test => "'" 
    639           . $TWiki::cfg{AdminUserWikiName} 
     639          . $Foswiki::cfg{AdminUserWikiName} 
    640640          . "' ingroup '" 
    641           . $TWiki::cfg{SuperAdminGroup} . "'", 
     641          . $Foswiki::cfg{SuperAdminGroup} . "'", 
    642642        then => 1, 
    643643        else => 0 
     
    648648    my $this = shift; 
    649649    $this->simpleTest( 
    650         test => "'" . $TWiki::cfg{AdminUserWikiName} . "' ingroup 'GropeGroup'", 
     650        test => "'" . $Foswiki::cfg{AdminUserWikiName} . "' ingroup 'GropeGroup'", 
    651651        then => 0, 
    652652        else => 1 
     
    658658    $this->simpleTest( 
    659659        test => "'" 
    660           . $TWiki::cfg{DefaultUserWikiName} 
     660          . $Foswiki::cfg{DefaultUserWikiName} 
    661661          . "' ingroup 'WikiGuest'", 
    662662        then => 0, 
     
    669669    $this->simpleTest( 
    670670        test => "'" 
    671           . $TWiki::cfg{DefaultUserWikiName} 
     671          . $Foswiki::cfg{DefaultUserWikiName} 
    672672          . "' ingroup 'ThereHadBetterBeNoSuchGroup'", 
    673673        then => 0, 
     
    680680    $this->simpleTest( 
    681681        test => "'" 
    682           . $TWiki::cfg{DefaultUserWikiName} 
     682          . $Foswiki::cfg{DefaultUserWikiName} 
    683683          . "' ingroup '" 
    684           . $TWiki::cfg{SuperAdminGroup} . "'", 
     684          . $Foswiki::cfg{SuperAdminGroup} . "'", 
    685685        then => 0, 
    686686        else => 1 
     
    691691    my $this = shift; 
    692692    $this->simpleTest( 
    693         test => "'$TWiki::cfg{DefaultUserWikiName}' ingroup 'GropeGroup'", 
     693        test => "'$Foswiki::cfg{DefaultUserWikiName}' ingroup 'GropeGroup'", 
    694694        then => 1, 
    695695        else => 0 
     
    700700    my $this = shift; 
    701701    $this->simpleTest( 
    702         test => "'" . $TWiki::cfg{AdminUserLogin} . "' ingroup 'WikiGuest'", 
     702        test => "'" . $Foswiki::cfg{AdminUserLogin} . "' ingroup 'WikiGuest'", 
    703703        then => 0, 
    704704        else => 1 
     
    710710    $this->simpleTest( 
    711711        test => "'" 
    712           . $TWiki::cfg{AdminUserLogin} 
     712          . $Foswiki::cfg{AdminUserLogin} 
    713713          . "' ingroup 'ThereHadBetterBeNoSuchGroup'", 
    714714        then => 0, 
     
    721721    $this->simpleTest( 
    722722        test => "'" 
    723           . $TWiki::cfg{AdminUserLogin} 
     723          . $Foswiki::cfg{AdminUserLogin} 
    724724          . "' ingroup '" 
    725           . $TWiki::cfg{SuperAdminGroup} . "'", 
     725          . $Foswiki::cfg{SuperAdminGroup} . "'", 
    726726        then => 1, 
    727727        else => 0 
     
    732732    my $this = shift; 
    733733    $this->simpleTest( 
    734         test => "'" . $TWiki::cfg{AdminUserLogin} . "' ingroup 'GropeGroup'", 
     734        test => "'" . $Foswiki::cfg{AdminUserLogin} . "' ingroup 'GropeGroup'", 
    735735        then => 0, 
    736736        else => 1 
     
    741741    my $this = shift; 
    742742    $this->simpleTest( 
    743         test => "'" . $TWiki::cfg{DefaultUserLogin} . "' ingroup 'WikiGuest'", 
     743        test => "'" . $Foswiki::cfg{DefaultUserLogin} . "' ingroup 'WikiGuest'", 
    744744        then => 0, 
    745745        else => 1 
     
    751751    $this->simpleTest( 
    752752        test => "'" 
    753           . $TWiki::cfg{DefaultUserLogin} 
     753          . $Foswiki::cfg{DefaultUserLogin} 
    754754          . "' ingroup 'ThereHadBetterBeNoSuchGroup'", 
    755755        then => 0, 
     
    762762    $this->simpleTest( 
    763763        test => "'" 
    764           . $TWiki::cfg{DefaultUserLogin} 
     764          . $Foswiki::cfg{DefaultUserLogin} 
    765765          . "' ingroup '" 
    766           . $TWiki::cfg{SuperAdminGroup} . "'", 
     766          . $Foswiki::cfg{SuperAdminGroup} . "'", 
    767767        then => 0, 
    768768        else => 1 
     
    773773    my $this = shift; 
    774774    $this->simpleTest( 
    775         test => "'" . $TWiki::cfg{DefaultUserLogin} . "' ingroup 'GropeGroup'", 
     775        test => "'" . $Foswiki::cfg{DefaultUserLogin} . "' ingroup 'GropeGroup'", 
    776776        then => 1, 
    777777        else => 0 
     
    782782    my $this = shift; 
    783783    $this->simpleTest( 
    784         test => "'" . $TWiki::cfg{AdminUserLogin} . "' ingroup 'WikiGuest'", 
     784        test => "'" . $Foswiki::cfg{AdminUserLogin} . "' ingroup 'WikiGuest'", 
    785785        then => 0, 
    786786        else => 1 
     
    792792    $this->simpleTest( 
    793793        test => "'" 
    794           . $TWiki::cfg{AdminUserLogin} 
     794          . $Foswiki::cfg{AdminUserLogin} 
    795795          . "' ingroup 'ThereHadBetterBeNoSuchGroup'", 
    796796        then => 0, 
     
    803803    $this->simpleTest( 
    804804        test => "'" 
    805           . $TWiki::cfg{AdminUserLogin} 
     805          . $Foswiki::cfg{AdminUserLogin} 
    806806          . "' ingroup '" 
    807           . $TWiki::cfg{SuperAdminGroup} . "'", 
     807          . $Foswiki::cfg{SuperAdminGroup} . "'", 
    808808        then => 1, 
    809809        else => 0 
     
    814814    my $this = shift; 
    815815    $this->simpleTest( 
    816         test => "'" . $TWiki::cfg{AdminUserLogin} . "' ingroup 'GropeGroup'", 
     816        test => "'" . $Foswiki::cfg{AdminUserLogin} . "' ingroup 'GropeGroup'", 
    817817        then => 0, 
    818818        else => 1 
     
    823823    my $this = shift; 
    824824    $this->simpleTest( 
    825         test => "'" . $TWiki::cfg{DefaultUserLogin} . "' ingroup 'WikiGuest'", 
     825        test => "'" . $Foswiki::cfg{DefaultUserLogin} . "' ingroup 'WikiGuest'", 
    826826        then => 0, 
    827827        else => 1 
     
    833833    $this->simpleTest( 
    834834        test => "'" 
    835           . $TWiki::cfg{DefaultUserLogin} 
     835          . $Foswiki::cfg{DefaultUserLogin} 
    836836          . "' ingroup 'ThereHadBetterBeNoSuchGroup'", 
    837837        then => 0, 
     
    844844    $this->simpleTest( 
    845845        test => "'" 
    846           . $TWiki::cfg{DefaultUserLogin} 
     846          . $Foswiki::cfg{DefaultUserLogin} 
    847847          . "' ingroup '" 
    848           . $TWiki::cfg{SuperAdminGroup} . "'", 
     848          . $Foswiki::cfg{SuperAdminGroup} . "'", 
    849849        then => 0, 
    850850        else => 1 
     
    855855    my $this = shift; 
    856856    $this->simpleTest( 
    857         test => "'" . $TWiki::cfg{DefaultUserLogin} . "' ingroup 'GropeGroup'", 
     857        test => "'" . $Foswiki::cfg{DefaultUserLogin} . "' ingroup 'GropeGroup'", 
    858858        then => 1, 
    859859        else => 0 
     
    863863sub test_90 { 
    864864    my $this = shift; 
    865     $this->simpleTest( test => "isweb 'TWiki'", then => 1, else => 0 ); 
     865    $this->simpleTest( test => "isweb 'System'", then => 1, else => 0 ); 
    866866} 
    867867 
     
    873873sub test_92 { 
    874874    my $this = shift; 
    875     $this->simpleTest( test => "istopic \$'TWiki'", then => 0, else => 1 ); 
     875    $this->simpleTest( test => "istopic \$'System'", then => 0, else => 1 ); 
    876876} 
    877877 
     
    935935        "GropeGroup", 
    936936        "   * Set GROUP = " 
    937           . TWiki::Func::getWikiName( $this->{twiki}->{user} ) . "\n" 
     937          . Foswiki::Func::getWikiName( $this->{twiki}->{user} ) . "\n" 
    938938    ); 
    939939 
     
    951951    my ( $this, %test ) = @_; 
    952952    $this->{twiki}->enterContext('test'); 
    953     $TWiki::cfg{Fnargle} = 'Fleeble'; 
    954     $TWiki::cfg{A}{B} = 'C'; 
     953    $Foswiki::cfg{Fnargle} = 'Fleeble'; 
     954    $Foswiki::cfg{A}{B} = 'C'; 
    955955    $this->{request}->param('notempty','v'); 
    956956    $this->{request}->param('empty',''); 
     
    963963 
    964964    my $meta = 
    965       new TWiki::Meta( $this->{twiki}, $this->{test_web}, $this->{test_topic} ); 
     965      new Foswiki::Meta( $this->{twiki}, $this->{test_web}, $this->{test_topic} ); 
    966966    my $text = '%IF{"' 
    967967      . $test{test} 
     
    10381038sub test_ALLOWS_and_EXISTS { 
    10391039    my $this = shift; 
    1040     my $wn   = TWiki::Func::getWikiName( $this->{twiki}->{user} ); 
     1040    my $wn   = Foswiki::Func::getWikiName( $this->{twiki}->{user} ); 
    10411041    $this->{twiki}->{store} 
    10421042      ->saveTopic( $this->{twiki}->{user}, $this->{test_web}, "DeadDog", 
     
    11841184 
    11851185    $this->{twiki}->finish(); 
    1186     $this->{twiki} = new TWiki(); 
     1186    $this->{twiki} = new Foswiki(); 
    11871187    $this->{twiki}->{webName} = $this->{test_web};    # hack 
    11881188 
     
    12311231        $this->{twiki}->{store}->topicExists( $this->{test_web}, $topicName ) ); 
    12321232 
    1233 #TODO: these need to be moved into Fn_META and then implemented (its a really simple change in TWiki.pm 
     1233#TODO: these need to be moved into Fn_META and then implemented (its a really simple change in Foswiki.pm 
    12341234#    $this->assert_str_equals( 
    12351235#        $this->{twiki}->handleCommonTags( 
Note: See TracChangeset for help on using the changeset viewer.