myBean = new SugarBean(); $this->myBean->field_defs = array( 'id' => array('name' => 'id', 'vname' => 'LBL_ID', 'type' => 'id', 'required' => true, ), 'name' => array('name' => 'name', 'vname' => 'LBL_NAME', 'type' => 'varchar', 'len' => '255', 'importable' => 'required', ), 'bool_field' => array('name' => 'bool_field', 'vname' => 'LBL_BOOL_FIELD', 'type' => 'bool', 'importable' => false, ), 'int_field' => array('name' => 'int_field', 'vname' => 'LBL_INT_FIELD', 'type' => 'int', ), 'autoinc_field' => array('name' => 'autoinc_field', 'vname' => 'LBL_AUTOINC_FIELD', 'type' => 'true', 'auto_increment' => true, ), 'float_field' => array('name' => 'float_field', 'vname' => 'LBL_FLOAT_FIELD', 'type' => 'float', 'precision' => 2, ), 'date_field' => array('name' => 'date_field', 'vname' => 'LBL_DATE_FIELD', 'type' => 'date', ), 'time_field' => array('name' => 'time_field', 'vname' => 'LBL_TIME_FIELD', 'type' => 'time', 'importable' => 'false', ), 'datetime_field' => array('name' => 'datetime_field', 'vname' => 'LBL_DATETIME_FIELD', 'type' => 'datetime', ), 'link_field1' => array('name' => 'link_field1', 'type' => 'link', ), 'link_field2' => array('name' => 'link_field1', 'type' => 'link', 'importable' => true, ), 'link_field3' => array('name' => 'link_field1', 'type' => 'link', 'importable' => 'true', ), ); } public function tearDown() { SugarTestUserUtilities::removeAllCreatedAnonymousUsers(); unset($GLOBALS['current_user']); unset($this->time_date); } /** * @ticket 31397 */ public function testImportableFields() { $fields = array( 'id', 'name', 'int_field', 'float_field', 'date_field', 'datetime_field', 'link_field2', 'link_field3', ); $this->assertEquals( $fields, array_keys($this->myBean->get_importable_fields()) ); } /** * @ticket 31397 */ public function testImportableRequiredFields() { $fields = array( 'name', ); $this->assertEquals( $fields, array_keys($this->myBean->get_import_required_fields()) ); } }