diff options
author | Robin McCorkell <rmccorkell@owncloud.com> | 2015-09-03 19:48:42 +0100 |
---|---|---|
committer | Robin McCorkell <rmccorkell@owncloud.com> | 2015-09-04 17:28:20 +0100 |
commit | cdf01f04194a9de30e4247338a5b2675cb1c3ece (patch) | |
tree | 84a76c014b069b3e68f4b4983d7a2a9cd2a8e772 /tests/lib/repair | |
parent | 79fceeff338d262828cc977839b171999da0a7eb (diff) | |
download | nextcloud-server-cdf01f04194a9de30e4247338a5b2675cb1c3ece.tar.gz nextcloud-server-cdf01f04194a9de30e4247338a5b2675cb1c3ece.zip |
Split mimetype handling to new class
Diffstat (limited to 'tests/lib/repair')
-rw-r--r-- | tests/lib/repair/repairmimetypes.php | 29 |
1 files changed, 14 insertions, 15 deletions
diff --git a/tests/lib/repair/repairmimetypes.php b/tests/lib/repair/repairmimetypes.php index 40ffc14612b..76d4d7cc656 100644 --- a/tests/lib/repair/repairmimetypes.php +++ b/tests/lib/repair/repairmimetypes.php @@ -22,8 +22,17 @@ class RepairMimeTypes extends \Test\TestCase { protected function setUp() { parent::setUp(); - $this->storage = new \OC\Files\Storage\Temporary([]); + $this->savedMimetypeLoader = \OC::$server->getMimeTypeLoader(); + $this->mimetypeLoader = $this->getMockBuilder('\OC\Files\Type\Loader') + ->setConstructorArgs([\OC::$server->getDatabaseConnection()]) + ->setMethods(null) + ->getMock(); + \OC::$server->registerService('MimeTypeLoader', function ($c) { + return $this->mimetypeLoader; + }); + + $this->storage = new \OC\Files\Storage\Temporary([]); $this->repair = new \OC\Repair\RepairMimeTypes(); } @@ -33,7 +42,9 @@ class RepairMimeTypes extends \Test\TestCase { \OC_DB::executeAudited($sql, [$this->storage->getId()]); $this->clearMimeTypes(); - DummyFileCache::clearCachedMimeTypes(); + \OC::$server->registerService('MimeTypeLoader', function($c) { + return $this->savedMimetypeLoader; + }); parent::tearDown(); } @@ -86,8 +97,7 @@ class RepairMimeTypes extends \Test\TestCase { $this->repair->run(); // force mimetype reload - DummyFileCache::clearCachedMimeTypes(); - $this->storage->getCache()->loadMimeTypes(); + self::invokePrivate($this->mimetypeLoader, 'loadMimetypes'); $this->checkEntries($fixedMimeTypes); } @@ -434,14 +444,3 @@ class RepairMimeTypes extends \Test\TestCase { } } -/** - * Dummy class to access protected members - */ -class DummyFileCache extends \OC\Files\Cache\Cache { - - public static function clearCachedMimeTypes() { - self::$mimetypeIds = []; - self::$mimetypes = []; - } -} - |