diff options
Diffstat (limited to 'apps/files_external/tests/Service/StoragesServiceTest.php')
-rw-r--r-- | apps/files_external/tests/Service/StoragesServiceTest.php | 26 |
1 files changed, 16 insertions, 10 deletions
diff --git a/apps/files_external/tests/Service/StoragesServiceTest.php b/apps/files_external/tests/Service/StoragesServiceTest.php index ef0f1852d91..33186724338 100644 --- a/apps/files_external/tests/Service/StoragesServiceTest.php +++ b/apps/files_external/tests/Service/StoragesServiceTest.php @@ -92,7 +92,7 @@ abstract class StoragesServiceTest extends \Test\TestCase { */ protected $mountCache; - public function setUp() { + protected function setUp(): void { parent::setUp(); $this->dbConfig = new CleaningDBConfig(\OC::$server->getDatabaseConnection(), \OC::$server->getCrypto()); self::$hookCalls = array(); @@ -175,7 +175,7 @@ abstract class StoragesServiceTest extends \Test\TestCase { ->willReturn($containerMock); } - public function tearDown() { + protected function tearDown(): void { \OC_Mount_Config::$skipTest = false; self::$hookCalls = array(); if ($this->dbConfig) { @@ -252,10 +252,7 @@ abstract class StoragesServiceTest extends \Test\TestCase { } - /** - * @expectedException \OCA\Files_External\NotFoundException - */ - public function testNonExistingStorage() { + protected function ActualNonExistingStorageTest() { $backend = $this->backendService->getBackend('identifier:\OCA\Files_External\Lib\Backend\SMB'); $authMechanism = $this->backendService->getAuthMechanism('identifier:\Auth\Mechanism'); $storage = new StorageConfig(255); @@ -265,6 +262,12 @@ abstract class StoragesServiceTest extends \Test\TestCase { $this->service->updateStorage($storage); } + public function testNonExistingStorage() { + $this->expectException(\OCA\Files_External\NotFoundException::class); + + $this->ActualNonExistingStorageTest(); + } + public function deleteStorageDataProvider() { return [ // regular case, can properly delete the oc_storages entry @@ -334,13 +337,16 @@ abstract class StoragesServiceTest extends \Test\TestCase { $this->assertCount($expectedCountAfterDeletion, $storages, "expected $expectedCountAfterDeletion storages, got " . json_encode($storages)); } - /** - * @expectedException \OCA\Files_External\NotFoundException - */ - public function testDeleteUnexistingStorage() { + protected function actualDeletedUnexistingStorageTest() { $this->service->removeStorage(255); } + public function testDeleteUnexistingStorage() { + $this->expectException(\OCA\Files_External\NotFoundException::class); + + $this->actualDeletedUnexistingStorageTest(); + } + public function testCreateStorage() { $mountPoint = 'mount'; $backendIdentifier = 'identifier:\OCA\Files_External\Lib\Backend\SMB'; |