Skip to content

Commit

Permalink
tweak(tb) fix tests re property feature switch
Browse files Browse the repository at this point in the history
  • Loading branch information
paulmhh committed Feb 26, 2025
1 parent ea86959 commit dc6fc92
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 37 deletions.
28 changes: 7 additions & 21 deletions tests/tine20/Tinebase/Frontend/JsonTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -696,28 +696,14 @@ public function testGetAllRegistryData()
$symbols = Zend_Locale::getTranslationList('symbols', $locale);
self::assertEquals($symbols['decimal'], $registryData['Tinebase']['decimalSeparator']);

if (Sales_Config::getInstance()->featureEnabled(Sales_Config::FEATURE_INVOICES_MODULE)) {
$configuredSalesModels = array_keys($registryData['Sales']['models']);
self::assertTrue(in_array('Invoice', $configuredSalesModels), 'Invoices is missing from configured models: '
. print_r($configuredSalesModels, true));
$copyOmitFields = array(
'billed_in',
'invoice_id',
'status',
'cleared_at',
'relations',
);
} else {
$copyOmitFields = array(
'billed_in',
'status',
'cleared_at',
'relations',
);
}

self::assertTrue(isset($registryData['Timetracker']['models']['Timeaccount']['copyOmitFields']), 'Timeaccount copyOmitFields empty/missing');
self::assertEquals($copyOmitFields, $registryData['Timetracker']['models']['Timeaccount']['copyOmitFields']);
self::assertEquals([
'billed_in',
'invoice_id',
'status',
'cleared_at',
'relations',
], $registryData['Timetracker']['models']['Timeaccount']['copyOmitFields']);
self::assertTrue(is_array(($registryData['Timetracker']['relatableModels'][0])), 'relatableModels needs to be an numbered array');

$this->_assertImportExportDefinitions($registryData);
Expand Down
16 changes: 0 additions & 16 deletions tests/tine20/Tinebase/ModelConfigurationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,22 +37,6 @@ public function testModelCreationTraditional()
$this->assertNull($cObj);
}

/**
* tests if the modelconfiguration is created for foreign record keys that are disabled by a feature switch
*/
public function testModelConfigWithDisabledForeignRecords()
{
// TODO disable feature first
if (Sales_Config::getInstance()->featureEnabled(Sales_Config::FEATURE_INVOICES_MODULE)) {
$this->markTestSkipped('only testable when disabled');
}

$timesheet = new Timetracker_Model_Timesheet(array(), true);
$mcFields = $timesheet->getConfiguration()->getFields();
$this->assertEquals('string', $mcFields['invoice_id']['type']);
$this->assertEquals(null, $mcFields['invoice_id']['label']);
}

/**
* testModelConfigWithDisabledRelationApp
*/
Expand Down

0 comments on commit dc6fc92

Please sign in to comment.