mirror of
https://github.com/Icinga/icingaweb2.git
synced 2025-07-29 00:34:03 +02:00
Fix dashboard tests utilizing BaseTestCase::setupIcingaMock()
This commit is contained in:
parent
a5c027b77c
commit
cee3c32fa5
@ -47,7 +47,7 @@ class DashboardTest extends BaseTestCase
|
|||||||
Mockery::close(); // Necessary because some tests run in a separate process
|
Mockery::close(); // Necessary because some tests run in a separate process
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function setupIcingaMock(\Zend_Controller_Request_Abstract $request)
|
public function setUp()
|
||||||
{
|
{
|
||||||
$moduleMock = Mockery::mock('Icinga\Application\Modules\Module');
|
$moduleMock = Mockery::mock('Icinga\Application\Modules\Module');
|
||||||
$moduleMock->shouldReceive('getPaneItems')->andReturn(array(
|
$moduleMock->shouldReceive('getPaneItems')->andReturn(array(
|
||||||
@ -59,14 +59,8 @@ class DashboardTest extends BaseTestCase
|
|||||||
'test-module' => $moduleMock
|
'test-module' => $moduleMock
|
||||||
));
|
));
|
||||||
|
|
||||||
$bootstrapMock = Mockery::mock('Icinga\Application\ApplicationBootstrap')->shouldDeferMissing();
|
$bootstrapMock = $this->setupIcingaMock();
|
||||||
$bootstrapMock->shouldReceive('getFrontController->getRequest')->andReturnUsing(
|
|
||||||
function () use ($request) { return $request; }
|
|
||||||
)->shouldReceive('getApplicationDir')->andReturn(self::$appDir);
|
|
||||||
|
|
||||||
$bootstrapMock->shouldReceive('getModuleManager')->andReturn($moduleManagerMock);
|
$bootstrapMock->shouldReceive('getModuleManager')->andReturn($moduleManagerMock);
|
||||||
|
|
||||||
Icinga::setApp($bootstrapMock, true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testWhetherCreatePaneCreatesAPane()
|
public function testWhetherCreatePaneCreatesAPane()
|
||||||
|
@ -5,19 +5,12 @@
|
|||||||
namespace Tests\Icinga\Web;
|
namespace Tests\Icinga\Web;
|
||||||
|
|
||||||
use Mockery;
|
use Mockery;
|
||||||
use Icinga\Application\Icinga;
|
|
||||||
use Icinga\Web\Widget\SearchDashboard;
|
|
||||||
use Icinga\Test\BaseTestCase;
|
use Icinga\Test\BaseTestCase;
|
||||||
|
use Icinga\Web\Widget\SearchDashboard;
|
||||||
|
|
||||||
class SearchDashboardTest extends BaseTestCase
|
class SearchDashboardTest extends BaseTestCase
|
||||||
{
|
{
|
||||||
public function tearDown()
|
public function setUp()
|
||||||
{
|
|
||||||
parent::tearDown();
|
|
||||||
Mockery::close();
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function setupIcingaMock(\Zend_Controller_Request_Abstract $request)
|
|
||||||
{
|
{
|
||||||
$moduleMock = Mockery::mock('Icinga\Application\Modules\Module');
|
$moduleMock = Mockery::mock('Icinga\Application\Modules\Module');
|
||||||
$searchUrl = (object) array(
|
$searchUrl = (object) array(
|
||||||
@ -33,14 +26,8 @@ class SearchDashboardTest extends BaseTestCase
|
|||||||
'test-module' => $moduleMock
|
'test-module' => $moduleMock
|
||||||
));
|
));
|
||||||
|
|
||||||
$bootstrapMock = Mockery::mock('Icinga\Application\ApplicationBootstrap')->shouldDeferMissing();
|
$bootstrapMock = $this->setupIcingaMock();
|
||||||
$bootstrapMock->shouldReceive('getFrontController->getRequest')->andReturnUsing(
|
|
||||||
function () use ($request) { return $request; }
|
|
||||||
)->shouldReceive('getApplicationDir')->andReturn(self::$appDir);
|
|
||||||
|
|
||||||
$bootstrapMock->shouldReceive('getModuleManager')->andReturn($moduleManagerMock);
|
$bootstrapMock->shouldReceive('getModuleManager')->andReturn($moduleManagerMock);
|
||||||
|
|
||||||
Icinga::setApp($bootstrapMock, true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user