1GitLab::API::v4::Mock::UEsnegrinCeo(n3tprmi)buted Perl DGoictuLmaebn:t:aAtPiIo:n:v4::Mock::Engine(3pm)
2
3
4
6 GitLab::API::v4::Mock::Engine - Mocking the internals of a GitLab
7 server.
8
10 use GitLab::API::v4::Mock::Engine;
11
12 my $engine = GitLab::API::v4::Mock::Engine->new();
13
14 my $user = $engine->create_user({
15 email => $email,
16 username => $username,
17 name => $name,
18 ...,
19 });
20
21 print "User created with ID: $user->{id}\n";
22
24 This module provides the tooling to run a mock of the internal state of
25 a GitLab server.
26
27 At this time very little is validated. For example, when you create a
28 user with "create_user" there is no logic which double checks that you
29 specify the required "email" field or that you don't put in fields that
30 are unexpected.
31
33 next_ids
34 my $ids = $engine->next_ids();
35
36 A hash reference containing object types to the next ID.
37
38 Used by "next_id_for".
39
40 users
41 my $users = $engine->users();
42 foreach my $user (@$users) { ... }
43
44 Returns the full array reference of all users hash references.
45
47 next_id_for
48 my $id = $engine->next_id_for( 'user' );
49
50 Given an object type this will return the next unused ID.
51
53 user
54 my $user = $engine->user( $id );
55
56 Returns a user hash reference for the given ID.
57
58 If no user is found with the ID then "undef" is returned.
59
60 create_user
61 my $user = $engine->create_user( $user );
62 my $id = $user->{id};
63
64 Takes a user hash reference, sets the "id" field, and stores it in
65 "users".
66
67 Returns the updated user hash reference.
68
69 update_user
70 my $user = $engine->update_user( $id, $new_user_data );
71
72 Takes the ID of the user to update and a hash reference of fields to
73 update.
74
75 Returns the updated user hash reference.
76
77 delete_user
78 my $user = $engine->delete_user( $id );
79
80 Deletes the user with the specified ID from "users".
81
82 If no user is found with the ID then "undef" is returned. Otherwise
83 the user hash reference is returned.
84
86 See "SUPPORT" in GitLab::API::v4.
87
89 See "AUTHORS" in GitLab::API::v4.
90
92 See "LICENSE" in GitLab::API::v4.
93
94
95
96perl v5.36.1 2023-06-08GitLab::API::v4::Mock::Engine(3pm)