NAME

App::GitHooks::Test - Shared test functions for App::GitHooks.

VERSION

Version 1.1.1

FUNCTIONS

ok_add_file()

Create a file and add it to the git index.

ok_add_file(
	repository => $repository,
	path       => $path,
	content    => $content,
);

Arguments:

  • repository (mandatory)

    A Git::Repository object.

  • path (mandatory)

    The path of the file to write, relative to the root of the git repository passed.

  • content (optional)

    The content of the file to write.

ok_add_files()

Create files and add them to the git index.

ok_add_files(
	repository => $repository,
	files      =>
	{
		$file_name => $file_content,
		...
	},
);

Arguments:

  • repository (mandatory)

    A Git::Repository object.

  • files (optional)

    A hashref with file names as keys and the content of each file as the corresponding value.

ok_setup_repository()

Set up a test repository.

ok_setup_repository(
	cleanup_test_repository => $cleanup_test_repository, # default 1
	config                  => $config,                  # default ''
	hooks                   => \@hooks,                  # default []
	plugins                 => \@plugins,                # default []
);

Arguments:

  • cleanup_test_repository

    Whether the test repository created in order to run a test should be destroyed at the end of the test (default: 1).

  • config

    Elements to add to the .githooksrc file set up at the root of the test repository.

  • hooks

    An arrayref of the names of the hooks to set up for this test (for example, commit-msg).

  • plugins

    An arrayref of the module names of the plugins to run for this test (for example, App::GitHooks::Plugins::Test::CustomReply).

test_hook()

Test a git hook.

App::GitHooks::Test::test_hook(
	tests                   => \@tests,
	hook_name               => $hook_name,
	plugins                 => \@plugins,
	cleanup_test_repository => $cleanup_test_repository, # default 1
);

Mandatory arguments:

  • tests

    A set of tests to run.

    # TODO: document tests format.

  • hook_name

    The name of the git hook to test (for example, commit-msg).

  • plugins

    An arrayref of the module names of the plugins to run for this test (for example, App::GitHooks::Plugins::Test::CustomReply).

Optional arguments:

  • cleanup_test_repository

    Whether the test repository created in order to run a test should be destroyed at the end of the test (default: 1).

BUGS

Please report any bugs or feature requests through the web interface at https://github.com/guillaumeaubert/App-GitHooks/issues/new. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

SUPPORT

You can find documentation for this module with the perldoc command.

perldoc App::GitHooks::Test

You can also look for information at:

AUTHOR

Guillaume Aubert, <aubertg at cpan.org>.

COPYRIGHT & LICENSE

Copyright 2013-2014 Guillaume Aubert.

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License version 3 as published by the Free Software Foundation.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/