mirror of
https://github.com/Combodo/iTop.git
synced 2026-04-24 02:58:43 +02:00
✅ Fix unit tests
This commit is contained in:
@@ -679,20 +679,21 @@ class DBSearchTest extends ItopDataTestCase
|
||||
$oSet = new \CMDBObjectSet($oSearch, array(), array('org_ids' => $TwoOrgIdsOnly));
|
||||
static::assertEquals(4, $oSet->Count());
|
||||
|
||||
$_SERVER['REQUEST_URI'] = 'FAKE_REQUEST_URI';
|
||||
$_SERVER['REQUEST_METHOD'] = 'FAKE_REQUEST_METHOD';
|
||||
$oP = new \iTopWebPage("test");
|
||||
$oBlock = new \DisplayBlock($oSet->GetFilter(), 'list', false);
|
||||
$oHtml = $oBlock->GetDisplay($oP, 'package_table', array('menu' => true, 'display_limit' => false));
|
||||
$sHtml = BlockRenderer::RenderBlockTemplates($oHtml);
|
||||
|
||||
$iHtmlUserRequestLineCount = substr_count($sHtml, '<tr><td data-object-class="UserRequest"');
|
||||
static::assertEquals(4, $iHtmlUserRequestLineCount, "Failed Generated html :".$sHtml);
|
||||
// Content now generated with ajax call
|
||||
// $_SERVER['REQUEST_URI'] = 'FAKE_REQUEST_URI';
|
||||
// $_SERVER['REQUEST_METHOD'] = 'FAKE_REQUEST_METHOD';
|
||||
// $oP = new \iTopWebPage("test");
|
||||
// $oBlock = new \DisplayBlock($oSet->GetFilter(), 'list', false);
|
||||
// $oHtml = $oBlock->GetDisplay($oP, 'package_table', array('menu' => true, 'display_limit' => false));
|
||||
// $sHtml = BlockRenderer::RenderBlockTemplates($oHtml);
|
||||
//
|
||||
// $iHtmlUserRequestLineCount = substr_count($sHtml, '<tr><td data-object-class="UserRequest"');
|
||||
// static::assertEquals(4, $iHtmlUserRequestLineCount, "Failed Generated html :".$sHtml);
|
||||
|
||||
// As using $oP we added some content in the PHP buffer, we need to empty it !
|
||||
// Otherwise PHPUnit will throw the error : "Test code or tested code did not (only) close its own output buffers"
|
||||
// Previously we were using a output() call but this is time consuming and could cause "risky test" error !
|
||||
ob_get_clean();
|
||||
// ob_get_clean();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user