/** * test import data */ public function testImport() { $definition = Tinebase_ImportExportDefinition::getInstance()->getByName('adb_import_vcard'); $this->_instance = Addressbook_Import_VCard::createFromDefinition($definition, array('dryrun' => TRUE)); $result = $this->_instance->importFile($this->_filename); //print_r($result['results']->getFirstRecord()->toArray()); $this->assertEquals(2, $result['totalcount'], 'Didn\'t import anything.'); $this->assertEquals('spass, alex', $result['results']->getFirstRecord()->n_fileas, 'file as not found'); $this->assertEquals('+49732121258035', $result['results']->getFirstRecord()->tel_home, 'n_fileas not found'); $this->assertEquals('mitbewohner', $result['results']->getFirstRecord()->note, 'note not found'); $this->assertEquals('Eisenhüttenstraße 723', $result['results']->getFirstRecord()->adr_one_street, 'street not found'); $this->assertEquals('http://www.vcard.de', $result['results']->getFirstRecord()->url, 'url not found'); }
/** * import helper for HerrFalkMünchen.vcf * * @param Tinebase_Model_ImportExportDefinition $definition */ protected function _importFalk(Tinebase_Model_ImportExportDefinition $definition) { // file is iso-8859-1 encoded $this->_filename = dirname(__FILE__) . '/files/HerrFalkMünchen.vcf'; $this->_instance = Addressbook_Import_VCard::createFromDefinition($definition, array('dryrun' => FALSE)); $result = $this->_instance->importFile($this->_filename); $this->_contactIdsToDelete = array($result['results']->getArrayOfIds()); $importedContact = $result['results']->getFirstRecord(); $this->assertTrue($importedContact !== NULL); $this->assertEquals('Falk München', $importedContact->n_fn, print_r($importedContact->toArray(), TRUE)); $this->assertEquals('Düsseldorf', $importedContact->adr_one_locality, print_r($importedContact->toArray(), TRUE)); }