Previously, the unittests-thumb directory (and its hashed subdirectories,
and the .htaccess and index.html files) were being left behind.
While that may be a bug in the FileBackend class, the unit test
shouldn't rely on that for its teardown. If we want to assert that,
that can be a separate test.
Bug: T89085
Change-Id: Ided46b71ace82159864145b76d98bb10da5d0311
parent::setUp();
# Forge a FSRepo object to not have to rely on local wiki settings
parent::setUp();
# Forge a FSRepo object to not have to rely on local wiki settings
- $tmpPrefix = wfTempDir() . '/storebatch-test-' . time() . '-' . mt_rand();
+ $tmpPrefix = $this->getNewTempDirectory();
if ( $this->getCliArg( 'use-filebackend' ) ) {
$name = $this->getCliArg( 'use-filebackend' );
$useConfig = array();
if ( $this->getCliArg( 'use-filebackend' ) ) {
$name = $this->getCliArg( 'use-filebackend' );
$useConfig = array();
'name' => 'local-testing',
'wikiId' => wfWikiID(),
'containerPaths' => array(
'name' => 'local-testing',
'wikiId' => wfWikiID(),
'containerPaths' => array(
- 'unittests-public' => "{$tmpPrefix}-public",
- 'unittests-thumb' => "{$tmpPrefix}-thumb",
- 'unittests-temp' => "{$tmpPrefix}-temp",
- 'unittests-deleted' => "{$tmpPrefix}-deleted",
+ 'unittests-public' => "{$tmpPrefix}/public",
+ 'unittests-thumb' => "{$tmpPrefix}/thumb",
+ 'unittests-temp' => "{$tmpPrefix}/temp",
+ 'unittests-deleted' => "{$tmpPrefix}/deleted",
}
protected function tearDown() {
}
protected function tearDown() {
- $this->repo->cleanupBatch( $this->createdFiles ); // delete files
- foreach ( $this->createdFiles as $tmp ) { // delete dirs
- $tmp = $this->repo->resolveVirtualUrl( $tmp );
- while ( $tmp = FileBackend::parentStoragePath( $tmp ) ) {
- $this->repo->getBackend()->clean( array( 'dir' => $tmp ) );
- }
- }
+ // Delete files
+ $this->repo->cleanupBatch( $this->createdFiles );