Implementedtests, recompiled README.
okko [Tue, 16 Feb 2010 15:59:13 +0000 (17:59 +0200)]
18 files changed:
.gitignore
README
t/cgi-bin/mt-add-notify.cgi [new file with mode: 0644]
t/cgi-bin/mt-atom.cgi [new file with mode: 0644]
t/cgi-bin/mt-check.cgi [new file with mode: 0644]
t/cgi-bin/mt-comments.cgi [new file with mode: 0644]
t/cgi-bin/mt-config.cgi [new file with mode: 0644]
t/cgi-bin/mt-feed.cgi [new file with mode: 0644]
t/cgi-bin/mt-ftsearch.cgi [new file with mode: 0644]
t/cgi-bin/mt-search.cgi [new file with mode: 0644]
t/cgi-bin/mt-tb.cgi [new file with mode: 0644]
t/cgi-bin/mt-testbg.cgi [new file with mode: 0644]
t/cgi-bin/mt-upgrade.cgi [new file with mode: 0644]
t/cgi-bin/mt-wizard.cgi [new file with mode: 0644]
t/cgi-bin/mt-xmlrpc.cgi [new file with mode: 0644]
t/cgi-bin/mt.cgi [new file with mode: 0644]
t/lib/TestApp/Controller/Mt.pm [new file with mode: 0644]
t/live-test.t

index e1008a7..5ec2022 100644 (file)
@@ -7,4 +7,4 @@ pm_to_blib
 MANIFEST
 Makefile.old
 Catalyst-Controller-MovableType-*
-
+*~
diff --git a/README b/README
index 74ef2cb..bc99a99 100644 (file)
--- a/README
+++ b/README
@@ -1,8 +1,46 @@
 NAME
     Catalyst::Controller::MovableType - Run Movable Type through Catalyst
 
+SYNOPSIS
+    package MyApp::Controller::Mt;
+
+    use Moose; BEGIN {extends 'Catalyst::Controller::MT'; } use utf8;
+
+    1;
+
+INSTALLATION
+    Install Movable Type by extracting the zip into your template root
+    directory. Move mt-static to root/static/mt, and configure Movable Type
+    accordingly.
+
+DESCRIPTION
+    Runs Movable Type 5 through Catalyst. Download Movable Type 5 from
+    http://www.movabletype.org/
+
+METHODS
+  run_mt_script
+    Runs the requested Movable Type .cgi script transparently with
+    cgi_to_response.
+
+  not_found
+    Sets the response to a simple 404 Not found page. You can override this
+    method with your own.
+
+BUGS
+    None known.
+
+SEE ALSO
+    Catalyst::Controller::WrapCGI
+
+AUTHOR
+    Oskari 'Okko' Ojala <perl@okko.net>
+
+CONTRIBUTORS
+    Matt S. Trout <mst@shadowcatsystems.co.uk>
+
 COPYRIGHT & LICENSE
     Copyright 2010 the above author(s).
 
     This sofware is free software, and is licensed under the same terms as
     Perl itself.
+
diff --git a/t/cgi-bin/mt-add-notify.cgi b/t/cgi-bin/mt-add-notify.cgi
new file mode 100644 (file)
index 0000000..67c2f61
--- /dev/null
@@ -0,0 +1,2 @@
+#!/usr/bin/env perl
+print "Content-type: text/plain\r\n\r\nThis is mt-add-notify.cgi";
diff --git a/t/cgi-bin/mt-atom.cgi b/t/cgi-bin/mt-atom.cgi
new file mode 100644 (file)
index 0000000..c800149
--- /dev/null
@@ -0,0 +1,2 @@
+#!/usr/bin/env perl
+print "Content-type: text/plain\r\n\r\nThis is mt-atom.cgi";
diff --git a/t/cgi-bin/mt-check.cgi b/t/cgi-bin/mt-check.cgi
new file mode 100644 (file)
index 0000000..9a962d5
--- /dev/null
@@ -0,0 +1,2 @@
+#!/usr/bin/env perl
+print "Content-type: text/plain\r\n\r\nThis is mt-check.cgi";
diff --git a/t/cgi-bin/mt-comments.cgi b/t/cgi-bin/mt-comments.cgi
new file mode 100644 (file)
index 0000000..627e7f1
--- /dev/null
@@ -0,0 +1,2 @@
+#!/usr/bin/env perl
+print "Content-type: text/plain\r\n\r\nThis is mt-comments.cgi";
diff --git a/t/cgi-bin/mt-config.cgi b/t/cgi-bin/mt-config.cgi
new file mode 100644 (file)
index 0000000..60ca2f6
--- /dev/null
@@ -0,0 +1,2 @@
+#!/usr/bin/env perl
+print "Content-type: text/plain\r\n\r\nThis is mt-config.cgi";
diff --git a/t/cgi-bin/mt-feed.cgi b/t/cgi-bin/mt-feed.cgi
new file mode 100644 (file)
index 0000000..ba9e548
--- /dev/null
@@ -0,0 +1,2 @@
+#!/usr/bin/env perl
+print "Content-type: text/plain\r\n\r\nThis is mt-feed.cgi";
diff --git a/t/cgi-bin/mt-ftsearch.cgi b/t/cgi-bin/mt-ftsearch.cgi
new file mode 100644 (file)
index 0000000..bc22715
--- /dev/null
@@ -0,0 +1,2 @@
+#!/usr/bin/env perl
+print "Content-type: text/plain\r\n\r\nThis is mt-ftsearch.cgi";
diff --git a/t/cgi-bin/mt-search.cgi b/t/cgi-bin/mt-search.cgi
new file mode 100644 (file)
index 0000000..ac630cb
--- /dev/null
@@ -0,0 +1,2 @@
+#!/usr/bin/env perl
+print "Content-type: text/plain\r\n\r\nThis is mt-search.cgi";
diff --git a/t/cgi-bin/mt-tb.cgi b/t/cgi-bin/mt-tb.cgi
new file mode 100644 (file)
index 0000000..0727a44
--- /dev/null
@@ -0,0 +1,2 @@
+#!/usr/bin/env perl
+print "Content-type: text/plain\r\n\r\nThis is mt-tb.cgi";
diff --git a/t/cgi-bin/mt-testbg.cgi b/t/cgi-bin/mt-testbg.cgi
new file mode 100644 (file)
index 0000000..f9c7b3a
--- /dev/null
@@ -0,0 +1,2 @@
+#!/usr/bin/env perl
+print "Content-type: text/plain\r\n\r\nThis is mt-testbg.cgi";
diff --git a/t/cgi-bin/mt-upgrade.cgi b/t/cgi-bin/mt-upgrade.cgi
new file mode 100644 (file)
index 0000000..b80611c
--- /dev/null
@@ -0,0 +1,2 @@
+#!/usr/bin/env perl
+print "Content-type: text/plain\r\n\r\nThis is mt-upgrade.cgi";
diff --git a/t/cgi-bin/mt-wizard.cgi b/t/cgi-bin/mt-wizard.cgi
new file mode 100644 (file)
index 0000000..ccaed2d
--- /dev/null
@@ -0,0 +1,2 @@
+#!/usr/bin/env perl
+print "Content-type: text/plain\r\n\r\nThis is mt-wizard.cgi";
diff --git a/t/cgi-bin/mt-xmlrpc.cgi b/t/cgi-bin/mt-xmlrpc.cgi
new file mode 100644 (file)
index 0000000..909bbad
--- /dev/null
@@ -0,0 +1,2 @@
+#!/usr/bin/env perl
+print "Content-type: text/plain\r\n\r\nThis is mt-xmlrpc.cgi";
diff --git a/t/cgi-bin/mt.cgi b/t/cgi-bin/mt.cgi
new file mode 100644 (file)
index 0000000..7bed0de
--- /dev/null
@@ -0,0 +1,2 @@
+#!/usr/bin/env perl
+print "Content-type: text/plain\r\n\r\nThis is mt.cgi";
diff --git a/t/lib/TestApp/Controller/Mt.pm b/t/lib/TestApp/Controller/Mt.pm
new file mode 100644 (file)
index 0000000..123432c
--- /dev/null
@@ -0,0 +1,12 @@
+package TestApp::Controller::Mt;
+
+use Moose;
+BEGIN {extends 'Catalyst::Controller::MovableType'; }
+use utf8;
+
+__PACKAGE__->config(
+                    mt_home => 't/cgi-bin/' # Tests don't have a real Movable Type, so this is just to satisfy the controller.
+                    );
+
+1;
+
index 4ca1c81..6dcbfb6 100644 (file)
@@ -17,4 +17,25 @@ my $mech = Test::WWW::Mechanize::Catalyst->new;
 $mech->get_ok('http://localhost/', 'get main page');
 $mech->content_like(qr/it works/i, 'see if it has our text');
 
+foreach my $script_name qw( mt-add-notify.cgi
+                            mt-atom.cgi
+                            mt.cgi
+                            mt-comments.cgi
+                            mt-feed.cgi
+                            mt-ftsearch.cgi
+                            mt-search.cgi
+                            mt-tb.cgi
+                            mt-testbg.cgi
+                            mt-upgrade.cgi
+                            mt-wizard.cgi
+                            mt-xmlrpc.cgi
+                            ) {
+                            # mt-config.cgi intentionally left out
+    my $mech = Test::WWW::Mechanize::Catalyst->new;
+    $mech->get_ok('http://localhost/mt/'.$script_name, 'get '.$script_name.' cgi');
+    $mech->content_like(qr/This is $script_name/, 'cgi script properly executed through Catalyst');
+}
+
+# TODO: test for mt-check.cgi to only work in $c->debug mode.
+
 done_testing;