mirror of
https://github.com/Icinga/icingaweb2.git
synced 2025-07-23 13:54:26 +02:00
parent
e357960d1e
commit
6d209ee203
@ -28,8 +28,8 @@ class DbBackendFormTest extends BaseTestCase
|
|||||||
{
|
{
|
||||||
$this->setUpResourceFactoryMock();
|
$this->setUpResourceFactoryMock();
|
||||||
Mockery::mock('overload:Icinga\Authentication\User\DbUserBackend')
|
Mockery::mock('overload:Icinga\Authentication\User\DbUserBackend')
|
||||||
->shouldReceive('select->where->count')
|
->shouldReceive('inspect')
|
||||||
->andReturn(2);
|
->andReturn(self::createInspector(false));
|
||||||
|
|
||||||
// Passing array(null) is required to make Mockery call the constructor...
|
// Passing array(null) is required to make Mockery call the constructor...
|
||||||
$form = Mockery::mock('Icinga\Forms\Config\UserBackend\DbBackendForm[getView]', array(null));
|
$form = Mockery::mock('Icinga\Forms\Config\UserBackend\DbBackendForm[getView]', array(null));
|
||||||
@ -54,8 +54,8 @@ class DbBackendFormTest extends BaseTestCase
|
|||||||
{
|
{
|
||||||
$this->setUpResourceFactoryMock();
|
$this->setUpResourceFactoryMock();
|
||||||
Mockery::mock('overload:Icinga\Authentication\User\DbUserBackend')
|
Mockery::mock('overload:Icinga\Authentication\User\DbUserBackend')
|
||||||
->shouldReceive('count')
|
->shouldReceive('inspect')
|
||||||
->andReturn(0);
|
->andReturn(self::createInspector(true));
|
||||||
|
|
||||||
// Passing array(null) is required to make Mockery call the constructor...
|
// Passing array(null) is required to make Mockery call the constructor...
|
||||||
$form = Mockery::mock('Icinga\Forms\Config\UserBackend\DbBackendForm[getView]', array(null));
|
$form = Mockery::mock('Icinga\Forms\Config\UserBackend\DbBackendForm[getView]', array(null));
|
||||||
@ -80,4 +80,21 @@ class DbBackendFormTest extends BaseTestCase
|
|||||||
->shouldReceive('getResourceConfig')
|
->shouldReceive('getResourceConfig')
|
||||||
->andReturn(new ConfigObject());
|
->andReturn(new ConfigObject());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function createInspector($error = false, $log = array('log'))
|
||||||
|
{
|
||||||
|
if (! $error) {
|
||||||
|
$calls = array(
|
||||||
|
'hasError' => false,
|
||||||
|
'toArray' => $log
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
$calls = array(
|
||||||
|
'hasError' => true,
|
||||||
|
'getError' => 'Error',
|
||||||
|
'toArray' => $log
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return Mockery::mock('Icinga\Data\Inspection', $calls);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user