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

Item175: port a subset of the standard extensions over to the new namespace to make a working system with mixed TWiki and Foswiki plugins

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/CommentPlugin/test/unit/CommentPlugin/CommentPluginTests.pm

    r14 r811  
    88use Unit::Request; 
    99use Unit::Response; 
    10 use TWiki; 
    11 use TWiki::UI::Save; 
    12 use TWiki::Plugins::CommentPlugin; 
    13 use TWiki::Plugins::CommentPlugin::Comment; 
     10use Foswiki; 
     11use Foswiki::UI::Save; 
     12use Foswiki::Plugins::CommentPlugin; 
     13use Foswiki::Plugins::CommentPlugin::Comment; 
    1414use CGI; 
    1515 
     
    3434sub writeTopic { 
    3535    my( $this, $web, $topic, $text ) = @_; 
    36     my $meta = new TWiki::Meta($this->{twiki}, $web, $topic); 
     36    my $meta = new Foswiki::Meta($this->{twiki}, $web, $topic); 
    3737    $this->{twiki}->{store}->saveTopic( 
    3838        $this->{twiki}->{user}, $web, $topic, $text, $meta ); 
     
    6969    } 
    7070 
    71     my $url = "$TWiki::cfg{DefaultUrlHost}$TWiki::cfg{ScriptUrlPath}/save$TWiki::cfg{ScriptSuffix}/$web/$topic"; 
     71    my $url = "$Foswiki::cfg{DefaultUrlHost}$Foswiki::cfg{ScriptUrlPath}/save$Foswiki::cfg{ScriptSuffix}/$web/$topic"; 
    7272 
    7373    if ( $location ) { 
     
    103103    my $pidx = $eidx; 
    104104    my $html = 
    105       TWiki::Plugins::CommentPlugin::Comment::_handleInput( 
     105      Foswiki::Plugins::CommentPlugin::Comment::_handleInput( 
    106106          $sattrs, 
    107107          $this->{test_web}, 
     
    196196    } 
    197197 
    198     my $session = new TWiki( $TWiki::cfg{DefaultUserLoginName}, $query); 
     198    my $session = new Foswiki( $Foswiki::cfg{DefaultUserLoginName}, $query); 
    199199    my $text = "Ignore this text"; 
    200200 
    201201    # invoke the save handler 
    202     $this->capture(\&TWiki::UI::Save::save, $session ); 
    203  
    204     $text = TWiki::Func::readTopicText($web, $topic); 
     202    $this->capture(\&Foswiki::UI::Save::save, $session ); 
     203 
     204    $text = Foswiki::Func::readTopicText($web, $topic); 
    205205    $this->assert_matches(qr/$comm/, $text, "$web.$topic: $text"); 
    206206 
     
    278278    my $pidx = 0; 
    279279    my $html = 
    280       TWiki::Plugins::CommentPlugin::Comment::_handleInput 
     280      Foswiki::Plugins::CommentPlugin::Comment::_handleInput 
    281281          ("rows=99 cols=104 mode=after button=HoHo id=sausage",, 
    282282           $this->{test_topic}, 
     
    296296    my $pidx = 0; 
    297297    my $html = 
    298       TWiki::Plugins::CommentPlugin::Comment::_handleInput 
     298      Foswiki::Plugins::CommentPlugin::Comment::_handleInput 
    299299          ("target=\"$this->{test_web}.ATopic#AAnchor\" location=\"AnRE\"", 
    300300           $this->{test_topic}, 
     
    318318    my $pidx = 0; 
    319319    my $html = 
    320       TWiki::Plugins::CommentPlugin::Comment::_handleInput( 
     320      Foswiki::Plugins::CommentPlugin::Comment::_handleInput( 
    321321          'nopost="on"', 
    322322          $this->{test_web}, 
     
    339339    $query->path_info("/$this->{test_web}/$this->{test_topic}"); 
    340340 
    341     my $session = new TWiki( $TWiki::cfg{DefaultUserLoginName}, $query); 
     341    my $session = new Foswiki( $Foswiki::cfg{DefaultUserLoginName}, $query); 
    342342    my $text = "Ignore this text"; 
    343343 
    344344    # invoke the save handler 
    345     $this->capture(\&TWiki::UI::Save::save, $session ); 
    346  
    347     $text = TWiki::Func::readTopicText($this->{test_web}, $this->{test_topic}); 
     345    $this->capture(\&Foswiki::UI::Save::save, $session ); 
     346 
     347    $text = Foswiki::Func::readTopicText($this->{test_web}, $this->{test_topic}); 
    348348    # make sure it hasn't changed 
    349349    $text =~ s/^%META.*?\n//gm; 
     
    362362    my $pidx = 99; 
    363363    my $html = 
    364       TWiki::Plugins::CommentPlugin::Comment::_handleInput( 
     364      Foswiki::Plugins::CommentPlugin::Comment::_handleInput( 
    365365          'remove="on"', 
    366366          $this->{test_web}, 
     
    384384    $query->path_info("/$this->{test_web}/$this->{test_topic}"); 
    385385 
    386     my $session = new TWiki( $TWiki::cfg{DefaultUserLoginName}, $query); 
     386    my $session = new Foswiki( $Foswiki::cfg{DefaultUserLoginName}, $query); 
    387387    my $text = "Ignore this text"; 
    388388 
    389389    # invoke the save handler 
    390     $this->capture(\&TWiki::UI::Save::save, $session ); 
    391  
    392     $text = TWiki::Func::readTopicText($this->{test_web}, $this->{test_topic}); 
     390    $this->capture(\&Foswiki::UI::Save::save, $session ); 
     391 
     392    $text = Foswiki::Func::readTopicText($this->{test_web}, $this->{test_topic}); 
    393393    # make sure it hasn't changed 
    394394    $text =~ s/^%META.*?\n//gm; 
     
    411411    my $pidx = 99; 
    412412    my $html = 
    413       TWiki::Plugins::CommentPlugin::Comment::_handleInput( 
     413      Foswiki::Plugins::CommentPlugin::Comment::_handleInput( 
    414414          'default="wibble"', 
    415415          $this->{test_web}, 
Note: See TracChangeset for help on using the changeset viewer.