mirror of
https://git.sekbaer.de/Friendica/friendica.git
synced 2025-06-16 20:05:14 +02:00
Moved Mocking usage
Adding more documentation
This commit is contained in:
parent
551efde226
commit
70e240691e
6 changed files with 65 additions and 9 deletions
|
@ -2,13 +2,24 @@
|
|||
|
||||
namespace Friendica\Test\Util;
|
||||
|
||||
use Mockery\MockInterface;
|
||||
|
||||
/**
|
||||
* Trait to mock the DBA connection status
|
||||
*/
|
||||
trait DBAMockTrait
|
||||
{
|
||||
/**
|
||||
* @var MockInterface The mocking interface of Friendica\Database\DBA
|
||||
*/
|
||||
private $dbaMock;
|
||||
|
||||
/**
|
||||
* Mocking DBA::connect()
|
||||
*
|
||||
* @param bool $return True, if the connect was successful, otherwise false
|
||||
* @param null|int $times How often the method will get used
|
||||
*/
|
||||
public function mockConnect($return = true, $times = null)
|
||||
{
|
||||
if (!isset($this->dbaMock)) {
|
||||
|
@ -21,6 +32,12 @@ trait DBAMockTrait
|
|||
->andReturn($return);
|
||||
}
|
||||
|
||||
/**
|
||||
* Mocking DBA::connected()
|
||||
*
|
||||
* @param bool $return True, if the DB is connected, otherwise false
|
||||
* @param null|int $times How often the method will get used
|
||||
*/
|
||||
public function mockConnected($return = true, $times = null)
|
||||
{
|
||||
if (!isset($this->dbaMock)) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue