diff options
Diffstat (limited to 'apps/files_versions')
-rw-r--r-- | apps/files_versions/tests/versions.php | 27 |
1 files changed, 17 insertions, 10 deletions
diff --git a/apps/files_versions/tests/versions.php b/apps/files_versions/tests/versions.php index a3b8595a34b..6205a6881f0 100644 --- a/apps/files_versions/tests/versions.php +++ b/apps/files_versions/tests/versions.php @@ -27,7 +27,7 @@ require_once __DIR__ . '/../lib/versions.php'; * Class Test_Files_versions * this class provide basic files versions test */ -class Test_Files_Versioning extends \PHPUnit_Framework_TestCase { +class Test_Files_Versioning extends \Test\TestCase { const TEST_VERSIONS_USER = 'test-versions-user'; const TEST_VERSIONS_USER2 = 'test-versions-user2'; @@ -39,6 +39,7 @@ class Test_Files_Versioning extends \PHPUnit_Framework_TestCase { private $rootView; public static function setUpBeforeClass() { + parent::setUpBeforeClass(); // clear share hooks \OC_Hook::clear('OCP\\Share'); @@ -55,9 +56,13 @@ class Test_Files_Versioning extends \PHPUnit_Framework_TestCase { // cleanup test user \OC_User::deleteUser(self::TEST_VERSIONS_USER); \OC_User::deleteUser(self::TEST_VERSIONS_USER2); + + parent::tearDownAfterClass(); } - function setUp() { + protected function setUp() { + parent::setUp(); + self::loginHelper(self::TEST_VERSIONS_USER); $this->rootView = new \OC\Files\View(); if (!$this->rootView->file_exists(self::USERS_VERSIONS_ROOT)) { @@ -65,8 +70,10 @@ class Test_Files_Versioning extends \PHPUnit_Framework_TestCase { } } - function tearDown() { + protected function tearDown() { $this->rootView->deleteAll(self::USERS_VERSIONS_ROOT); + + parent::tearDown(); } /** @@ -74,7 +81,7 @@ class Test_Files_Versioning extends \PHPUnit_Framework_TestCase { * test expire logic * @dataProvider versionsProvider */ - function testGetExpireList($versions, $sizeOfAllDeletedFiles) { + public function testGetExpireList($versions, $sizeOfAllDeletedFiles) { // last interval end at 2592000 $startTime = 5000000; @@ -216,7 +223,7 @@ class Test_Files_Versioning extends \PHPUnit_Framework_TestCase { ); } - function testRename() { + public function testRename() { \OC\Files\Filesystem::file_put_contents("test.txt", "test file"); @@ -247,7 +254,7 @@ class Test_Files_Versioning extends \PHPUnit_Framework_TestCase { \OC\Files\Filesystem::unlink('test2.txt'); } - function testRenameInSharedFolder() { + public function testRenameInSharedFolder() { \OC\Files\Filesystem::mkdir('folder1'); \OC\Files\Filesystem::mkdir('folder1/folder2'); @@ -270,7 +277,7 @@ class Test_Files_Versioning extends \PHPUnit_Framework_TestCase { $this->rootView->file_put_contents($v1, 'version1'); $this->rootView->file_put_contents($v2, 'version2'); - \OCP\Share::shareItem('folder', $fileInfo['fileid'], \OCP\Share::SHARE_TYPE_USER, self::TEST_VERSIONS_USER2, OCP\PERMISSION_ALL); + \OCP\Share::shareItem('folder', $fileInfo['fileid'], \OCP\Share::SHARE_TYPE_USER, self::TEST_VERSIONS_USER2, \OCP\Constants::PERMISSION_ALL); self::loginHelper(self::TEST_VERSIONS_USER2); @@ -291,7 +298,7 @@ class Test_Files_Versioning extends \PHPUnit_Framework_TestCase { \OC\Files\Filesystem::unlink('/folder1/folder2/test.txt'); } - function testRenameSharedFile() { + public function testRenameSharedFile() { \OC\Files\Filesystem::file_put_contents("test.txt", "test file"); @@ -313,7 +320,7 @@ class Test_Files_Versioning extends \PHPUnit_Framework_TestCase { $this->rootView->file_put_contents($v1, 'version1'); $this->rootView->file_put_contents($v2, 'version2'); - \OCP\Share::shareItem('file', $fileInfo['fileid'], \OCP\Share::SHARE_TYPE_USER, self::TEST_VERSIONS_USER2, OCP\PERMISSION_ALL); + \OCP\Share::shareItem('file', $fileInfo['fileid'], \OCP\Share::SHARE_TYPE_USER, self::TEST_VERSIONS_USER2, \OCP\Constants::PERMISSION_ALL); self::loginHelper(self::TEST_VERSIONS_USER2); @@ -334,7 +341,7 @@ class Test_Files_Versioning extends \PHPUnit_Framework_TestCase { \OC\Files\Filesystem::unlink('/test.txt'); } - function testCopy() { + public function testCopy() { \OC\Files\Filesystem::file_put_contents("test.txt", "test file"); |