1Alien::Build::Plugin::TUessetr::CMoonctkr(i3b)uted PerlADloiceunm:e:nBtuaitlido:n:Plugin::Test::Mock(3)
2
3
4

NAME

6       Alien::Build::Plugin::Test::Mock - Mock plugin for testing
7

VERSION

9       version 2.77
10

SYNOPSIS

12        use alienfile;
13        plugin 'Test::Mock' => (
14          probe    => 'share',
15          download => 1,
16          extract  => 1,
17          build    => 1,
18          gather   => 1,
19        );
20

DESCRIPTION

22       This plugin is used for testing Alien::Build plugins.  Usually you only
23       want to test one or two phases in an alienfile for your plugin, but you
24       still have to have a fully formed alienfile that contains all required
25       phases.  This plugin lets you fill in the other phases with the
26       appropriate hooks.  This is usually better than using real plugins
27       which may pull in additional dynamic requirements that you do not want
28       to rely on at test time.
29

PROPERTIES

31   probe
32        plugin 'Test::Mock' => (
33          probe => $probe,
34        );
35
36       Override the probe behavior by one of the following:
37
38       share
39           For a "share" build.
40
41       system
42           For a "system" build.
43
44       die To throw an exception in the probe hook.  This will usually cause
45           Alien::Build to try the next probe hook, if available, or to assume
46           a "share" install.
47
48   download
49        plugin 'Test::Mock' => (
50          download => \%fs_spec,
51        );
52
53        plugin 'Test::Mock' => (
54          download => 1,
55        );
56
57       Mock out a download.  The %fs_spec is a hash where the hash values are
58       directories and the string values are files.  This a spec like this:
59
60        plugin 'Test::Mock' => (
61          download => {
62            'foo-1.00' => {
63              'README.txt' => "something to read",
64              'foo.c' => "#include <stdio.h>\n",
65                         "int main() {\n",
66                         "  printf(\"hello world\\n\");\n",
67                         "}\n",
68            }
69          },
70        );
71
72       Would generate two files in the directory 'foo-1.00', a "README.txt"
73       and a C file named "foo.c".  The default, if you provide a true non-
74       hash value is to generate a single tarball with the name
75       "foo-1.00.tar.gz".
76
77   extract
78        plugin 'Test::Mock' => (
79          extract => \%fs_spec,
80        );
81
82        plugin 'Test::Mock' => (
83          extract => 1,
84        );
85
86       Similar to "download" above, but for the "extract" phase.
87
88   build
89        plugin 'Test::Mock' => (
90          build => [ \%fs_spec_build, \%fs_spec_install ],
91        );
92
93        plugin 'Test::Mock' => (
94          build => 1,
95        );
96
97   gather
98        plugin 'Test::Mock' => (
99          gather => \%runtime_prop,
100        );
101
102        plugin 'Test::Mock' => (
103          gather => 1,
104        );
105
106       This adds a gather hook (for both "share" and "system") that adds the
107       given runtime properties, or if a true non-hash value is provided, some
108       reasonable runtime properties for testing.
109
110   check_digest
111        plugin 'Test::Mock' => (
112          check_digest => 1,  # the default
113        );
114
115       This adds a check_digest hook that uses fake algorithm FAKE that hashes
116       everything to "deadbeaf".  The mock download above will set the digest
117       for download_details so that this will pass the signature check.
118
119        plugin 'Test::Mock' => (
120          check_digest => sub {
121            my($build, $file, $algo, $digest) = @_;
122            ...
123          },
124        );
125
126       If you give it a code reference then you can write your own faux
127       digest.  See the check_digest hook in
128       Alien::Build::Manual::PluginAuthor for details.
129

AUTHOR

131       Author: Graham Ollis <plicease@cpan.org>
132
133       Contributors:
134
135       Diab Jerius (DJERIUS)
136
137       Roy Storey (KIWIROY)
138
139       Ilya Pavlov
140
141       David Mertens (run4flat)
142
143       Mark Nunberg (mordy, mnunberg)
144
145       Christian Walde (Mithaldu)
146
147       Brian Wightman (MidLifeXis)
148
149       Zaki Mughal (zmughal)
150
151       mohawk (mohawk2, ETJ)
152
153       Vikas N Kumar (vikasnkumar)
154
155       Flavio Poletti (polettix)
156
157       Salvador Fandiño (salva)
158
159       Gianni Ceccarelli (dakkar)
160
161       Pavel Shaydo (zwon, trinitum)
162
163       Kang-min Liu (劉康民, gugod)
164
165       Nicholas Shipp (nshp)
166
167       Juan Julián Merelo Guervós (JJ)
168
169       Joel Berger (JBERGER)
170
171       Petr Písař (ppisar)
172
173       Lance Wicks (LANCEW)
174
175       Ahmad Fatoum (a3f, ATHREEF)
176
177       José Joaquín Atria (JJATRIA)
178
179       Duke Leto (LETO)
180
181       Shoichi Kaji (SKAJI)
182
183       Shawn Laffan (SLAFFAN)
184
185       Paul Evans (leonerd, PEVANS)
186
187       Håkon Hægland (hakonhagland, HAKONH)
188
189       nick nauwelaerts (INPHOBIA)
190
191       Florian Weimer
192
194       This software is copyright (c) 2011-2022 by Graham Ollis.
195
196       This is free software; you can redistribute it and/or modify it under
197       the same terms as the Perl 5 programming language system itself.
198
199
200
201perl v5.36.0                      2023-01-20Alien::Build::Plugin::Test::Mock(3)
Impressum