Skip to content

Commit 880100b

Browse files
committed
move cleanup function to abstract-testcase.php to maintain dry
1 parent bc4104f commit 880100b

File tree

3 files changed

+13
-26
lines changed

3 files changed

+13
-26
lines changed

tests/phpunit/includes/abstract-testcase.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1809,4 +1809,17 @@ private function retry_on_error( callable $callback, $url, $args ) {
18091809

18101810
return $result;
18111811
}
1812+
1813+
/**
1814+
* Cleanup the unzip destination.
1815+
*
1816+
* @param string $unzip_destination Unzip destination.
1817+
* @return void
1818+
*/
1819+
public function cleanup_unzip_destination( $unzip_destination ) {
1820+
if ( file_exists( $unzip_destination ) ) {
1821+
$this->rmdir( $unzip_destination );
1822+
$this->delete_folders( $unzip_destination );
1823+
}
1824+
}
18121825
}

tests/phpunit/tests/filesystem/unzipFilePclzip.php

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -73,17 +73,4 @@ public function test_should_apply_unzip_file_filters() {
7373

7474
$this->assertSame( 1, $filter->get_call_count() );
7575
}
76-
77-
/**
78-
* Cleanup the unzip destination.
79-
*
80-
* @param string $unzip_destination Unzip destination.
81-
* @return void
82-
*/
83-
public function cleanup_unzip_destination( $unzip_destination ) {
84-
if ( file_exists( $unzip_destination ) ) {
85-
$this->rmdir( $unzip_destination );
86-
$this->delete_folders( $unzip_destination );
87-
}
88-
}
8976
}

tests/phpunit/tests/filesystem/unzipFileZiparchive.php

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -81,17 +81,4 @@ public function test_should_apply_unzip_file_filters() {
8181

8282
$this->assertSame( 1, $filter->get_call_count() );
8383
}
84-
85-
/**
86-
* Cleanup the unzip destination.
87-
*
88-
* @param string $unzip_destination Unzip destination.
89-
* @return void
90-
*/
91-
public function cleanup_unzip_destination( $unzip_destination ) {
92-
if ( file_exists( $unzip_destination ) ) {
93-
$this->rmdir( $unzip_destination );
94-
$this->delete_folders( $unzip_destination );
95-
}
96-
}
9784
}

0 commit comments

Comments
 (0)