tests: The app is soon not mocked anymore, so don't use it as such

This commit is contained in:
Johannes Meyer 2023-07-04 16:26:36 +02:00
parent e572652f4c
commit 776e0803fa
2 changed files with 6 additions and 18 deletions

View File

@ -42,7 +42,6 @@ class AuthenticationBackendReorderFormTest extends BaseTestCase
)
);
Icinga::app()->shouldReceive('getModuleManager->getLoadedModules')->andReturn([]);
$this->getRequestMock()->shouldReceive('getMethod')->andReturn('POST')
->shouldReceive('isPost')->andReturn(true)
->shouldReceive('getPost')->andReturn(array('backend_newpos' => 'test3|1'));

View File

@ -3,8 +3,8 @@
namespace Tests\Icinga\Web;
use Icinga\Application\Icinga;
use Icinga\Authentication\Role;
use Mockery;
use Icinga\Test\BaseTestCase;
use Icinga\User;
use Icinga\Web\Widget\SearchDashboard;
@ -13,23 +13,12 @@ class SearchDashboardTest extends BaseTestCase
{
public function setUp(): void
{
$moduleMock = Mockery::mock('Icinga\Application\Modules\Module');
$searchUrl = (object) array(
'title' => 'Hosts',
'url' => 'monitoring/list/hosts?sort=host_severity&limit=10'
);
$moduleMock->shouldReceive('getSearchUrls')->andReturn(array(
$searchUrl
));
$moduleMock->shouldReceive('getName')->andReturn('test');
parent::setUp();
$moduleManagerMock = Mockery::mock('Icinga\Application\Modules\Manager');
$moduleManagerMock->shouldReceive('getLoadedModules')->andReturn(array(
'test-module' => $moduleMock
));
$bootstrapMock = $this->setupIcingaMock();
$bootstrapMock->shouldReceive('getModuleManager')->andReturn($moduleManagerMock);
Icinga::app()->getModuleManager()
->loadModule('test-module', '/tmp')
->getModule('test-module')
->provideSearchUrl('Hosts', 'monitoring/list/hosts?sort=host_severity&limit=10');
}
public function testWhetherRenderThrowsAnExceptionWhenHasNoDashlets()