which would replace the following mess

    $this->SUPER::set_up();

    $Foswiki::cfg{StoreImpl} = "RcsLite";
    $Foswiki::cfg{AutoAttachPubFiles} = 0;
    $Foswiki::cfg{Register}{AllowLoginName} = 1;
    $Foswiki::cfg{Htpasswd}{FileName} = "$Foswiki::cfg{WorkingDir}/htpasswd";
    $Foswiki::cfg{PasswordManager} = 'Foswiki::Users::HtPasswdUser';
    $Foswiki::cfg{UserMappingManager} = 'Foswiki::Users::TopicUserMapping';
    $Foswiki::cfg{LoginManager} = 'Foswiki::LoginManager::TemplateLogin';
    $Foswiki::cfg{Register}{EnableNewUserRegistration} = 1;
    $Foswiki::cfg{RenderLoggedInButUnknownUsers} = 0;

    $Foswiki::cfg{Register}{NeedVerification} = 0;
    $Foswiki::cfg{MinPasswordLength} = 0;
    $Foswiki::cfg{UsersWebName} = $this->{users_web};
    my $query = new Unit::Request("");

with

sub changeSettings {
    my $this = shift;
    $this->SUPER::changeSettings();

    $Foswiki::cfg{StoreImpl} = "RcsLite";
    $Foswiki::cfg{AutoAttachPubFiles} = 0;
    $Foswiki::cfg{Register}{AllowLoginName} = 1;
    $Foswiki::cfg{Htpasswd}{FileName} = "$Foswiki::cfg{WorkingDir}/htpasswd";
    $Foswiki::cfg{PasswordManager} = 'Foswiki::Users::HtPasswdUser';
    $Foswiki::cfg{UserMappingManager} = 'Foswiki::Users::TopicUserMapping';
    $Foswiki::cfg{LoginManager} = 'Foswiki::LoginManager::TemplateLogin';
    $Foswiki::cfg{Register}{EnableNewUserRegistration} = 1;
    $Foswiki::cfg{RenderLoggedInButUnknownUsers} = 0;

    $Foswiki::cfg{Register}{NeedVerification} = 0;
    $Foswiki::cfg{MinPasswordLength} = 0;
    $Foswiki::cfg{UsersWebName} = $this->{users_web};
}
....
sub set_up {
    my $this = shift;
    $this->SUPER::set_up();

    $this->changeSettings();

    my $query = new Unit::Request("");

so that we're not forced to re-finish and re-new the foswiki object at each unit test level. This could actually be used to simplify the verify_ tests too.

-- SvenDowideit - 24 Feb 2009

Presumably you want to override changeSettings in the test cases. How is that any different to overriding set_up? I don't understand what you expect to gain from this.

-- CrawfordCurrie - 24 Feb 2009

when you 'over-ride' set_up you are expected to call its SUPER - which means at each level we need to create a new Unit::Request, Foswiki session object and so on - to change the cfg options, you need to inject it into the middle of what is the current set_up function.

-- SvenDowideit - 25 Feb 2009

Ah, a dawning realisation is coming upon me. You want to be able to set the cfg options after the current state is saved but before the fixture is created? OK, that makes sense. Confirmed.

-- CrawfordCurrie - 25 Feb 2009

There is no bug here. Nothing is broken. Nothing to fix.

Changed to enhancement - so it can be ignored - like it has been for 1.5 years.

-- KennethLavrsen - 31 Jul 2010

Is this the function FoswikiFnTestCase->loadExtraConfig()

ObjectMethod? loadExtraConfig()

This method can be overridden (overrides should call up to the base class) to add extra stuff to Foswiki::cfg.

So this can be closed?

-- GeorgeClark - 14 Mar 2011

The copyright of the content on this website is held by the contributing authors, except where stated elsewhere. see CopyrightStatement. Creative Commons LicenseGet Foswiki at sourceforge.net. Fast, secure and Free Open Source software downloads