Bugfixing & Enhancement
- Added Mocking Engine for App, DBA, Config - Using Mocking Engine for AutomaticInstallationConsoleTest - Using Mocking Engine for ConfigConsoleTest - Removing MultiUserConsole - Workaround
This commit is contained in:
parent
f7147fae96
commit
0e22c18a9d
10 changed files with 515 additions and 175 deletions
37
tests/Util/DBStructureMockTrait.php
Normal file
37
tests/Util/DBStructureMockTrait.php
Normal file
|
@ -0,0 +1,37 @@
|
|||
<?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);
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue