X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;ds=sidebyside;f=tests%2FUtil%2FDBAMockTrait.php;h=8967348daee54229f62ff07e93186097d2c9ab09;hb=de2c43ce4b2b3d6904a634d791c6f755eeb79477;hp=296e3539496f225f1397686ed91212ced47ec449;hpb=d6a82c6c2d7befde9914fce3bd4e3e07b97ca036;p=friendica.git diff --git a/tests/Util/DBAMockTrait.php b/tests/Util/DBAMockTrait.php index 296e353949..8967348dae 100644 --- a/tests/Util/DBAMockTrait.php +++ b/tests/Util/DBAMockTrait.php @@ -1,7 +1,27 @@ . + * + */ namespace Friendica\Test\Util; +use Friendica\Database\DBA; use Mockery\MockInterface; class DBAStub @@ -22,7 +42,7 @@ trait DBAMockTrait private function checkMock() { if (!isset($this->dbaMock)) { - $this->dbaMock = \Mockery::namedMock('Friendica\Database\DBA', 'Friendica\Test\Util\DBAStub'); + $this->dbaMock = \Mockery::namedMock(DBA::class, DBAStub::class); } } @@ -61,11 +81,11 @@ trait DBAMockTrait /** * Mocking DBA::fetchFirst() * - * @param string $arg The argument of fetchFirst - * @param bool $return True, if the DB is connected, otherwise false - * @param null|int $times How often the method will get used + * @param string $arg The argument of fetchFirst + * @param bool $return True, if the DB is connected, otherwise false + * @param null|int $times How often the method will get used */ - public function mockFetchFirst($arg, $return = true, $times = null) + public function mockFetchFirst(string $arg, bool $return = true, int $times = null) { $this->checkMock(); @@ -119,13 +139,13 @@ trait DBAMockTrait /** * Mocking DBA::select() * - * @param string $tableName The name of the table - * @param array $select The Select Array (Default is []) - * @param array $where The Where Array (Default is []) - * @param object $return The array to return (Default is []) - * @param null|int $times How often the method will get used + * @param string $tableName The name of the table + * @param array $select The Select Array (Default is []) + * @param array $where The Where Array (Default is []) + * @param object $return The array to return (Default is []) + * @param null|int $times How often the method will get used */ - public function mockSelect($tableName, $select = [], $where = [], $return = null, $times = null) + public function mockSelect(string $tableName, array $select = [], array $where = [], $return = null, int $times = null) { $this->checkMock(); @@ -139,12 +159,12 @@ trait DBAMockTrait /** * Mocking DBA::delete() * - * @param string $tableName The name of the table - * @param array $where The Where Array (Default is []) - * @param bool $return The array to return (Default is true) - * @param null|int $times How often the method will get used + * @param string $tableName The name of the table + * @param array $where The Where Array (Default is []) + * @param bool $return The array to return (Default is true) + * @param null|int $times How often the method will get used */ - public function mockDBADelete($tableName, $where = [], $return = true, $times = null) + public function mockDBADelete(string $tableName, array $where = [], bool $return = true, int $times = null) { $this->checkMock(); @@ -158,14 +178,14 @@ trait DBAMockTrait /** * Mocking DBA::update() * - * @param string $expTableName The name of the table - * @param array $expFields The Fields Array - * @param array $expCondition The Condition Array - * @param array $expOld_fields The Old Fieldnames (Default is []) - * @param bool $return true if the update was successful - * @param null|int $times How often the method will get used + * @param string $expTableName The name of the table + * @param array $expFields The Fields Array + * @param array $expCondition The Condition Array + * @param array $expOld_fields The Old Fieldnames (Default is []) + * @param bool $return true if the update was successful + * @param null|int $times How often the method will get used */ - public function mockDBAUpdate($expTableName, $expFields, $expCondition, $expOld_fields = [], $return = true, $times = null) + public function mockDBAUpdate(string $expTableName, array $expFields, array $expCondition, array $expOld_fields = [], bool $return = true, int $times = null) { $this->checkMock(); @@ -187,13 +207,13 @@ trait DBAMockTrait /** * Mocking DBA::insert() * - * @param string $expTableName The name of the table - * @param array $expParam The Parameters Array - * @param bool $expOnDuplUpdate Update on a duplicated entry - * @param bool $return True if the insert was successful - * @param null|int $times How often the method will get used + * @param string $expTableName The name of the table + * @param array $expParam The Parameters Array + * @param bool $expOnDuplUpdate Update on a duplicated entry + * @param bool $return True if the insert was successful + * @param null|int $times How often the method will get used */ - public function mockDBAInsert($expTableName, $expParam, $expOnDuplUpdate = false, $return = true, $times = null) + public function mockDBAInsert(string $expTableName, array $expParam, bool $expOnDuplUpdate = false, bool $return = true, int $times = null) { $this->checkMock(); @@ -214,13 +234,13 @@ trait DBAMockTrait /** * Mocking DBA::selectFirst() * - * @param string $expTableName The name of the table - * @param array $expSelect The Select Array (Default is []) - * @param array $expWhere The Where Array (Default is []) - * @param array $return The array to return (Default is []) - * @param null|int $times How often the method will get used + * @param string $expTableName The name of the table + * @param array $expSelect The Select Array (Default is []) + * @param array $expWhere The Where Array (Default is []) + * @param array $return The array to return (Default is []) + * @param null|int $times How often the method will get used */ - public function mockSelectFirst($expTableName, $expSelect = [], $expWhere = [], $return = [], $times = null) + public function mockSelectFirst(string $expTableName, array $expSelect = [], array $expWhere = [], array $return = [], int $times = null) { $this->checkMock(); @@ -301,11 +321,11 @@ trait DBAMockTrait /** * Mocking DBA::lock() * - * @param string $table The table to lock - * @param bool $return True, if the lock is set successful - * @param null|int $times How often the method will get used + * @param string $table The table to lock + * @param bool $return True, if the lock is set successful + * @param null|int $times How often the method will get used */ - public function mockDbaLock($table, $return = true, $times = null) + public function mockDbaLock(string $table, bool $return = true, int $times = null) { $this->checkMock();