mirror of
				https://github.com/shivammathur/setup-php.git
				synced 2025-10-31 07:16:22 +07:00 
			
		
		
		
	Fix coverage log for Xdebug on PHP 8.0
This commit is contained in:
		
							
								
								
									
										1
									
								
								.github/workflows/experimental-workflow.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										1
									
								
								.github/workflows/experimental-workflow.yml
									
									
									
									
										vendored
									
									
								
							| @ -61,6 +61,7 @@ jobs: | |||||||
|           php-version: ${{ matrix.php-versions }} |           php-version: ${{ matrix.php-versions }} | ||||||
|           extensions: mbstring, xdebug, pcov #optional |           extensions: mbstring, xdebug, pcov #optional | ||||||
|           ini-values: post_max_size=256M, short_open_tag=On, date.timezone=Asia/Kolkata #optional |           ini-values: post_max_size=256M, short_open_tag=On, date.timezone=Asia/Kolkata #optional | ||||||
|  |           coverage: xdebug | ||||||
|  |  | ||||||
|       - name: Testing PHP version |       - name: Testing PHP version | ||||||
|         run: | |         run: | | ||||||
|  | |||||||
| @ -34,15 +34,25 @@ describe('Config tests', () => { | |||||||
|   }); |   }); | ||||||
|  |  | ||||||
|   it('checking addCoverage with Xdebug on windows', async () => { |   it('checking addCoverage with Xdebug on windows', async () => { | ||||||
|     const win32: string = await coverage.addCoverage('xdebug', '7.3', 'win32'); |     const win32: string = await coverage.addCoverage('xdebug', '7.4', 'win32'); | ||||||
|     expect(win32).toContain('addExtension xdebug'); |     expect(win32).toContain('addExtension xdebug'); | ||||||
|   }); |   }); | ||||||
|  |  | ||||||
|  |   it('checking addCoverage with Xdebug on windows', async () => { | ||||||
|  |     const win32: string = await coverage.addCoverage('xdebug', '8.0', 'win32'); | ||||||
|  |     expect(win32).toContain('Xdebug currently only supports PHP 7.4 or lower'); | ||||||
|  |   }); | ||||||
|  |  | ||||||
|   it('checking addCoverage with Xdebug on linux', async () => { |   it('checking addCoverage with Xdebug on linux', async () => { | ||||||
|     const linux: string = await coverage.addCoverage('xdebug', '7.4', 'linux'); |     const linux: string = await coverage.addCoverage('xdebug', '7.4', 'linux'); | ||||||
|     expect(linux).toContain('addExtension xdebug'); |     expect(linux).toContain('addExtension xdebug'); | ||||||
|   }); |   }); | ||||||
|  |  | ||||||
|  |   it('checking addCoverage with Xdebug on linux', async () => { | ||||||
|  |     const linux: string = await coverage.addCoverage('xdebug', '8.0', 'linux'); | ||||||
|  |     expect(linux).toContain('Xdebug currently only supports PHP 7.4 or lower'); | ||||||
|  |   }); | ||||||
|  |  | ||||||
|   it('checking addCoverage with Xdebug on darwin', async () => { |   it('checking addCoverage with Xdebug on darwin', async () => { | ||||||
|     const darwin: string = await coverage.addCoverage( |     const darwin: string = await coverage.addCoverage( | ||||||
|       'xdebug', |       'xdebug', | ||||||
| @ -52,6 +62,15 @@ describe('Config tests', () => { | |||||||
|     expect(darwin).toContain('addExtension xdebug'); |     expect(darwin).toContain('addExtension xdebug'); | ||||||
|   }); |   }); | ||||||
|  |  | ||||||
|  |   it('checking addCoverage with Xdebug on darwin', async () => { | ||||||
|  |     const darwin: string = await coverage.addCoverage( | ||||||
|  |       'xdebug', | ||||||
|  |       '8.0', | ||||||
|  |       'darwin' | ||||||
|  |     ); | ||||||
|  |     expect(darwin).toContain('Xdebug currently only supports PHP 7.4 or lower'); | ||||||
|  |   }); | ||||||
|  |  | ||||||
|   it('checking disableCoverage windows', async () => { |   it('checking disableCoverage windows', async () => { | ||||||
|     const win32 = await coverage.addCoverage('none', '7.4', 'win32'); |     const win32 = await coverage.addCoverage('none', '7.4', 'win32'); | ||||||
|     expect(win32).toContain('Disable-PhpExtension xdebug'); |     expect(win32).toContain('Disable-PhpExtension xdebug'); | ||||||
|  | |||||||
							
								
								
									
										7
									
								
								dist/index.js
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										7
									
								
								dist/index.js
									
									
									
									
										vendored
									
									
								
							| @ -1216,10 +1216,17 @@ const config = __importStar(__webpack_require__(641)); | |||||||
|  */ |  */ | ||||||
| function addCoverageXdebug(version, os_version) { | function addCoverageXdebug(version, os_version) { | ||||||
|     return __awaiter(this, void 0, void 0, function* () { |     return __awaiter(this, void 0, void 0, function* () { | ||||||
|  |         switch (version) { | ||||||
|  |             case '8.0': | ||||||
|  |                 return ('\n' + | ||||||
|  |                     (yield utils.addLog('$cross', 'xdebug', 'Xdebug currently only supports PHP 7.4 or lower', os_version))); | ||||||
|  |             case '7.4': | ||||||
|  |             default: | ||||||
|                 return ((yield extensions.addExtension('xdebug', version, os_version, true)) + |                 return ((yield extensions.addExtension('xdebug', version, os_version, true)) + | ||||||
|                     (yield utils.suppressOutput(os_version)) + |                     (yield utils.suppressOutput(os_version)) + | ||||||
|                     '\n' + |                     '\n' + | ||||||
|                     (yield utils.addLog('$tick', 'xdebug', 'Xdebug enabled as coverage driver', os_version))); |                     (yield utils.addLog('$tick', 'xdebug', 'Xdebug enabled as coverage driver', os_version))); | ||||||
|  |         } | ||||||
|     }); |     }); | ||||||
| } | } | ||||||
| exports.addCoverageXdebug = addCoverageXdebug; | exports.addCoverageXdebug = addCoverageXdebug; | ||||||
|  | |||||||
| @ -12,6 +12,19 @@ export async function addCoverageXdebug( | |||||||
|   version: string, |   version: string, | ||||||
|   os_version: string |   os_version: string | ||||||
| ): Promise<string> { | ): Promise<string> { | ||||||
|  |   switch (version) { | ||||||
|  |     case '8.0': | ||||||
|  |       return ( | ||||||
|  |         '\n' + | ||||||
|  |         (await utils.addLog( | ||||||
|  |           '$cross', | ||||||
|  |           'xdebug', | ||||||
|  |           'Xdebug currently only supports PHP 7.4 or lower', | ||||||
|  |           os_version | ||||||
|  |         )) | ||||||
|  |       ); | ||||||
|  |     case '7.4': | ||||||
|  |     default: | ||||||
|       return ( |       return ( | ||||||
|         (await extensions.addExtension('xdebug', version, os_version, true)) + |         (await extensions.addExtension('xdebug', version, os_version, true)) + | ||||||
|         (await utils.suppressOutput(os_version)) + |         (await utils.suppressOutput(os_version)) + | ||||||
| @ -23,6 +36,7 @@ export async function addCoverageXdebug( | |||||||
|           os_version |           os_version | ||||||
|         )) |         )) | ||||||
|       ); |       ); | ||||||
|  |   } | ||||||
| } | } | ||||||
|  |  | ||||||
| /** | /** | ||||||
|  | |||||||
		Reference in New Issue
	
	Block a user
	 Shivam Mathur
					Shivam Mathur