1App::GitHooks::Test(3)User Contributed Perl DocumentationApp::GitHooks::Test(3)
2
3
4
6 App::GitHooks::Test - Shared test functions for App::GitHooks.
7
9 Version 1.9.0
10
12 ok_add_file()
13 Create a file and add it to the git index.
14
15 ok_add_file(
16 repository => $repository,
17 path => $path,
18 content => $content,
19 );
20
21 Arguments:
22
23 · repository (mandatory)
24
25 A "Git::Repository" object.
26
27 · path (mandatory)
28
29 The path of the file to write, relative to the root of the git
30 repository passed.
31
32 · content (optional)
33
34 The content of the file to write.
35
36 ok_add_files()
37 Create files and add them to the git index.
38
39 ok_add_files(
40 repository => $repository,
41 files =>
42 {
43 $file_name => $file_content,
44 ...
45 },
46 );
47
48 Arguments:
49
50 · repository (mandatory)
51
52 A "Git::Repository" object.
53
54 · files (optional)
55
56 A hashref with file names as keys and the content of each file as
57 the corresponding value.
58
59 ok_setup_repository()
60 Set up a test repository.
61
62 ok_setup_repository(
63 cleanup_test_repository => $cleanup_test_repository, # default 1
64 config => $config, # default ''
65 hooks => \@hooks, # default []
66 plugins => \@plugins, # default []
67 );
68
69 Arguments:
70
71 · cleanup_test_repository
72
73 Whether the test repository created in order to run a test should
74 be destroyed at the end of the test (default: 1).
75
76 · config
77
78 Elements to add to the ".githooksrc" file set up at the root of the
79 test repository.
80
81 · hooks
82
83 An arrayref of the names of the hooks to set up for this test (for
84 example, "commit-msg").
85
86 · plugins
87
88 An arrayref of the module names of the plugins to run for this test
89 (for example, "App::GitHooks::Plugins::Test::CustomReply").
90
91 ok_reset_githooksrc()
92 Ensures that an empty ".githooksrc" is used.
93
94 ok_reset_githooksrc();
95
96 Arguments:
97
98 · content (optional)
99
100 Content for the ".githooksrc" file.
101
102 By default, this function generates an empty ".githooksrc" file,
103 which has the effect of using the defaults of App::GitHooks.
104
105 test_hook()
106 Test a git hook.
107
108 App::GitHooks::Test::test_hook(
109 tests => \@tests,
110 hook_name => $hook_name,
111 plugins => \@plugins,
112 cleanup_test_repository => $cleanup_test_repository, # default 1
113 );
114
115 Mandatory arguments:
116
117 · tests
118
119 A set of tests to run.
120
121 # TODO: document tests format.
122
123 · hook_name
124
125 The name of the git hook to test (for example, "commit-msg").
126
127 · plugins
128
129 An arrayref of the module names of the plugins to run for this test
130 (for example, "App::GitHooks::Plugins::Test::CustomReply").
131
132 Optional arguments:
133
134 · cleanup_test_repository
135
136 Whether the test repository created in order to run a test should
137 be destroyed at the end of the test (default: 1).
138
140 Please report any bugs or feature requests through the web interface at
141 <https://github.com/guillaumeaubert/App-GitHooks/issues/new>. I will
142 be notified, and then you'll automatically be notified of progress on
143 your bug as I make changes.
144
146 You can find documentation for this module with the perldoc command.
147
148 perldoc App::GitHooks::Test
149
150 You can also look for information at:
151
152 · GitHub's request tracker
153
154 <https://github.com/guillaumeaubert/App-GitHooks/issues>
155
156 · AnnoCPAN: Annotated CPAN documentation
157
158 <http://annocpan.org/dist/app-githooks>
159
160 · CPAN Ratings
161
162 <http://cpanratings.perl.org/d/app-githooks>
163
164 · MetaCPAN
165
166 <https://metacpan.org/release/App-GitHooks>
167
169 Guillaume Aubert <https://metacpan.org/author/AUBERTG>, "<aubertg at
170 cpan.org>".
171
173 Copyright 2013-2017 Guillaume Aubert.
174
175 This code is free software; you can redistribute it and/or modify it
176 under the same terms as Perl 5 itself.
177
178 This program is distributed in the hope that it will be useful, but
179 WITHOUT ANY WARRANTY; without even the implied warranty of
180 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the LICENSE
181 file for more details.
182
183
184
185perl v5.30.0 2019-07-26 App::GitHooks::Test(3)