Skip to content

Commit 1e61eb5

Browse files
committed
feat: initial implementation of OpenApiServerMock module
0 parents  commit 1e61eb5

23 files changed

Lines changed: 11485 additions & 0 deletions

.gitattributes

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Exclude files from the final zip package (composer install --prefer-dist)
2+
/.github export-ignore
3+
/.gitignore export-ignore
4+
/.idea export-ignore
5+
/.php-cs-fixer.php export-ignore
6+
/.php-version export-ignore
7+
/.releaserc export-ignore
8+
/composer.lock export-ignore
9+
/phpstan.neon export-ignore
10+
/renovate.json export-ignore

.github/workflows/ci.yml

Lines changed: 221 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,221 @@
1+
on:
2+
push:
3+
branches:
4+
- "main"
5+
pull_request:
6+
# schedule:
7+
# - cron: '24 10 * * 4'
8+
9+
name: "CI"
10+
11+
permissions:
12+
contents: read
13+
14+
env:
15+
PHP_VERSION: "8.3"
16+
17+
jobs:
18+
qa:
19+
name: "QA (lint + static analysis)"
20+
if: "!startsWith(github.event.head_commit.message, 'chore(release)')"
21+
runs-on: "ubuntu-latest"
22+
steps:
23+
- name: "Checkout"
24+
uses: "actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd" # v6.0.2
25+
26+
- name: "Install PHP"
27+
uses: "shivammathur/setup-php@44454db4f0199b8b9685a5d763dc37cbf79108e1" # 2.36.0
28+
with:
29+
coverage: "none"
30+
php-version: "${{ env.PHP_VERSION }}"
31+
32+
- name: "Validate composer.json and composer.lock"
33+
if: "github.actor != 'renovate[bot]' || contains(github.head_ref, 'lock-file-maintenance')"
34+
run: "composer validate --ansi --strict"
35+
36+
- name: "Determine composer cache directory"
37+
uses: "ergebnis/.github/actions/composer/determine-cache-directory@4103ff7c010d2c18dc84f72d6704227868412482" # 1.10.0
38+
39+
- name: "Cache dependencies installed with composer"
40+
uses: "actions/cache@cdf6c1fa76f9f475f3d7449005a359c84ca0f306" # v5.0.3
41+
with:
42+
path: "${{ env.COMPOSER_CACHE_DIR }}"
43+
key: "php-${{ env.PHP_VERSION }}-composer-locked-${{ hashFiles('composer.lock') }}"
44+
restore-keys: |
45+
php-${{ env.PHP_VERSION }}-composer-locked-${{ github.ref_name }}
46+
php-${{ env.PHP_VERSION }}-composer-locked-
47+
php-${{ env.PHP_VERSION }}-composer-main
48+
49+
- name: "Install locked dependencies with composer"
50+
uses: "ergebnis/.github/actions/composer/install@4103ff7c010d2c18dc84f72d6704227868412482" # 1.10.0
51+
with:
52+
dependencies: "${{ (github.actor == 'renovate[bot]' && !contains(github.head_ref, 'lock-file-maintenance')) && 'highest' || 'locked' }}"
53+
54+
- name: "Check coding style"
55+
run: "vendor/bin/codecept build"
56+
57+
- name: "Check coding style"
58+
run: "composer cs:check"
59+
60+
- name: "Run static analysis"
61+
run: "composer stan"
62+
63+
# codacy:
64+
# name: "Codacy Security Scan"
65+
# if: "!startsWith(github.event.head_commit.message, 'chore(release)')"
66+
# runs-on: "ubuntu-latest"
67+
# permissions:
68+
# contents: read
69+
# security-events: write
70+
# actions: read
71+
# steps:
72+
# - name: Checkout code
73+
# uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
74+
#
75+
# - name: Run Codacy Analysis CLI
76+
# uses: codacy/codacy-analysis-cli-action@30783d03e758713bb5ed7b79292cfb14b9dd9a4a
77+
# with:
78+
# project-token: ${{ secrets.CODACY_PROJECT_TOKEN }}
79+
# verbose: false
80+
# output: results.sarif
81+
# format: sarif
82+
# upload: true
83+
# skip-uncommitted-files-check: true
84+
# gh-code-scanning-compat: true
85+
# max-allowed-issues: 2147483647
86+
87+
tests:
88+
name: "Run codeception tests"
89+
needs: [ qa ]
90+
runs-on: "ubuntu-latest"
91+
strategy:
92+
matrix:
93+
include:
94+
- { php-version: 8.3, dependencies: locked, coverage: pcov, with_coverage: true, allow-fail: false }
95+
96+
- { php-version: 8.4, dependencies: highest, coverage: pcov, with_coverage: false, allow-fail: true }
97+
- { php-version: 8.5, dependencies: highest, coverage: pcov, with_coverage: false, allow-fail: true }
98+
steps:
99+
- name: "Checkout"
100+
uses: "actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd" # v6.0.2
101+
102+
- name: "Install PHP"
103+
uses: "shivammathur/setup-php@44454db4f0199b8b9685a5d763dc37cbf79108e1" # 2.36.0
104+
with:
105+
coverage: "${{ matrix.coverage }}"
106+
ini-values: display_errors=On, display_startup_errors=On, error_reporting=32767
107+
php-version: "${{ matrix.php-version }}"
108+
109+
- name: "Set up problem matchers for PHP"
110+
run: "echo \"::add-matcher::${{ runner.tool_cache }}/php.json\""
111+
112+
- name: "Set up problem matchers for phpunit/phpunit"
113+
run: "echo \"::add-matcher::${{ runner.tool_cache }}/phpunit.json\""
114+
115+
- name: "Validate composer.json and composer.lock"
116+
if: "github.actor != 'renovate[bot]' || contains(github.head_ref, 'lock-file-maintenance')"
117+
run: "composer validate --ansi --strict"
118+
119+
- name: "Determine composer cache directory"
120+
uses: "ergebnis/.github/actions/composer/determine-cache-directory@4103ff7c010d2c18dc84f72d6704227868412482" # 1.10.0
121+
122+
- name: "Cache dependencies installed with composer"
123+
uses: "actions/cache@cdf6c1fa76f9f475f3d7449005a359c84ca0f306" # v5.0.3
124+
with:
125+
path: "${{ env.COMPOSER_CACHE_DIR }}"
126+
key: "php-${{ matrix.php-version }}-composer-${{ matrix.dependencies }}-${{ hashFiles('composer.lock') }}"
127+
restore-keys: |
128+
php-${{ matrix.php-version }}-composer-${{ matrix.dependencies }}-${{ github.ref_name }}
129+
php-${{ matrix.php-version }}-composer-${{ matrix.dependencies }}-
130+
php-${{ matrix.php-version }}-composer-main
131+
132+
- name: "Install ${{ matrix.dependencies }} dependencies with composer"
133+
uses: "ergebnis/.github/actions/composer/install@4103ff7c010d2c18dc84f72d6704227868412482" # 1.10.0
134+
with:
135+
dependencies: "${{ (github.actor == 'renovate[bot]' && !contains(github.head_ref, 'lock-file-maintenance') && matrix.dependencies == 'locked') && 'highest' || matrix.dependencies }}"
136+
137+
- name: "Run Tests (coverage)"
138+
if: matrix.with_coverage == true
139+
run: |
140+
vendor/bin/codecept build
141+
vendor/bin/codecept run --coverage --coverage-xml=coverage.xml --xml --report
142+
143+
- name: "Run Tests"
144+
if: matrix.with_coverage != true
145+
run: |
146+
vendor/bin/codecept build
147+
vendor/bin/codecept run --xml --report
148+
149+
- name: "Upload coverage artifact"
150+
if: matrix.with_coverage == true
151+
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
152+
with:
153+
name: code-coverage-results
154+
path: tests/_output/
155+
retention-days: 5
156+
157+
# - name: "Upload Coverage coverage"
158+
# if: matrix.with_coverage == true
159+
# run: |
160+
# export CODACY_PROJECT_TOKEN=${{ secrets.CODACY_PROJECT_TOKEN }}
161+
# bash <(curl -Ls https://coverage.codacy.com/get.sh) report -r ./build/logs/coverage.xml
162+
#
163+
# - name: Upload test results to Codecov
164+
# if: ${{ !cancelled() && matrix.with_coverage == true }}
165+
# uses: codecov/codecov-action@671740ac38dd9b0130fbe1cec585b89eea48d3de # v5
166+
# with:
167+
# token: ${{ secrets.CODECOV_TOKEN }} # not required for public repos
168+
# files: ./build/logs/report.xml
169+
# flags: unittests # optional
170+
# report_type: test_results
171+
# fail_ci_if_error: "${{ matrix.with_coverage }}" # optional (default = false)
172+
# verbose: false # optional (default = false)
173+
# - name: Upload coverage to Codecov
174+
# if: ${{ !cancelled() && matrix.with_coverage == true }}
175+
# uses: codecov/codecov-action@671740ac38dd9b0130fbe1cec585b89eea48d3de # v5
176+
# with:
177+
# token: ${{ secrets.CODECOV_TOKEN }} # not required for public repos
178+
# files: ./build/logs/coverage.xml
179+
# flags: unittests # optional
180+
# fail_ci_if_error: "${{ matrix.with_coverage }}" # optional (default = false)
181+
# verbose: false # optional (default = false)
182+
183+
release:
184+
name: "Release"
185+
needs:
186+
- tests
187+
# - codacy
188+
if: "github.event_name == 'push' && github.ref == 'refs/heads/main' && !startsWith(github.event.head_commit.message, 'chore(release)')"
189+
runs-on: "ubuntu-latest"
190+
permissions:
191+
actions: read
192+
contents: read
193+
steps:
194+
- name: Generate Token
195+
id: generate_token
196+
uses: actions/create-github-app-token@29824e69f54612133e76f7eaac726eef6c875baf # v2
197+
with:
198+
app-id: ${{ secrets.BOT_APP_ID }}
199+
private-key: ${{ secrets.BOT_APP_PRIVATE_KEY }}
200+
201+
- name: Checkout
202+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
203+
with:
204+
fetch-depth: 0
205+
token: ${{ steps.generate_token.outputs.token }}
206+
207+
- name: Semantic Release
208+
uses: cycjimmy/semantic-release-action@v6.0.0
209+
with:
210+
tag_format: ${version}
211+
branches: |
212+
['main']
213+
extra_plugins: |
214+
@semantic-release/commit-analyzer
215+
@semantic-release/release-notes-generator
216+
@semantic-release/github
217+
@semantic-release/changelog
218+
@semantic-release/git
219+
conventional-changelog-conventionalcommits
220+
env:
221+
GITHUB_TOKEN: ${{ steps.generate_token.outputs.token }}

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
vendor/
2+
.idea/

.php-cs-fixer.cache

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"php":"8.3.30","version":"3.94.2:v3.94.2#7787ceff91365ba7d623ec410b8f429cdebb4f63","indent":" ","lineEnding":"\n","rules":{"binary_operator_spaces":{"default":"align","operators":{"??":"single_space"}},"blank_lines_before_namespace":true,"braces_position":{"allow_single_line_anonymous_functions":true,"allow_single_line_empty_anonymous_classes":true},"class_definition":{"single_line":true},"compact_nullable_type_declaration":true,"declare_equal_normalize":true,"lowercase_cast":true,"lowercase_static_reference":true,"modifier_keywords":true,"new_with_parentheses":{"anonymous_class":false},"no_blank_lines_after_class_opening":true,"no_extra_blank_lines":{"tokens":["attribute","case","continue","curly_brace_block","default","extra","parenthesis_brace_block","square_brace_block","switch","throw","use"]},"no_leading_import_slash":true,"no_whitespace_in_blank_line":true,"ordered_class_elements":{"order":["use_trait"]},"ordered_imports":{"sort_algorithm":"alpha"},"return_type_declaration":true,"short_scalar_cast":true,"single_import_per_statement":true,"single_space_around_construct":true,"single_trait_insert_per_statement":true,"ternary_operator_spaces":true,"unary_operator_spaces":true,"blank_line_after_namespace":true,"constant_case":true,"control_structure_braces":true,"control_structure_continuation_position":true,"elseif":true,"function_declaration":{"closure_fn_spacing":"one"},"indentation_type":true,"line_ending":true,"lowercase_keywords":true,"method_argument_space":{"after_heredoc":true},"no_break_comment":true,"no_closing_tag":true,"no_multiple_statements_per_line":true,"no_space_around_double_colon":true,"no_spaces_after_function_name":true,"no_trailing_whitespace":true,"no_trailing_whitespace_in_comment":true,"single_blank_line_at_eof":true,"single_class_element_per_statement":true,"single_line_after_imports":true,"spaces_inside_parentheses":true,"statement_indentation":{"stick_comment_to_next_continuous_control_statement":true},"switch_case_semicolon_to_colon":true,"switch_case_space":true,"encoding":true,"full_opening_tag":true,"align_multiline_comment":true,"backtick_to_shell_exec":true,"blank_line_before_statement":{"statements":["return"]},"class_attributes_separation":{"elements":{"method":"one"}},"class_reference_name_casing":true,"clean_namespace":true,"concat_space":{"spacing":"one"},"declare_parentheses":true,"echo_tag_syntax":true,"empty_loop_body":{"style":"braces"},"empty_loop_condition":true,"fully_qualified_strict_types":true,"general_phpdoc_tag_rename":{"replacements":{"inheritDocs":"inheritDoc"}},"global_namespace_import":{"import_classes":true,"import_functions":true,"import_constants":true},"include":true,"increment_style":true,"integer_literal_case":true,"lambda_not_used_import":true,"linebreak_after_opening_tag":true,"magic_constant_casing":true,"magic_method_casing":true,"native_function_casing":true,"native_type_declaration_casing":true,"no_alias_language_construct_call":true,"no_alternative_syntax":true,"no_binary_string":true,"no_blank_lines_after_phpdoc":true,"no_empty_comment":true,"no_empty_phpdoc":true,"no_empty_statement":true,"no_leading_namespace_whitespace":true,"no_mixed_echo_print":true,"no_multiline_whitespace_around_double_arrow":true,"no_null_property_initialization":true,"no_short_bool_cast":true,"no_singleline_whitespace_before_semicolons":true,"no_spaces_around_offset":true,"no_superfluous_phpdoc_tags":{"allow_hidden_params":true,"remove_inheritdoc":true},"no_trailing_comma_in_singleline":true,"no_unneeded_braces":{"namespaces":true},"no_unneeded_control_parentheses":{"statements":["break","clone","continue","echo_print","negative_instanceof","others","return","switch_case","yield","yield_from"]},"no_unneeded_import_alias":true,"no_unset_cast":true,"no_unused_imports":true,"no_useless_concat_operator":true,"no_useless_else":true,"no_useless_nullsafe_operator":true,"no_useless_return":true,"no_whitespace_before_comma_in_array":{"after_heredoc":true},"normalize_index_brace":true,"nullable_type_declaration_for_default_null_value":true,"object_operator_without_whitespace":true,"operator_linebreak":{"only_booleans":true},"php_unit_fqcn_annotation":true,"php_unit_method_casing":true,"phpdoc_align":true,"phpdoc_annotation_without_dot":true,"phpdoc_indent":true,"phpdoc_inline_tag_normalizer":true,"phpdoc_no_access":true,"phpdoc_no_alias_tag":{"replacements":{"const":"var","link":"see","property-read":"property","property-write":"property","type":"var"}},"phpdoc_no_package":true,"phpdoc_no_useless_inheritdoc":true,"phpdoc_order":{"order":["param","return","throws"]},"phpdoc_return_self_reference":true,"phpdoc_scalar":{"types":["boolean","callback","double","integer","never-return","never-returns","no-return","real","str"]},"phpdoc_separation":{"groups":[["Annotation","NamedArgumentConstructor","Target"],["author","copyright","license"],["category","package","subpackage"],["property","property-read","property-write"],["deprecated","link","see","since"]],"skip_unlisted_annotations":false},"phpdoc_single_line_var_spacing":true,"phpdoc_summary":true,"phpdoc_tag_type":{"tags":{"inheritDoc":"inline"}},"phpdoc_trim":true,"phpdoc_trim_consecutive_blank_line_separation":true,"phpdoc_types":true,"phpdoc_types_order":{"null_adjustment":"always_last","sort_algorithm":"none"},"phpdoc_var_annotation_correct_order":true,"phpdoc_var_without_name":true,"protected_to_private":true,"semicolon_after_instruction":true,"simple_to_complex_string_variable":true,"single_line_comment_spacing":true,"single_line_comment_style":{"comment_types":["hash"]},"single_line_throw":true,"single_quote":true,"space_after_semicolon":{"remove_in_empty_for_expressions":true},"standardize_increment":true,"standardize_not_equals":true,"switch_continue_to_break":true,"trailing_comma_in_multiline":{"after_heredoc":true},"trim_array_spaces":true,"type_declaration_spaces":{"elements":["function","property"]},"whitespace_after_comma_in_array":true,"yoda_style":true,"nullable_type_declaration":true,"ordered_types":{"null_adjustment":"always_last","sort_algorithm":"none"},"types_spaces":true,"array_indentation":true,"array_syntax":true,"attribute_block_no_spaces":true,"cast_spaces":true,"array_push":true,"combine_nested_dirname":true,"dir_constant":true,"ereg_to_preg":true,"error_suppression":true,"fopen_flag_order":true,"fopen_flags":{"b_mode":false},"function_to_constant":true,"implode_call":true,"is_null":true,"logical_operators":true,"long_to_shorthand_operator":true,"modern_serialization_methods":true,"modernize_types_casting":true,"native_constant_invocation":{"fix_built_in":false,"include":["DIRECTORY_SEPARATOR","PHP_INT_SIZE","PHP_SAPI","PHP_VERSION_ID"],"scope":"namespaced","strict":true},"native_function_invocation":{"include":["@compiler_optimized"],"scope":"namespaced","strict":true},"no_alias_functions":{"sets":["@all"]},"no_homoglyph_names":true,"no_php4_constructor":true,"no_trailing_whitespace_in_string":true,"no_unneeded_final_method":true,"no_useless_sprintf":true,"non_printable_character":true,"ordered_traits":true,"php_unit_construct":true,"php_unit_mock_short_will_return":true,"php_unit_set_up_tear_down_visibility":true,"php_unit_test_annotation":true,"psr_autoloading":true,"self_accessor":true,"set_type_to_cast":true,"static_lambda":true,"string_length_to_empty":true,"string_line_ending":true,"ternary_to_elvis_operator":true,"pow_to_exponentiation":true,"no_unreachable_default_argument_value":true,"comment_to_phpdoc":true,"final_internal_class":true,"no_unset_on_property":true,"php_unit_data_provider_name":true,"php_unit_data_provider_return_type":true,"php_unit_data_provider_static":{"force":true},"php_unit_strict":true,"php_unit_test_case_static_method_calls":{"call_type":"self"},"strict_comparison":true,"strict_param":true,"yield_from_array_to_yields":true,"octal_notation":true,"assign_null_coalescing_to_coalesce_equal":true,"heredoc_indentation":true,"list_syntax":true,"ternary_to_null_coalescing":true,"doctrine_annotation_array_assignment":{"operator":":"},"doctrine_annotation_braces":true,"doctrine_annotation_indentation":true,"doctrine_annotation_spaces":{"before_array_assignments_colon":false},"declare_strict_types":true,"php_unit_dedicate_assert":{"target":"newest"}},"ruleCustomisationPolicyVersion":"null-policy","hashes":{"tests\/Support\/UnitTester.php":"6eb8ec62c8f4500953b807c18952b117","tests\/Support\/AcceptanceTester.php":"a99adc231aef83a856e1b6420654fbd1","tests\/Acceptance\/MockServerCest.php":"4477201d6bdf59a5c96ee5bac1b0484d",".php-cs-fixer.php":"024df4f6538b23e62193ca8db8f0164c","rector.php":"daa347ebd629417ca7c018b5b9cbb8b1","src\/OpenApiServerMock.php":"cac84ab2bc13590c334ad26b033a9137"}}

0 commit comments

Comments
 (0)