Skip to content

Commit 18a6d01

Browse files
committed
fixing tests
1 parent 68f162e commit 18a6d01

File tree

16 files changed

+177
-65
lines changed

16 files changed

+177
-65
lines changed

.github/markdown-link-check.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"ignorePatterns": [
3+
{
4+
"pattern": "^http://localhost"
5+
}
6+
],
7+
"timeout": "20s",
8+
"retryOn429": true,
9+
"retryCount": 3,
10+
"fallbackRetryDelay": "30s",
11+
"aliveStatusCodes": [200, 206]
12+
}

.github/workflows/docs.yml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: Documentation Check
2+
3+
on:
4+
push:
5+
branches: [ main, master, develop ]
6+
paths:
7+
- '*.md'
8+
- '.github/workflows/docs.yml'
9+
pull_request:
10+
paths:
11+
- '*.md'
12+
- '.github/workflows/docs.yml'
13+
workflow_dispatch:
14+
15+
jobs:
16+
docs-check:
17+
name: Documentation Check
18+
runs-on: ubuntu-latest
19+
20+
steps:
21+
- name: Checkout code
22+
uses: actions/checkout@v6
23+
24+
- name: Validate documentation
25+
run: |
26+
echo "Checking documentation files..."
27+
test -f README.md
28+
test -f LICENSE
29+
test -f .github/CONTRIBUTING.md
30+
test -f .github/CODE_OF_CONDUCT.md
31+
test -f .github/SECURITY.md
32+
echo "All documentation files present"
33+
34+
- name: Check for broken links
35+
uses: gaurav-nelson/github-action-markdown-link-check@v1
36+
with:
37+
use-quiet-mode: 'yes'
38+
config-file: '.github/markdown-link-check.json'
39+
continue-on-error: true

.github/workflows/greetings.yml

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
name: Greetings
2+
3+
on:
4+
issues:
5+
types: [opened]
6+
pull_request_target:
7+
types: [opened]
8+
9+
permissions:
10+
issues: write
11+
pull-requests: write
12+
13+
jobs:
14+
greeting:
15+
name: Greet New Contributors
16+
runs-on: ubuntu-latest
17+
18+
steps:
19+
- name: Greet on new issue
20+
if: github.event_name == 'issues'
21+
uses: actions/github-script@v7
22+
with:
23+
script: |
24+
const issue = context.payload.issue;
25+
const isFirstIssue = await github.rest.issues.listForRepo({
26+
owner: context.repo.owner,
27+
repo: context.repo.repo,
28+
creator: issue.user.login,
29+
state: 'all'
30+
}).then(issues => issues.data.length === 1);
31+
32+
if (isFirstIssue) {
33+
await github.rest.issues.createComment({
34+
owner: context.repo.owner,
35+
repo: context.repo.repo,
36+
issue_number: issue.number,
37+
body: `👋 Thanks for opening your first issue! We appreciate your contribution to this project. Please be patient while we review your issue.`
38+
});
39+
}
40+
41+
- name: Greet on new pull request
42+
if: github.event_name == 'pull_request_target'
43+
uses: actions/github-script@v7
44+
with:
45+
script: |
46+
const pr = context.payload.pull_request;
47+
const isFirstPR = await github.rest.pulls.list({
48+
owner: context.repo.owner,
49+
repo: context.repo.repo,
50+
state: 'all'
51+
}).then(prs => prs.data.filter(p => p.user.login === pr.user.login).length === 1);
52+
53+
if (isFirstPR) {
54+
await github.rest.issues.createComment({
55+
owner: context.repo.owner,
56+
repo: context.repo.repo,
57+
issue_number: pr.number,
58+
body: `🎉 Thanks for opening your first pull request! We're excited to review your contribution. Please make sure you've followed our [contributing guidelines](.github/CONTRIBUTING.md).`
59+
});
60+
}

__tests__/command.test.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -521,7 +521,8 @@ describe('Command Generation Tests', () => {
521521
it('generates multiple --allow-reflection flags for space-separated patterns', async () => {
522522
mocks.getInputMock.mockImplementation(name => {
523523
if (name === 'trial') return 'true'
524-
if (name === 'allow-reflection') return 'MyClass::* AnotherClass::method'
524+
if (name === 'allow-reflection')
525+
return 'MyClass::* AnotherClass::method'
525526
return ''
526527
})
527528

@@ -531,7 +532,9 @@ describe('Command Generation Tests', () => {
531532
cmd.includes('ioncube_encoder')
532533
)
533534
expect(encodingCommand).toContain('--allow-reflection MyClass::*')
534-
expect(encodingCommand).toContain('--allow-reflection AnotherClass::method')
535+
expect(encodingCommand).toContain(
536+
'--allow-reflection AnotherClass::method'
537+
)
535538
}, 200000)
536539
})
537540

__tests__/errors.test.js

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -296,10 +296,10 @@ describe('Error Handling and Edge Cases', () => {
296296
await main.run()
297297

298298
expect(mocks.debugMock).toHaveBeenCalledWith(
299-
'Encrypting files: **/*.blade.php !vendor/**'
299+
'Encrypting files: **/*.blade.php, !vendor/**'
300300
)
301301
expect(mocks.debugMock).toHaveBeenCalledWith(
302-
'Adding ignore path: **/[Cc]ache/* **/[Ll]og?(s)/*'
302+
'Adding ignore path: **/[Cc]ache/*, **/[Ll]og?(s)/*'
303303
)
304304
expect(mocks.setOutputMock).toHaveBeenCalledWith(
305305
'status',
@@ -317,14 +317,18 @@ describe('Error Handling and Edge Cases', () => {
317317
execMock = setupExecMock(0)
318318
await main.run()
319319

320+
// Note: Space-separated format splits on spaces, so quoted paths with spaces
321+
// will be split into multiple values. Use newline or comma-separated for paths with spaces.
320322
expect(mocks.debugMock).toHaveBeenCalledWith(
321-
'Adding a path to skip: */vendor/* "path with spaces/*"'
323+
'Adding a path to skip: */vendor/*, "path, with, spaces/*"'
322324
)
323325
}, 200000)
324326

325327
it('handles very long pattern lists', async () => {
326328
const longPattern =
327329
'*.php *.inc *.phtml *.phps *.php3 *.php4 *.php5 *.php7 *.php8'
330+
const expectedDebugMessage =
331+
'Encrypting files: *.php, *.inc, *.phtml, *.phps, *.php3, *.php4, *.php5, *.php7, *.php8'
328332
mocks.getInputMock.mockImplementation(name => {
329333
if (name === 'trial') return 'true'
330334
if (name === 'encrypt') return longPattern
@@ -334,9 +338,7 @@ describe('Error Handling and Edge Cases', () => {
334338
execMock = setupExecMock(0)
335339
await main.run()
336340

337-
expect(mocks.debugMock).toHaveBeenCalledWith(
338-
`Encrypting files: ${longPattern}`
339-
)
341+
expect(mocks.debugMock).toHaveBeenCalledWith(expectedDebugMessage)
340342
}, 200000)
341343
})
342344

__tests__/inputs.test.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -365,7 +365,9 @@ describe('Input Validators', () => {
365365
})
366366
const result = validateReflection(false)
367367
expect(result).toBe(true)
368-
expect(mocks.debugMock).toHaveBeenCalledWith('Allowing reflection for all')
368+
expect(mocks.debugMock).toHaveBeenCalledWith(
369+
'Allowing reflection for all'
370+
)
369371
})
370372

371373
it('returns single pattern for specific reflection', () => {
@@ -383,7 +385,8 @@ describe('Input Validators', () => {
383385

384386
it('returns multiple patterns for space-separated reflection', () => {
385387
mocks.getInputMock.mockImplementation(name => {
386-
if (name === 'allow-reflection') return 'MyClass::* AnotherClass::method'
388+
if (name === 'allow-reflection')
389+
return 'MyClass::* AnotherClass::method'
387390
if (name === 'allow-reflection-all') return ''
388391
return ''
389392
})

__tests__/main.test.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@ describe('action', () => {
254254
expect(runMock).toHaveReturned()
255255

256256
expect(debugMock).toHaveBeenCalledWith('Encrypting files: *.config.php')
257-
expect(debugMock).toHaveBeenCalledWith('Adding copy path: *.txt *.md')
257+
expect(debugMock).toHaveBeenCalledWith('Adding copy path: *.txt, *.md')
258258
expect(debugMock).toHaveBeenCalledWith('Adding ignore path: */logs/*')
259259
expect(setOutputMock).toHaveBeenCalledWith(
260260
'status',
@@ -369,7 +369,7 @@ describe('action', () => {
369369
expect(runMock).toHaveReturned()
370370

371371
expect(debugMock).toHaveBeenCalledWith(
372-
'Adding ignore path: */cache/* */logs/* */temp/*'
372+
'Adding ignore path: */cache/*, */logs/*, */temp/*'
373373
)
374374
expect(setOutputMock).toHaveBeenCalledWith(
375375
'status',
@@ -389,7 +389,7 @@ describe('action', () => {
389389
expect(runMock).toHaveReturned()
390390

391391
expect(debugMock).toHaveBeenCalledWith(
392-
'Adding a path to skip: */vendor/* */node_modules/*'
392+
'Adding a path to skip: */vendor/*, */node_modules/*'
393393
)
394394
expect(setOutputMock).toHaveBeenCalledWith(
395395
'status',
@@ -479,7 +479,7 @@ describe('action', () => {
479479
expect(runMock).toHaveReturned()
480480

481481
expect(debugMock).toHaveBeenCalledWith(
482-
'Using reflection for: MyClass::* MyNamespace\\*'
482+
'Using reflection for: MyClass::*, MyNamespace\\*'
483483
)
484484
expect(setOutputMock).toHaveBeenCalledWith(
485485
'status',

__tests__/scenarios.test.js

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -95,16 +95,16 @@ describe('Real-world Integration Scenarios', () => {
9595
'Using output path: build/encoded'
9696
)
9797
expect(mocks.debugMock).toHaveBeenCalledWith(
98-
'Encrypting files: *.blade.php config/*.php'
98+
'Encrypting files: *.blade.php, config/*.php'
9999
)
100100
expect(mocks.debugMock).toHaveBeenCalledWith(
101-
'Adding a path to skip: */vendor/* */tests/* */node_modules/*'
101+
'Adding a path to skip: */vendor/*, */tests/*, */node_modules/*'
102102
)
103103
expect(mocks.debugMock).toHaveBeenCalledWith(
104-
'Adding ignore path: */cache/* */logs/* */sessions/*'
104+
'Adding ignore path: */cache/*, */logs/*, */sessions/*'
105105
)
106106
expect(mocks.debugMock).toHaveBeenCalledWith(
107-
'Adding copy path: *.json *.txt *.md public/*'
107+
'Adding copy path: *.json, *.txt, *.md, public/*'
108108
)
109109
expect(mocks.setOutputMock).toHaveBeenCalledWith(
110110
'status',
@@ -172,10 +172,10 @@ describe('Real-world Integration Scenarios', () => {
172172
await main.run()
173173

174174
expect(mocks.debugMock).toHaveBeenCalledWith(
175-
'Encrypting files: config/*.php database/*.php'
175+
'Encrypting files: config/*.php, database/*.php'
176176
)
177177
expect(mocks.debugMock).toHaveBeenCalledWith(
178-
'Adding a path to skip: */public/* */resources/*'
178+
'Adding a path to skip: */public/*, */resources/*'
179179
)
180180
expect(mocks.setOutputMock).toHaveBeenCalledWith(
181181
'status',
@@ -197,7 +197,7 @@ describe('Real-world Integration Scenarios', () => {
197197
'Encrypting files: *.blade.php'
198198
)
199199
expect(mocks.debugMock).toHaveBeenCalledWith(
200-
'Adding a path to skip: */vendor/* */app/*'
200+
'Adding a path to skip: */vendor/*, */app/*'
201201
)
202202
expect(mocks.setOutputMock).toHaveBeenCalledWith(
203203
'status',
@@ -245,10 +245,10 @@ describe('Real-world Integration Scenarios', () => {
245245
await main.run()
246246

247247
expect(mocks.debugMock).toHaveBeenCalledWith(
248-
'Adding copy path: *.json *.xml *.txt *.md *.yml *.yaml'
248+
'Adding copy path: *.json, *.xml, *.txt, *.md, *.yml, *.yaml'
249249
)
250250
expect(mocks.debugMock).toHaveBeenCalledWith(
251-
'Adding ignore path: */cache/* */logs/*'
251+
'Adding ignore path: */cache/*, */logs/*'
252252
)
253253
expect(mocks.setOutputMock).toHaveBeenCalledWith(
254254
'status',
@@ -268,10 +268,10 @@ describe('Real-world Integration Scenarios', () => {
268268
await main.run()
269269

270270
expect(mocks.debugMock).toHaveBeenCalledWith(
271-
'Adding ignore path: */cache/* */logs/* */tmp/* */temp/* *.log *.cache'
271+
'Adding ignore path: */cache/*, */logs/*, */tmp/*, */temp/*, *.log, *.cache'
272272
)
273273
expect(mocks.debugMock).toHaveBeenCalledWith(
274-
'Adding a path to skip: */test/* */tests/* */Test/*'
274+
'Adding a path to skip: */test/*, */tests/*, */Test/*'
275275
)
276276
expect(mocks.setOutputMock).toHaveBeenCalledWith(
277277
'status',
@@ -292,7 +292,7 @@ describe('Real-world Integration Scenarios', () => {
292292
await main.run()
293293

294294
expect(mocks.debugMock).toHaveBeenCalledWith(
295-
'Using reflection for: App\\Models\\* App\\Controllers\\*'
295+
'Using reflection for: App\\Models\\*, App\\Controllers\\*'
296296
)
297297
expect(mocks.setOutputMock).toHaveBeenCalledWith(
298298
'status',

action.yml

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -71,25 +71,30 @@ inputs:
7171
default: false
7272
type: boolean
7373
copy:
74-
description: 'Patterns to copy files to output directory (space-separated for multiple)'
74+
description:
75+
'Patterns to copy files to output directory (space-separated for multiple)'
7576
required: false
7677
default: ''
7778
type: string
7879
ignore:
79-
description: 'Patterns to ignore files to output directory (space-separated for multiple)'
80+
description:
81+
'Patterns to ignore files to output directory (space-separated for
82+
multiple)'
8083
required: false
8184
default: ''
8285
type: string
8386
skip:
84-
description: 'Patterns to skip files to output directory (space-separated for multiple)'
87+
description:
88+
'Patterns to skip files to output directory (space-separated for multiple)'
8589
required: false
8690
default: ''
8791
type: string
8892

8993
# Reflection API
9094
allow-reflection:
9195
description:
92-
'Names or globs for functions or classes to allow the reflection API (space-separated for multiple)'
96+
'Names or globs for functions or classes to allow the reflection API
97+
(space-separated for multiple)'
9398
required: false
9499
default: ''
95100
type: string
@@ -101,7 +106,8 @@ inputs:
101106

102107
# Files customization
103108
encrypt:
104-
description: 'Names or globs to files to encrypt (space-separated for multiple)'
109+
description:
110+
'Names or globs to files to encrypt (space-separated for multiple)'
105111
required: false
106112
default: ''
107113
type: string

src/inputs/copy.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,12 @@ const parseMultiValue = require('./parse-multi-value')
88
module.exports = function validateCopy(standard = '') {
99
const copy = core.getInput('copy', { required: false }) ?? standard
1010
const values = parseMultiValue(copy)
11-
11+
1212
if (values.length === 0) {
1313
core.debug('Adding copy path: NONE')
1414
return []
1515
}
16-
16+
1717
core.debug(`Adding copy path: ${values.join(', ')}`)
1818
return values
1919
}

0 commit comments

Comments
 (0)