Debian Codegraph @

ansible_collections/community/general/tests/unit/plugins/modules/test_composer.yaml

raw
1 # Copyright (c) Alexei Znamensky ([email protected])
2 # GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
3 # SPDX-License-Identifier: GPL-3.0-or-later
4
5 ---
6 anchors:
7 help_install: &help_install
8 command: ["/testbin/php", "/testbin/composer", "help", "install", "--working-dir", "/var/www/foo", "--no-interaction", "--format=json"]
9 rc: 0
10 out: |
11 {"definition": {"options": ["a", "b", "c"]}}
12 err: ''
13 help_create_project: &help_create_project
14 command: ["/testbin/php", "/testbin/composer", "help", "create-project", "--working-dir", "/var/www/foo", "--no-interaction", "--format=json"]
15 rc: 0
16 out: |
17 {"definition": {"options": ["a", "b", "c"]}}
18 err: ''
19 run_create_project: &run_create_project
20 command: ["/testbin/php", "/testbin/composer", "create-project", "--working-dir", "/var/www/foo", "vendor/package"]
21 rc: 0
22 out: ''
23 err: ''
24
25 test_cases:
26 - id: composer
27 input:
28 command: install
29 working_dir: "/var/www/foo"
30 output:
31 changed: true
32 mocks:
33 run_command:
34 - *help_install
35 - command: ["/testbin/php", "/testbin/composer", "install", "--working-dir", "/var/www/foo"]
36 rc: 0
37 out: ''
38 err: ''
39
40 - id: create_project_runs
41 input:
42 command: create-project
43 arguments: "vendor/package"
44 working_dir: "/var/www/foo"
45 output:
46 changed: true
47 mocks:
48 os_path_exists:
49 return_value: false
50 run_command:
51 - *help_create_project
52 - *run_create_project
53
54 - id: create_project_skips_when_exists
55 input:
56 command: create-project
57 arguments: "vendor/package"
58 working_dir: "/var/www/foo"
59 output:
60 changed: false
61 mocks:
62 os_path_exists:
63 return_value: true
64 run_command:
65 - *help_create_project
66
67 - id: create_project_force
68 input:
69 command: create-project
70 arguments: "vendor/package"
71 working_dir: "/var/www/foo"
72 force: true
73 output:
74 changed: true
75 mocks:
76 os_path_exists:
77 return_value: true
78 run_command:
79 - *help_create_project
80 - *run_create_project