This repository has been archived by the owner on Oct 11, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
44 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
use lib qw( lib extlib plugins/Order/lib ); | ||
|
||
use strict; | ||
use warnings; | ||
|
||
use MT; | ||
use MT::Template::Context; | ||
use MT::Builder; | ||
use MT::App; | ||
|
||
use Test::More tests => 2; | ||
|
||
use Order::Plugin; | ||
|
||
my $cms = MT::App->new; | ||
|
||
|
||
sub build { | ||
my ($template, $data) = @_; | ||
my $ctx = MT::Template::Context->new; | ||
my $b = MT::Builder->new; | ||
my $tokens = $b->compile($ctx, $template); | ||
|
||
$ctx->{__stash} = $data; | ||
my $ret = $b->build($ctx, $tokens); | ||
die $b->errstr if !defined $ret; | ||
|
||
return $ret; | ||
} | ||
|
||
|
||
is(build(q{<mt:Ignore>derp</mt:Ignore>}), q{}, "templates will build"); | ||
|
||
my $t = <<EOF; | ||
<mt:Order> | ||
<mt:OrderItem> | ||
<mt:setvarblock name="order_by">1</mt:setvarblock> | ||
hello | ||
</mt:OrderItem> | ||
</mt:Order> | ||
EOF | ||
like(build($t), qr{ \A \s* hello \s* \z }xms, "Order works at all (one item)"); | ||
|
||
1; |