Tests: Require the zip PHP extension in block templates export file test.

This avoids a test failure if the `ZipArchive` class is missing.

Additionally, this commit replaces an inline check for the `ZipArchive` class in personal data export file tests with a `@requires` annotation, for consistency with similar PHP extension requirements in other tests.

Follow-up to [44786], [51415], [52286].

See #55652.

git-svn-id: https://develop.svn.wordpress.org/trunk@53454 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Sergey Biryukov 2022-06-01 14:16:39 +00:00
parent f9d3aac7af
commit c59af567e5
2 changed files with 2 additions and 4 deletions

View File

@ -348,6 +348,7 @@ class Tests_Block_Template_Utils extends WP_UnitTestCase {
* Should generate block templates export file.
*
* @ticket 54448
* @requires extension zip
*/
function test_wp_generate_block_templates_export_file() {
$filename = wp_generate_block_templates_export_file();

View File

@ -12,6 +12,7 @@
*
* @group privacy
* @covers ::wp_privacy_generate_personal_data_export_file
* @requires extension zip
*
* @since 5.2.0
*/
@ -68,10 +69,6 @@ class Tests_Privacy_wpPrivacyGeneratePersonalDataExportFile extends WP_UnitTestC
$this->export_file_name = '';
if ( ! class_exists( 'ZipArchive' ) ) {
$this->markTestSkipped( 'The ZipArchive class is missing.' );
}
if ( ! $this->remove_exports_dir() ) {
$this->markTestSkipped( 'Existing exports directory could not be removed. Skipping test.' );
}