root/trunk/plagger/t/core/assets_path.t

Revision 1656 (checked in by miyagawa, 14 years ago)
  • Updated captured variable name to $warnings.
  • Fixed POD bug in Publish::Takahashi
  • Updated ID of Publish::Takahashi test to use MD5 of file path, since it depends on local path, Eh.
  • Added failing test for Planet XSS bug
Line 
1 use strict;
2 use t::TestPlagger;
3
4 plan 'no_plan';
5 run_eval_expected_with_capture;
6
7 package Plagger::Plugin::Test::AssetsPath;
8 use base qw( Plagger::Plugin );
9
10 sub register {
11     my($self, $context) = @_;
12     $self->log(error => "assets_path is " . $self->assets_dir);
13     $context->register_hook($self, 'publish.feed' => \&template);
14 }
15
16 sub template {
17     my($self, $context) = @_;
18     $self->log(error => "template: " . $self->templatize("assets_path.tt"));
19 }
20
21 package main;
22
23 __END__
24
25 === Test global:assets_path
26 --- input config
27 plugins:
28   - module: Test::AssetsPath
29 --- expected
30 like $warnings, qr!plugins[/\\]Test-AssetsPath!;
31
32 === Test plugin:assets_path
33 --- input config
34 global:
35   assets_path: /tmp/assets
36 plugins:
37   - module: Test::AssetsPath
38     config:
39       assets_path: $t::TestPlagger::BaseDir/t/samples
40 --- expected
41 unlike $warnings, qr!/tmp/assets!;
42 like $warnings, qr!assets_path is .*t/samples$!m;
43
44 === Test templatize
45 --- input config
46 global:
47   assets_path: $t::TestPlagger::BaseDir/t/assets
48 plugins:
49   - module: Subscription::Config
50     config:
51       feed:
52         - file://$t::TestPlagger::BaseDirURI/t/samples/rss-full.xml
53   - module: Test::AssetsPath
54 --- expected
55 like $warnings, qr/template: foo/;
56
57 === Test localized templatize
58 --- input config
59 plugins:
60   - module: Subscription::Config
61     config:
62       feed:
63         - file://$t::TestPlagger::BaseDirURI/t/samples/rss-full.xml
64   - module: Test::AssetsPath
65     config:
66       assets_path: $t::TestPlagger::BaseDir/t/samples
67 --- expected
68 like $warnings, qr/template: bar/;
Note: See TracBrowser for help on using the browser.