SYNOPSIS

use Test::More;
use Local::Test qw( test_backend init_backend );

subtest 'test my backend' => \&test_backend, $backend_object,
    collection => { ... },
    $list_objects,
    $set_object,
    $create_object;

DESCRIPTION

This module contains helper routines for testing Yancy.

SEE ALSO

Test::Builder

my ( $backend, $url ) = init_backend( @items );

Initialize a backend for testing with the given items. This routine will check the TEST_YANCY_BACKEND environment variable for connection details, if any. Otherwise, it will create a Yancy::Backend::Test object for mock testing.

NOTE: This routine will delete all existing data in the given collections!

my $result = test_backend(
    $backend, $coll_name, $coll_conf,
    $list, $create, $set_to,
);

Test that a backend works properly. $backend is a backend object. $coll_name is the collection name to test. $coll_conf is the collection configuration (JSON schema). $list is a list of objects already in the backend. $create is a new object to test creating an object. $set_to is values the newly-create object will be set to, before being deleted.

2 POD Errors

The following errors were encountered while parsing the POD:

Around line 32:

Unknown directive: =sub

Around line 143:

Unknown directive: =sub