Test enhancements

This commit is contained in:
Philipp Holzer 2018-11-01 13:44:47 +01:00
parent 70f9d3c596
commit 83ead5ec48
No known key found for this signature in database
GPG key ID: 517BE60E2CE5C8A5
12 changed files with 154 additions and 71 deletions

View file

@ -49,4 +49,24 @@ trait DBAMockTrait
->times($times)
->andReturn($return);
}
/**
* 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
*/
public function mockFetchFirst($arg, $return = true, $times = null)
{
if (!isset($this->dbaMock)) {
$this->dbaMock = \Mockery::mock('alias:Friendica\Database\DBA');
}
$this->dbaMock
->shouldReceive('fetchFirst')
->with($arg)
->times($times)
->andReturn($return);
}
}