| 1 | package GitLab::API::v4::Mock; | ||
| 2 | 1 | our $VERSION = '0.27'; | |
| 3 | |||
| 4 | =encoding utf8 | ||
| 5 | |||
| 6 | =head1 NAME | ||
| 7 | |||
| 8 | GitLab::API::v4::Mock - Mock API object for testing. | ||
| 9 | |||
| 10 | =head1 SYNOPSIS | ||
| 11 | |||
| 12 | use GitLab::API::v4::Mock; | ||
| 13 | |||
| 14 | my $api = GitLab::API::v4::Mock->new(); | ||
| 15 | |||
| 16 | =head1 DESCRIPTION | ||
| 17 | |||
| 18 | This module is a subclass of L<GitLab::API::v4>. It modifies | ||
| 19 | it to mock the REST client via L<GitLab::API::v4::Mock::RESTClient>. | ||
| 20 | |||
| 21 | This module is meant to be used for writing unit tests. | ||
| 22 | |||
| 23 | =cut | ||
| 24 | |||
| 25 | 1 | ▶ | use GitLab::API::v4::Mock::RESTClient; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 26 | |||
| 27 | 1 | ▶ | use Moo; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 28 | 1 | ▶ | use strictures 2; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 29 | 1 | ▶ | use namespace::clean; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 30 | |||
| 31 | 1 | extends 'GitLab::API::v4'; | |
| 32 | |||
| 33 | =head1 ATTRIBUTES | ||
| 34 | |||
| 35 | =head2 url | ||
| 36 | |||
| 37 | This attribute is altered from L<GitLab::API::v4/url> to default | ||
| 38 | to C<https://example.com/api/v4> and to not be required. | ||
| 39 | |||
| 40 | =cut | ||
| 41 | |||
| 42 | 1 | has '+url' => ( | |
| 43 | required => 0, | ||
| 44 | default => 'https://example.com/api/v4', | ||
| 45 | ); | ||
| 46 | |||
| 47 | =head2 rest_client_class | ||
| 48 | |||
| 49 | This attribute is altered from L<GitLab::API::v4/rest_client_class> | ||
| 50 | to default to L<GitLab::API::v4::Mock::RESTClient>. | ||
| 51 | |||
| 52 | =cut | ||
| 53 | |||
| 54 | 2 | ▶ | sub _build_rest_client_class { |
|
Subroutine
_build_rest_client_class: called CC=1 SCAR=0.0
| |||
| 55 | 2 | return 'GitLab::API::v4::Mock::RESTClient'; | |
| 56 | } | ||
| 57 | |||
| 58 | 1 | 1; | |
| 59 | __END__ | ||