bean = new Bug49691aMockBean(); $this->sugarField = new SugarFieldDatetimecombo("Accounts"); $GLOBALS['current_user'] = SugarTestUserUtilities::createAnonymousUser(); } public function tearDown() { unset($GLOBALS['current_user']); SugarTestUserUtilities::removeAllCreatedAnonymousUsers(); unset($this->sugarField); } /** * @dataProvider providerFunction */ public function testDBDateConversion($dateValue, $expected) { global $current_user; $this->bean->test_c = $dateValue; $inputData = array('test_c'=>$dateValue); $field = 'test_c'; $def = ''; $prefix = ''; $this->sugarField->save($this->bean, $inputData, $field, $def, $prefix); $this->assertNotEmpty($this->bean->test_c); $this->assertSame($expected, $this->bean->test_c); } public function providerFunction() { return array( array('01/01/2012 12:00', '2012-01-01 12:00:00'), array('2012-01-01 12:00:00', '2012-01-01 12:00:00'), array('01/01/2012', '2012-01-01'), array('2012-01-01', '2012-01-01'), ); } } class Bug49691aMockBean { var $test_c; } ?>