]> git.mxchange.org Git - friendica.git/blobdiff - tests/src/Core/StorageManagerTest.php
Improve impossible exception-handler for storage move
[friendica.git] / tests / src / Core / StorageManagerTest.php
index 443f8e786b83248f185533c2e3d20359f7360d6b..084caa68ab09f2550526b69cc7d206c1d2ca1fbe 100644 (file)
@@ -139,7 +139,11 @@ class StorageManagerTest extends DatabaseTest
        {
                $storageManager = new StorageManager($this->dba, $this->config, $this->logger, $this->l10n);
 
-               $this->assertEquals($userBackend, $storageManager->isValidBackend($name));
+               // true in every of the backends
+               $this->assertEquals(!empty($assertName), $storageManager->isValidBackend($name));
+
+               // if userBackend is set to true, filter out e.g. SystemRessource
+               $this->assertEquals($userBackend, $storageManager->isValidBackend($name, true));
        }
 
        /**
@@ -261,4 +265,17 @@ class StorageManagerTest extends DatabaseTest
                        $this->assertNotEmpty($data);
                }
        }
+
+       /**
+        * Test moving data to a WRONG storage
+        *
+        * @expectedException \Friendica\Model\Storage\StorageException
+        * @expectedExceptionMessage Can't move to storage backend 'SystemResource'
+        */
+       public function testMoveStorageWrong()
+       {
+               $storageManager = new StorageManager($this->dba, $this->config, $this->logger, $this->l10n);
+               $storage = $storageManager->getByName(Storage\SystemResource::getName());
+               $storageManager->move($storage);
+       }
 }