Fix bug stopping fastcgi script working
[catagits/Catalyst-Runtime.git] / t / aggregate / unit_engineloader.t
diff --git a/t/aggregate/unit_engineloader.t b/t/aggregate/unit_engineloader.t
new file mode 100644 (file)
index 0000000..7758636
--- /dev/null
@@ -0,0 +1,29 @@
+use strict;
+use warnings;
+use Test::More;
+use Catalyst::EngineLoader;
+
+my $cases = {
+    FastCGI => {
+        expected_catalyst_engine_class => 'Catalyst::Engine',
+        ENV => { CATALYST_ENGINE => 'FastCGI' },
+    },
+    CGI => {
+        expected_catalyst_engine_class => 'Catalyst::Engine',
+        ENV => { CATALYST_ENGINE => 'CGI' },
+    },
+    Apache1 => {
+        expected_catalyst_engine_class => 'Catalyst::Engine',
+        ENV => { CATALYST_ENGINE => 'Apache1' },
+    },
+};
+
+foreach my $name (keys %$cases) {
+    local %ENV = %{ $cases->{$name}->{ENV} };
+    my $loader = Catalyst::EngineLoader->new(application_name => "TestApp");
+    if (my $expected = $cases->{$name}->{expected_catalyst_engine_class}) {
+        is $loader->catalyst_engine_class, $expected, $name . " catalyst_engine_class";
+    }
+}
+
+done_testing;