Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Some starter unit tests

  • Loading branch information...
commit 3da27bc04196d25b4af33ea4eadb5df862565da0 1 parent d992885
@rayners rayners authored
View
12 plugins/FeaturedAssets/t/00-compile.t
@@ -0,0 +1,12 @@
+
+use lib qw( t/lib lib extlib );
+
+use strict;
+use warnings;
+
+use MT::Test;
+use Test::More tests => 2;
+
+require MT;
+ok(MT->component ('featuredassets'), "FeaturedAssets loaded");
+require_ok ('FeaturedAssets::Plugin');
View
12 plugins/FeaturedAssets/t/01-schema.t
@@ -0,0 +1,12 @@
+
+use lib qw( t/lib lib extlib );
+
+use strict;
+use warnings;
+
+use MT::Test qw( :db );
+use Test::More tests => 2;
+
+require MT::Asset;
+ok (MT::Asset->has_column ('is_featured'), "mt_asset has is_featured column");
+ok (MT::Asset->is_meta_column ('is_featured'), "mt_asset's is_featured column is meta");
View
31 plugins/FeaturedAssets/t/10-tags.t
@@ -0,0 +1,31 @@
+
+use lib qw( t/lib lib extlib );
+
+use strict;
+use warnings;
+
+use MT::Test qw( :db :data );
+use Test::More qw(no_plan);
+
+require MT::Asset;
+my $asset = MT::Asset->load(1);
+
+ok( !$asset->is_featured, "Asset #1 is not featured" );
+
+tmpl_out_like(
+ '<mt:assetisfeatured>Featured!<mt:else>Not!</mt:assetisfeatured>',
+ {},
+ { asset => $asset },
+ qr/^Not!$/,
+ "mt:assetisfeatured is false for a non-featured asset"
+);
+
+$asset->is_featured(1);
+
+tmpl_out_like(
+ '<mt:assetisfeatured>Featured!<mt:else>Not!</mt:assetisfeatured>',
+ {},
+ { asset => $asset },
+ qr/^Featured!$/,
+ "mt:assetisfeatured is true for a featured asset"
+);
Please sign in to comment.
Something went wrong with that request. Please try again.