diff --git a/test/OQL/OQLToSQLAllClassesTest.php b/test/OQL/OQLToSQLAllClassesTest.php index ab021885c..bc24bd5b2 100644 --- a/test/OQL/OQLToSQLAllClassesTest.php +++ b/test/OQL/OQLToSQLAllClassesTest.php @@ -69,15 +69,6 @@ class OQLToSQLAllCLassesTest extends ItopDataTestCase */ public function testOQLLegacySetup() { - utils::GetConfig()->Set('use_legacy_dbsearch', true, 'Test'); - utils::GetConfig()->Set('apc_cache.enabled', false, 'Test'); - utils::GetConfig()->Set('expression_cache_enabled', false, 'Test'); - utils::GetConfig()->Set('query_cache_enabled', false, 'Test'); - $sConfigFile = utils::GetConfig()->GetLoadedFile(); - @chmod($sConfigFile, 0770); - utils::GetConfig()->WriteToFile(); - @chmod($sConfigFile, 0444); // Read-only - SetupUtils::rrmdir($sResultFile = APPROOT.'log/test'); } @@ -100,15 +91,19 @@ class OQLToSQLAllCLassesTest extends ItopDataTestCase */ public function testOQLLegacyAllClasses($sOQL, $aOrderBy = array(), $aArgs = array(), $aAttToLoad = null, $aExtendedDataSpec = null, $iLimitCount = 20, $iLimitStart = 0) { + utils::GetConfig()->Set('use_legacy_dbsearch', true, 'Test'); + utils::GetConfig()->Set('apc_cache.enabled', false, 'Test'); + utils::GetConfig()->Set('expression_cache_enabled', false, 'Test'); + utils::GetConfig()->Set('query_cache_enabled', false, 'Test'); + $this->assertTrue(utils::GetConfig()->Get('use_legacy_dbsearch')); $this->assertFalse(utils::GetConfig()->Get('apc_cache.enabled')); $this->assertFalse(utils::GetConfig()->Get('query_cache_enabled')); $this->assertFalse(utils::GetConfig()->Get('expression_cache_enabled')); $aPrevious = $this->GetPreviousTestResult($this->GetId()); - if (is_null($aPrevious)) - { - $aResult = $this->OQLSelectRunner($sOQL, $aOrderBy, $aArgs, $aAttToLoad, $aExtendedDataSpec, $iLimitCount, $iLimitStart); + if (is_null($aPrevious)) { + $aResult = $this->OQLSelectRunner($sOQL, $aOrderBy, $aArgs, $aAttToLoad, $aExtendedDataSpec, $iLimitCount, $iLimitStart); // no test yet, just save $this->SaveTestResult($this->GetId(), $aResult); $this->debug("Test result saved"); @@ -116,27 +111,8 @@ class OQLToSQLAllCLassesTest extends ItopDataTestCase $this->assertTrue(true); } - /** - * @doesNotPerformAssertions - * - * @throws \ConfigException - * @throws \CoreException - */ - public function testOQLSetup() - { - utils::GetConfig()->Set('use_legacy_dbsearch', false, 'test'); - utils::GetConfig()->Set('apc_cache.enabled', false, 'test'); - utils::GetConfig()->Set('query_cache_enabled', false, 'test'); - utils::GetConfig()->Set('expression_cache_enabled', false, 'test'); - $sConfigFile = utils::GetConfig()->GetLoadedFile(); - @chmod($sConfigFile, 0770); - utils::GetConfig()->WriteToFile(); - @chmod($sConfigFile, 0444); // Read-only - } - /** * @dataProvider OQLSelectProvider - * @depends testOQLSetup * * @param $sOQL * @@ -153,6 +129,11 @@ class OQLToSQLAllCLassesTest extends ItopDataTestCase */ public function testOQLAllClasses($sOQL, $aOrderBy = array(), $aArgs = array(), $aAttToLoad = null, $aExtendedDataSpec = null, $iLimitCount = 20, $iLimitStart = 0) { + utils::GetConfig()->Set('use_legacy_dbsearch', false, 'test'); + utils::GetConfig()->Set('apc_cache.enabled', false, 'test'); + utils::GetConfig()->Set('query_cache_enabled', false, 'test'); + utils::GetConfig()->Set('expression_cache_enabled', false, 'test'); + $this->assertFalse(utils::GetConfig()->Get('use_legacy_dbsearch')); $this->assertFalse(utils::GetConfig()->Get('apc_cache.enabled')); $this->assertFalse(utils::GetConfig()->Get('query_cache_enabled')); diff --git a/test/OQL/OQLToSQLGroupByTest.php b/test/OQL/OQLToSQLGroupByTest.php index cf6f713dc..8fda5411d 100644 --- a/test/OQL/OQLToSQLGroupByTest.php +++ b/test/OQL/OQLToSQLGroupByTest.php @@ -56,15 +56,6 @@ class OQLToSQLTest extends ItopDataTestCase */ public function testOQLLegacySetup() { - utils::GetConfig()->Set('use_legacy_dbsearch', true, 'Test'); - utils::GetConfig()->Set('apc_cache.enabled', false, 'Test'); - utils::GetConfig()->Set('expression_cache_enabled', false, 'Test'); - utils::GetConfig()->Set('query_cache_enabled', false, 'Test'); - $sConfigFile = utils::GetConfig()->GetLoadedFile(); - @chmod($sConfigFile, 0770); - utils::GetConfig()->WriteToFile(); - @chmod($sConfigFile, 0444); // Read-only - SetupUtils::rrmdir($sResultFile = APPROOT.'log/test'); } @@ -88,14 +79,18 @@ class OQLToSQLTest extends ItopDataTestCase */ public function testOQLGroupByLegacy($sOQL, $aArgs, $aGroupByExpr, $bExcludeNullValues = false, $aSelectExpr = array(), $aOrderBy = array(), $iLimitCount = 0, $iLimitStart = 0) { + utils::GetConfig()->Set('use_legacy_dbsearch', true, 'Test'); + utils::GetConfig()->Set('apc_cache.enabled', false, 'Test'); + utils::GetConfig()->Set('expression_cache_enabled', false, 'Test'); + utils::GetConfig()->Set('query_cache_enabled', false, 'Test'); + $this->assertTrue(utils::GetConfig()->Get('use_legacy_dbsearch')); $this->assertFalse(utils::GetConfig()->Get('apc_cache.enabled')); $this->assertFalse(utils::GetConfig()->Get('query_cache_enabled')); $this->assertFalse(utils::GetConfig()->Get('expression_cache_enabled')); $aPrevious = $this->GetPreviousTestResult($this->GetId()); - if (is_null($aPrevious)) - { + if (is_null($aPrevious)) { $aResult = $this->OQLGroupByRunner($sOQL, $aArgs, $aGroupByExpr, $bExcludeNullValues, $aSelectExpr, $aOrderBy, $iLimitCount, $iLimitStart); // no test yet, just save $this->SaveTestResult($this->GetId(), $aResult); @@ -112,15 +107,6 @@ class OQLToSQLTest extends ItopDataTestCase */ public function testOQLSetup() { - utils::GetConfig()->Set('use_legacy_dbsearch', false, 'test'); - utils::GetConfig()->Set('apc_cache.enabled', false, 'test'); - utils::GetConfig()->Set('query_cache_enabled', false, 'test'); - utils::GetConfig()->Set('expression_cache_enabled', false, 'test'); - $sConfigFile = utils::GetConfig()->GetLoadedFile(); - @chmod($sConfigFile, 0770); - utils::GetConfig()->WriteToFile(); - @chmod($sConfigFile, 0444); // Read-only - $aCSVHeader = array( 'test', 'OQL','count', 'Legacy Count Joins', 'Count Joins', @@ -152,6 +138,11 @@ class OQLToSQLTest extends ItopDataTestCase */ public function testOQLGroupBy($sOQL, $aArgs, $aGroupByExpr, $bExcludeNullValues = false, $aSelectExpr = array(), $aOrderBy = array(), $iLimitCount = 0, $iLimitStart = 0) { + utils::GetConfig()->Set('use_legacy_dbsearch', false, 'test'); + utils::GetConfig()->Set('apc_cache.enabled', false, 'test'); + utils::GetConfig()->Set('query_cache_enabled', false, 'test'); + utils::GetConfig()->Set('expression_cache_enabled', false, 'test'); + $this->assertFalse(utils::GetConfig()->Get('use_legacy_dbsearch')); $this->assertFalse(utils::GetConfig()->Get('apc_cache.enabled')); $this->assertFalse(utils::GetConfig()->Get('query_cache_enabled')); diff --git a/test/OQL/OQLToSQLNestedSelectTest.php b/test/OQL/OQLToSQLNestedSelectTest.php index 2cbd1a076..8eb0df6e3 100644 --- a/test/OQL/OQLToSQLNestedSelectTest.php +++ b/test/OQL/OQLToSQLNestedSelectTest.php @@ -31,29 +31,9 @@ class OQLToSQLNestedSelectTest extends ItopDataTestCase SetupUtils::builddir(APPROOT.'log/test/OQLToSQL'); } - /** - * @doesNotPerformAssertions - * - * @throws \ConfigException - * @throws \CoreException - */ - public function testOQLSetup() - { - utils::GetConfig()->Set('use_legacy_dbsearch', false, 'test'); - utils::GetConfig()->Set('apc_cache.enabled', false, 'test'); - utils::GetConfig()->Set('query_cache_enabled', false, 'test'); - utils::GetConfig()->Set('expression_cache_enabled', false, 'test'); - $sConfigFile = utils::GetConfig()->GetLoadedFile(); - @chmod($sConfigFile, 0770); - utils::GetConfig()->WriteToFile(); - @chmod($sConfigFile, 0444); // Read-only - - } - /** * @group itopConfigMgmt * @dataProvider OQLSelectProvider - * @depends testOQLSetup * * @param $sOQL * @@ -70,6 +50,11 @@ class OQLToSQLNestedSelectTest extends ItopDataTestCase */ public function testOQLSelect($sOQL, $aOrderBy = array(), $aArgs = array(), $aAttToLoad = null, $aExtendedDataSpec = null, $iLimitCount = 20, $iLimitStart = 0) { + utils::GetConfig()->Set('use_legacy_dbsearch', false, 'test'); + utils::GetConfig()->Set('apc_cache.enabled', false, 'test'); + utils::GetConfig()->Set('query_cache_enabled', false, 'test'); + utils::GetConfig()->Set('expression_cache_enabled', false, 'test'); + $this->assertFalse(utils::GetConfig()->Get('use_legacy_dbsearch')); $this->assertFalse(utils::GetConfig()->Get('apc_cache.enabled')); $this->assertFalse(utils::GetConfig()->Get('query_cache_enabled')); diff --git a/test/OQL/OQLToSQLTest.php b/test/OQL/OQLToSQLTest.php index 0f578c6fe..82d944780 100644 --- a/test/OQL/OQLToSQLTest.php +++ b/test/OQL/OQLToSQLTest.php @@ -63,15 +63,6 @@ class OQLToSQLTest extends ItopDataTestCase */ public function testOQLLegacySetup() { - utils::GetConfig()->Set('use_legacy_dbsearch', true, 'Test'); - utils::GetConfig()->Set('apc_cache.enabled', false, 'Test'); - utils::GetConfig()->Set('expression_cache_enabled', false, 'Test'); - utils::GetConfig()->Set('query_cache_enabled', false, 'Test'); - $sConfigFile = utils::GetConfig()->GetLoadedFile(); - @chmod($sConfigFile, 0770); - utils::GetConfig()->WriteToFile(); - @chmod($sConfigFile, 0444); // Read-only - SetupUtils::rrmdir($sResultFile = APPROOT.'log/test'); } @@ -94,14 +85,18 @@ class OQLToSQLTest extends ItopDataTestCase */ public function testOQLLegacySelect($sOQL, $aOrderBy = array(), $aArgs = array(), $aAttToLoad = null, $aExtendedDataSpec = null, $iLimitCount = 20, $iLimitStart = 0) { + utils::GetConfig()->Set('use_legacy_dbsearch', true, 'Test'); + utils::GetConfig()->Set('apc_cache.enabled', false, 'Test'); + utils::GetConfig()->Set('expression_cache_enabled', false, 'Test'); + utils::GetConfig()->Set('query_cache_enabled', false, 'Test'); + $this->assertTrue(utils::GetConfig()->Get('use_legacy_dbsearch')); $this->assertFalse(utils::GetConfig()->Get('apc_cache.enabled')); $this->assertFalse(utils::GetConfig()->Get('query_cache_enabled')); $this->assertFalse(utils::GetConfig()->Get('expression_cache_enabled')); $aPrevious = $this->GetPreviousTestResult($this->GetId()); - if (is_null($aPrevious)) - { + if (is_null($aPrevious)) { $aResult = $this->OQLSelectRunner($sOQL, $aOrderBy, $aArgs, $aAttToLoad, $aExtendedDataSpec, $iLimitCount, $iLimitStart); // no test yet, just save $this->SaveTestResult($this->GetId(), $aResult); @@ -118,15 +113,6 @@ class OQLToSQLTest extends ItopDataTestCase */ public function testOQLSetup() { - utils::GetConfig()->Set('use_legacy_dbsearch', false, 'test'); - utils::GetConfig()->Set('apc_cache.enabled', false, 'test'); - utils::GetConfig()->Set('query_cache_enabled', false, 'test'); - utils::GetConfig()->Set('expression_cache_enabled', false, 'test'); - $sConfigFile = utils::GetConfig()->GetLoadedFile(); - @chmod($sConfigFile, 0770); - utils::GetConfig()->WriteToFile(); - @chmod($sConfigFile, 0444); // Read-only - $aCSVHeader = array( 'test', 'OQL','count', 'Legacy Count Joins', 'Count Joins', @@ -157,6 +143,11 @@ class OQLToSQLTest extends ItopDataTestCase */ public function testOQLSelect($sOQL, $aOrderBy = array(), $aArgs = array(), $aAttToLoad = null, $aExtendedDataSpec = null, $iLimitCount = 20, $iLimitStart = 0) { + utils::GetConfig()->Set('use_legacy_dbsearch', false, 'test'); + utils::GetConfig()->Set('apc_cache.enabled', false, 'test'); + utils::GetConfig()->Set('query_cache_enabled', false, 'test'); + utils::GetConfig()->Set('expression_cache_enabled', false, 'test'); + $this->assertFalse(utils::GetConfig()->Get('use_legacy_dbsearch')); $this->assertFalse(utils::GetConfig()->Get('apc_cache.enabled')); $this->assertFalse(utils::GetConfig()->Get('query_cache_enabled'));