mirror of
https://github.com/friendica/friendica
synced 2024-12-23 19:20:17 +00:00
38 lines
791 B
PHP
38 lines
791 B
PHP
|
<?php
|
||
|
|
||
|
namespace Friendica\Test\Util;
|
||
|
|
||
|
/**
|
||
|
* Trait to mock the DBStructure connection status
|
||
|
*/
|
||
|
trait DBStructureMockTrait
|
||
|
{
|
||
|
private $dbStructure;
|
||
|
|
||
|
public function mockUpdate($args = [], $return = true, $times = null)
|
||
|
{
|
||
|
if (!isset($this->dbStructure)) {
|
||
|
$this->dbStructure = \Mockery::mock('alias:Friendica\Database\DBStructure');
|
||
|
}
|
||
|
|
||
|
$this->dbStructure
|
||
|
->shouldReceive('update')
|
||
|
->withArgs($args)
|
||
|
->times($times)
|
||
|
->andReturn($return);
|
||
|
}
|
||
|
|
||
|
public function mockExistsTable($tableName, $return = true, $times = null)
|
||
|
{
|
||
|
if (!isset($this->dbStructure)) {
|
||
|
$this->dbStructure = \Mockery::mock('alias:Friendica\Database\DBStructure');
|
||
|
}
|
||
|
|
||
|
$this->dbStructure
|
||
|
->shouldReceive('existsTable')
|
||
|
->with($tableName)
|
||
|
->times($times)
|
||
|
->andReturn($return);
|
||
|
}
|
||
|
}
|