3 namespace Friendica\Test\Util;
5 use Friendica\Database\DBStructure;
6 use Mockery\MockInterface;
9 * Trait to mock the DBStructure connection status
11 trait DBStructureMockTrait
14 * @var MockInterface The mocking interface of Friendica\Database\DBStructure
19 * Mocking DBStructure::update()
20 * @see DBStructure::update();
22 * @param array $args The arguments for the update call
23 * @param bool $return True, if the connect was successful, otherwise false
24 * @param null|int $times How often the method will get used
26 public function mockUpdate($args = [], $return = true, $times = null)
28 if (!isset($this->dbStructure)) {
29 $this->dbStructure = \Mockery::mock('alias:' . DBStructure::class);
33 ->shouldReceive('update')
40 * Mocking DBStructure::existsTable()
42 * @param string $tableName The name of the table to check
43 * @param bool $return True, if the connect was successful, otherwise false
44 * @param null|int $times How often the method will get used
46 public function mockExistsTable($tableName, $return = true, $times = null)
48 if (!isset($this->dbStructure)) {
49 $this->dbStructure = \Mockery::mock('alias:' . DBStructure::class);
53 ->shouldReceive('existsTable')