2012-03-02 18:57:03 -05:00
|
|
|
<?php
|
2025-06-30 09:04:05 -04:00
|
|
|
|
2012-03-02 18:57:03 -05:00
|
|
|
/**
|
2024-05-10 09:09:14 -04:00
|
|
|
* SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors
|
|
|
|
|
* SPDX-FileCopyrightText: 2016 ownCloud, Inc.
|
|
|
|
|
* SPDX-License-Identifier: AGPL-3.0-or-later
|
2012-03-02 18:57:03 -05:00
|
|
|
*/
|
|
|
|
|
|
2016-05-18 12:46:03 -04:00
|
|
|
namespace Test\Archive;
|
|
|
|
|
|
2016-05-02 01:23:14 -04:00
|
|
|
use OC\Archive\ZIP;
|
2025-06-12 12:31:58 -04:00
|
|
|
use OCP\ITempManager;
|
|
|
|
|
use OCP\Server;
|
2016-05-02 01:23:14 -04:00
|
|
|
|
2016-05-18 12:46:03 -04:00
|
|
|
class ZIPTest extends TestBase {
|
2012-10-05 16:24:36 -04:00
|
|
|
protected function getExisting() {
|
2016-05-18 12:46:03 -04:00
|
|
|
$dir = \OC::$SERVERROOT . '/tests/data';
|
2016-05-02 01:23:14 -04:00
|
|
|
return new ZIP($dir . '/data.zip');
|
2012-10-05 16:24:36 -04:00
|
|
|
}
|
2012-03-02 18:57:03 -05:00
|
|
|
|
2012-10-05 16:24:36 -04:00
|
|
|
protected function getNew() {
|
2025-06-12 12:31:58 -04:00
|
|
|
$newZip = Server::get(ITempManager::class)->getTempBaseDir() . '/newArchive.zip';
|
2025-05-13 03:45:55 -04:00
|
|
|
if (file_exists($newZip)) {
|
|
|
|
|
unlink($newZip);
|
|
|
|
|
}
|
|
|
|
|
return new ZIP($newZip);
|
2012-03-02 18:57:03 -05:00
|
|
|
}
|
|
|
|
|
}
|