Skip to content

Commit

Permalink
Item12952: documentation, unit tests and final refinements
Browse files Browse the repository at this point in the history
  • Loading branch information
crawford committed Oct 30, 2014
1 parent 6e3637a commit 2da012d
Show file tree
Hide file tree
Showing 13 changed files with 679 additions and 84 deletions.
2 changes: 0 additions & 2 deletions ConfigurePlugin/lib/Foswiki/Plugins/ConfigurePlugin/MANIFEST
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
!noci
bin/configure
data/System/ConfigurePlugin.txt 0644 Documentation page
lib/Foswiki/Configure/Wizards/Test.pm 0444 Perl module
lib/Foswiki/Plugins/ConfigurePlugin.pm 0444 Perl module
lib/Foswiki/Plugins/ConfigurePlugin/Config.spec 0444 Configuration
lib/Foswiki/Plugins/ConfigurePlugin/JQuery.pm 0444 Configuration
pub/System/ConfigurePlugin/checkWhirly.gif 0444
pub/System/ConfigurePlugin/configure.css 0444
Expand Down
73 changes: 73 additions & 0 deletions UnitTestContrib/lib/Foswiki/Configure/Wizards/Test.pm
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
# See bottom of file for license and copyright information
package Foswiki::Configure::Wizards::Test;

=begin TML
---+ package Foswiki::Configure::Wizards::Test
Wizard to test configure parameter passing
=cut

use strict;
use warnings;

use Assert;

use Foswiki::Configure::Wizard ();
our @ISA = ('Foswiki::Configure::Wizard');

=begin TML
---++ WIZARD test1
Test changing a value
=cut

sub test1 {
my ( $this, $reporter ) = @_;

die "No username" unless $this->param('cfgusername');
die "No password" unless $this->param('cfgpassword');
$reporter->ERROR("This is an error");
$reporter->WARN("This is a warning");
$reporter->NOTE("This is a note");
$Foswiki::cfg{Plugins}{ConfigurePlugin}{Test}{STRING} = 'ROPE';
$reporter->CHANGED('{Plugins}{ConfigurePlugin}{Test}{STRING}');
return undef;
}

=begin TML
---++ WIZARD format
Test prettified value
=cut

sub format {
my ( $this, $reporter ) = @_;
$reporter->CHANGED('{Plugins}{ConfigurePlugin}{Test}{PERL}');
return undef;
}

1;
__END__
Foswiki - The Free and Open Source Wiki, http://foswiki.org/
Copyright (C) 2014 Foswiki Contributors. Foswiki Contributors
are listed in the AUTHORS file in the root of this distribution.
NOTE: Please extend that file, not this notice.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version. For
more details read LICENSE in the root of this distribution.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
As per the GPL, removal of this notice is prohibited.
69 changes: 69 additions & 0 deletions UnitTestContrib/lib/Foswiki/Contrib/UnitTestContrib/Config.spec
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,72 @@ $Foswiki::cfg{UnitTestContrib}{SeleniumRc}{Browsers} = {};
# You may have to increase this if your test setup is slow.
$Foswiki::cfg{UnitTestContrib}{SeleniumRc}{BaseTimeout} = 5000;

# ---+++ Configure
# The following key specs are only used in testing Configure
# and do nothing.
# **STRING FEEDBACK="label='Test one';wizard='Test';method='test1';auth=1" \
# FEEDBACK="label='Test two';wizard='Test';method='test1'" \
# CHECK="min:3 max:20"**
# When you press either of the test buttons, expect the value to change
# to "ROPE" and there to be one each of the different levels of report.
$Foswiki::cfg{UnitTestContrib}{Configure}{STRING} = 'STRING';
# **BOOLEAN**
# Should be 1
$Foswiki::cfg{UnitTestContrib}{Configure}{BOOLEAN} = 1;
# **COMMAND**
# Should be COMMAND
$Foswiki::cfg{UnitTestContrib}{Configure}{COMMAND} = 'COMMAND';
# **DATE CHECK="nullok"**
# Should be 12 Feb 2012
$Foswiki::cfg{UnitTestContrib}{Configure}{DATE} = '12 Feb 2012';
# **EMAILADDRESS**
# Should be address@email.co
$Foswiki::cfg{UnitTestContrib}{Configure}{EMAILADDRESS} = 'address@email.co';
# **NUMBER**
# Should be 666
$Foswiki::cfg{UnitTestContrib}{Configure}{NUMBER} = 666;
# **OCTAL**
# Should see 755
$Foswiki::cfg{UnitTestContrib}{Configure}{OCTAL} = 429;
# **PASSWORD**
# Shouldn't reflect
$Foswiki::cfg{UnitTestContrib}{Configure}{PASSWORD} = 'PASSWORD';
# **PATH**
# Should be PATH
$Foswiki::cfg{UnitTestContrib}{Configure}{PATH} = 'PATH';
# **PERL FEEDBACK="label='Format';wizard='Test';method='format'" **
# The test button should come back with a prettified version of your value.
#$Foswiki::cfg{UnitTestContrib}{Configure}{PERL} = '\'PERL\';';
# **REGEX**
# Should be '^regex$'
$Foswiki::cfg{UnitTestContrib}{Configure}{REGEX} = '^regex$';
# **SELECTCLASS none,Foswiki::Configure::P* **
# Should be Package; should offer Pluggables,Package
$Foswiki::cfg{UnitTestContrib}{Configure}{SELECTCLASS} = 'Foswiki::Configure::Package';
# **SELECT choose,life**
# Should be life
$Foswiki::cfg{UnitTestContrib}{Configure}{SELECT} = 'life';
# **URLPATH**
# Should be /
$Foswiki::cfg{UnitTestContrib}{Configure}{URLPATH} = '/';
# **URL**
$Foswiki::cfg{UnitTestContrib}{Configure}{URL} = 'http://localhost';
# **STRING H**
$Foswiki::cfg{UnitTestContrib}{Configure}{H} = 'H';
# **STRING EXPERT**
# Should be EXPERT
$Foswiki::cfg{UnitTestContrib}{Configure}{EXPERT} = 'EXPERT';
# **PATH CHECK='nullok'**
# Should be 'empty'
# $Foswiki::cfg{UnitTestContrib}{Configure}{empty} = 'empty';
# **STRING**
# Should contain other items
$Foswiki::cfg{UnitTestContrib}{Configure}{DEP_STRING} = 'xxx$Foswiki::cfg{UnitTestContrib}{Configure}{H}xxx';
# **PERL**
# Should contain other items
$Foswiki::cfg{UnitTestContrib}{Configure}{DEP_PERL} = {
'string' => 'xxx$Foswiki::cfg{UnitTestContrib}{Configure}{H}xxx',
'hash' => { 'hash' => 'xxx$Foswiki::cfg{UnitTestContrib}{Configure}{H}xxx' },
'array' => [ '$Foswiki::cfg{UnitTestContrib}{Configure}{H}' ]
};
1;
2 changes: 2 additions & 0 deletions UnitTestContrib/lib/Foswiki/Contrib/UnitTestContrib/MANIFEST
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
bin/test 0755
data/System/UnitTestContrib.txt 0644
lib/Foswiki/Configure/Wizards/Test.pm 0444 Perl module
lib/Foswiki/Contrib/UnitTestContrib.pm 0644
lib/Foswiki/Contrib/UnitTestContrib/Config.spec 0644
lib/Foswiki/Contrib/UnitTestContrib/DateBasedRelease.pm 0644
Expand All @@ -26,6 +27,7 @@ test/unit/AdminOnlyAccessControlTests.pm 0644
test/unit/AttrsTests.pm 0644
test/unit/CacheTests.pm 0644
test/unit/ClientTests.pm 0644
test/unit/ConfigureQueryTests.pm 0644
test/unit/ConfigureSaveTests.pm 0644
test/unit/DependencyTests.pm 0644
test/unit/EmptyTests.pm 0644
Expand Down
Loading

0 comments on commit 2da012d

Please sign in to comment.