Moved Mocking usage

Adding more documentation
This commit is contained in:
Philipp Holzer 2018-10-31 10:24:07 +01:00
commit 70e240691e
No known key found for this signature in database
GPG key ID: 517BE60E2CE5C8A5
6 changed files with 65 additions and 9 deletions

View file

@ -2,13 +2,25 @@
namespace Friendica\Test\Util;
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()
*
* @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)) {
@ -22,6 +34,13 @@ 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)) {