3 namespace Friendica\Test\Util;
5 use Mockery\MockInterface;
8 * Trait to mock the DBStructure connection status
10 trait DBStructureMockTrait
13 * @var MockInterface The mocking interface of Friendica\Database\DBStructure
18 * Mocking DBStructure::update()
20 * @param array $args The arguments for the update call
21 * @param bool $return True, if the connect was successful, otherwise false
22 * @param null|int $times How often the method will get used
24 public function mockUpdate($args = [], $return = true, $times = null)
26 if (!isset($this->dbStructure)) {
27 $this->dbStructure = \Mockery::mock('alias:Friendica\Database\DBStructure');
31 ->shouldReceive('update')
38 * Mocking DBStructure::existsTable()
40 * @param string $tableName The name of the table to check
41 * @param bool $return True, if the connect was successful, otherwise false
42 * @param null|int $times How often the method will get used
44 public function mockExistsTable($tableName, $return = true, $times = null)
46 if (!isset($this->dbStructure)) {
47 $this->dbStructure = \Mockery::mock('alias:Friendica\Database\DBStructure');
51 ->shouldReceive('existsTable')