Add KALAMAR_PLUGINS environment variable
Change-Id: I05e39411c089bb6d6e24368314202340ebea17f6
diff --git a/t/plugin/environment.t b/t/plugin/environment.t
new file mode 100644
index 0000000..d7be4db
--- /dev/null
+++ b/t/plugin/environment.t
@@ -0,0 +1,27 @@
+use Test::More;
+use Test::Mojo;
+use Test::Output;
+use Data::Dumper;
+
+my @loaded = grep( /Kalamar\//, keys %INC);
+
+is(scalar (@loaded), 0, 'No Kalamar libraries loaded');
+
+$ENV{KALAMAR_PLUGINS} = 'Piwik,Auth';
+
+my $t = Test::Mojo->new(Kalamar => {
+ Kalamar => {
+ plugins => ['Auth']
+ }
+});
+
+my @loaded = grep( /Kalamar[\/\\]Plugin/, keys %INC);
+
+isnt(scalar (@loaded), 0, 'Kalamar libraries loaded');
+
+is(scalar grep( /Auth/, @loaded), 1, 'Auth plugin loaded');
+is(scalar grep( /Piwik/, @loaded), 1, 'Auth plugin loaded');
+is(scalar grep( /Unknown/, @loaded), 0, 'Unknown plugin not loaded');
+
+done_testing;
+__END__