]> git.mxchange.org Git - friendica.git/blobdiff - tests/Util/DBStructureMockTrait.php
- Fixing SystemResource
[friendica.git] / tests / Util / DBStructureMockTrait.php
index 3298107eb32d335f0bc217fe439fa7ac114ad7f8..224e5d07af27482eedb0915c891dfbb72cfababc 100644 (file)
@@ -2,17 +2,31 @@
 
 namespace Friendica\Test\Util;
 
+use Friendica\Database\DBStructure;
+use Mockery\MockInterface;
+
 /**
  * Trait to mock the DBStructure connection status
  */
 trait DBStructureMockTrait
 {
+       /**
+        * @var MockInterface The mocking interface of Friendica\Database\DBStructure
+        */
        private $dbStructure;
 
+       /**
+        * Mocking DBStructure::update()
+        * @see DBStructure::update();
+        *
+        * @param array $args The arguments for the update call
+        * @param bool $return True, if the connect was successful, otherwise false
+        * @param null|int $times How often the method will get used
+        */
        public function mockUpdate($args = [], $return = true, $times = null)
        {
                if (!isset($this->dbStructure)) {
-                       $this->dbStructure = \Mockery::mock('alias:Friendica\Database\DBStructure');
+                       $this->dbStructure = \Mockery::mock('alias:' . DBStructure::class);
                }
 
                $this->dbStructure
@@ -22,10 +36,17 @@ trait DBStructureMockTrait
                        ->andReturn($return);
        }
 
+       /**
+        * Mocking DBStructure::existsTable()
+        *
+        * @param string $tableName The name of the table to check
+        * @param bool $return True, if the connect was successful, otherwise false
+        * @param null|int $times How often the method will get used
+        */
        public function mockExistsTable($tableName, $return = true, $times = null)
        {
                if (!isset($this->dbStructure)) {
-                       $this->dbStructure = \Mockery::mock('alias:Friendica\Database\DBStructure');
+                       $this->dbStructure = \Mockery::mock('alias:' . DBStructure::class);
                }
 
                $this->dbStructure