Merge branch '2013.10'
[tine20] / tests / tine20 / Courses / JsonTest.php
1 <?php
2 /**
3  * Tine 2.0 - http://www.tine20.org
4  * 
5  * @package     Courses
6  * @license     http://www.gnu.org/licenses/agpl.html
7  * @copyright   Copyright (c) 2009-2013 Metaways Infosystems GmbH (http://www.metaways.de)
8  * @author      Philipp Schüle <p.schuele@metaways.de>
9  */
10
11 /**
12  * Test helper
13  */
14 require_once dirname(dirname(__FILE__)) . DIRECTORY_SEPARATOR . 'TestHelper.php';
15
16 /**
17  * Test class for Courses_Frontend_Json
18  */
19 class Courses_JsonTest extends TestCase
20 {
21     /**
22      * @var Courses_Frontend_Json
23      */
24     protected $_json = array();
25     
26     /**
27      * config groups
28      * 
29      * @var array
30      */
31     protected $_configGroups = array();
32     
33     /**
34      * @var Tinebase_Record_RecordSet
35      */
36     protected $_groupsToDelete = null;
37     
38     /**
39      * test department
40      * 
41      * @var Tinebase_Model_Department
42      */
43     protected $_department = NULL;
44
45     /**
46      * Sets up the fixture.
47      * This method is called before a test is executed.
48      *
49      * @access protected
50      */
51     protected function setUp()
52     {
53         parent::setUp();
54         
55         $this->_json = new Courses_Frontend_Json();
56         
57         $this->_department = Tinebase_Department::getInstance()->create(new Tinebase_Model_Department(array(
58             'name'  => Tinebase_Record_Abstract::generateUID()
59         )));
60         
61         $this->_groupsToDelete = new Tinebase_Record_RecordSet('Tinebase_Model_Group');
62         foreach (array(Courses_Config::INTERNET_ACCESS_GROUP_ON, Courses_Config::INTERNET_ACCESS_GROUP_FILTERED, Courses_Config::STUDENTS_GROUP) as $configgroup) {
63             $this->_configGroups[$configgroup] = Tinebase_Group::getInstance()->create(new Tinebase_Model_Group(array(
64                 'name'   => $configgroup
65             )));
66             $this->_groupsToDelete->addRecord($this->_configGroups[$configgroup]);
67             Courses_Config::getInstance()->set($configgroup, $this->_configGroups[$configgroup]->getId());
68         }
69         
70         Courses_Config::getInstance()->set(Courses_Config::SAMBA, new Tinebase_Config_Struct(array(
71             'basehomepath' => '\\\\jo\\',
72             'homedrive' => 'X:',
73             'logonscript_postfix_teacher' => '-lehrer.cmd',
74             'logonscript_postfix_member' => '.cmd',
75             'baseprofilepath' => '\\\\jo\\profiles\\',
76         )));
77     }
78
79     /**
80      * Tears down the fixture
81      * This method is called after a test is executed.
82      *
83      * @access protected
84      */
85     protected function tearDown()
86     {
87         $this->_groupsIdsToDelete = $this->_groupsToDelete->getArrayOfIds();
88         
89         parent::tearDown();
90     }
91     
92     /**
93      * try to add a Course
94      */
95     public function testAddCourse()
96     {
97         $course = $this->_getCourseData();
98         $courseData = $this->_json->saveCourse($course);
99         $this->_groupsToDelete->addRecord(Tinebase_Group::getInstance()->getGroupById($courseData['group_id']));
100         
101         // checks
102         $this->assertEquals($course['description'], $courseData['description']);
103         $this->assertEquals($course['type'], $courseData['type']['value']);
104         $this->assertEquals(Tinebase_Core::getUser()->getId(), $courseData['created_by'], 'Created by has not been set.');
105         $this->assertTrue(! empty($courseData['group_id']));
106         $this->assertGreaterThan(0, count($courseData['members']));
107         
108         // cleanup
109         $this->_json->deleteCourses($courseData['id']);
110
111         // check if it got deleted
112         $this->setExpectedException('Tinebase_Exception_NotFound');
113         Courses_Controller_Course::getInstance()->get($courseData['id']);
114     }
115     
116     /**
117      * try to get a Course
118      */
119     public function testGetCourse()
120     {
121         $course = $this->_getCourseData();
122         $courseData = $this->_json->saveCourse($course);
123         $this->_groupsToDelete->addRecord(Tinebase_Group::getInstance()->getGroupById($courseData['group_id']));
124         $courseData = $this->_json->getCourse($courseData['id']);
125         
126         // checks
127         $this->assertEquals($course['description'], $courseData['description']);
128         $this->assertEquals(Tinebase_Core::getUser()->getId(), $courseData['created_by']);
129         
130         // cleanup
131         $this->_json->deleteCourses($courseData['id']);
132     }
133
134     /**
135      * try to update a Course
136      */
137     public function testUpdateCourse()
138     {
139         $course = $this->_getCourseData();
140         $courseData = $this->_json->saveCourse($course);
141         $this->_groupsToDelete->addRecord(Tinebase_Group::getInstance()->getGroupById($courseData['group_id']));
142
143         // update Course
144         $courseData['description'] = "blubbblubb";
145         $courseData['members'] = array();
146         $courseData['type'] = $courseData['type']['value'];
147         $courseUpdated = $this->_json->saveCourse($courseData);
148         
149         // check
150         $this->assertEquals($courseData['id'], $courseUpdated['id']);
151         $this->assertEquals($courseData['description'], $courseUpdated['description']);
152         $this->assertEquals(Tinebase_Core::getUser()->getId(), $courseUpdated['last_modified_by']);
153         $this->assertEquals($courseData['members'], $courseUpdated['members']);
154         
155         // cleanup
156         $this->_json->deleteCourses($courseData['id']);
157     }
158     
159     /**
160      * try to get a Course
161      */
162     public function testSearchCourses()
163     {
164         // create
165         $course = $this->_getCourseData();
166         $courseData = $this->_json->saveCourse($course);
167         $this->_groupsToDelete->addRecord(Tinebase_Group::getInstance()->getGroupById($courseData['group_id']));
168         
169         // search & check
170         $search = $this->_json->searchCourses($this->_getCourseFilter($courseData['name']), $this->_getPaging());
171         $this->assertEquals($course['description'], $search['results'][0]['description']);
172         $this->assertEquals(1, $search['totalcount']);
173         
174         // cleanup
175         $this->_json->deleteCourses($courseData['id']);
176     }
177        
178     /**
179      * test for import of members (1)
180      */
181     public function testImportMembersIntoCourse1()
182     {
183         $definition = Tinebase_ImportExportDefinition::getInstance()->getByName('admin_user_import_csv');
184         $result = $this->_importHelper(dirname(dirname(__FILE__)) . '/Admin/files/testHeadline.csv', $definition);
185
186         $this->assertEquals(4, count($result['members']), print_r($result, TRUE));
187     }
188
189     /**
190      * test for import of members (2)
191      * 
192      * @group longrunning
193      */
194     public function testImportMembersIntoCourse2()
195     {
196         $result = $this->_importHelper(dirname(__FILE__) . '/files/import.txt');
197         
198         $this->assertEquals(5, count($result['members']), print_r($result, TRUE));
199         
200         // find philipp lahm
201         $lahm = array();
202         foreach ($result['members'] as $member) {
203             if ($member['name'] == 'Lahm, Philipp') {
204                 $lahm = $member;
205             }
206         }
207         $this->assertTrue(! empty($lahm));
208         $this->assertEquals('lahmph', $lahm['data']);
209         
210         // get user and check email
211         $testConfig = Zend_Registry::get('testConfig');
212         $maildomain = ($testConfig->maildomain) ? $testConfig->maildomain : 'school.org';
213         $user = Tinebase_User::getInstance()->getFullUserById($lahm['id']);
214         $this->assertEquals('lahmph', $user->accountLoginName);
215         $this->assertEquals('lahmph@' . $maildomain, $user->accountEmailAddress);
216         $this->assertEquals('//base/school/' . $result['name'] . '/' . $user->accountLoginName, $user->accountHomeDirectory);
217     }
218     
219     /**
220      * test for import of members (3) / json import
221      */
222     public function testImportMembersIntoCourse3()
223     {
224         $result = $this->_importHelper(dirname(__FILE__) . '/files/import.txt', NULL, TRUE);
225         $this->assertEquals(5, count($result['members']), 'import failed');
226         $this->assertEquals(5, count(Tinebase_Group::getInstance()->getGroupMembers($this->_configGroups[Courses_Config::STUDENTS_GROUP])), 'imported users not added to students group');
227     }
228
229     /**
230      * test for import of members (4) / json import
231      * 
232      * @see 0006672: allow to import (csv) files with only CR linebreaks
233      * 
234      * @group longrunning
235      */
236     public function testImportMembersIntoCourse4()
237     {
238         $result = $this->_importHelper(dirname(__FILE__) . '/files/testklasse.csv', $this->_getCourseImportDefinition2(), TRUE);
239         $this->assertEquals(25, count($result['members']), 'import failed');
240         $found = FALSE;
241         foreach($result['members'] as $member) {
242             if ($member['name'] === 'Kućuk, Orkide' && $member['data'] === 'kuukor') {
243                 $found = TRUE;
244             }
245         }
246         $this->assertTrue($found, 'Member "Kućuk, Orkide" not found in result: ' . print_r($result['members'], TRUE));
247         $this->assertEquals(25, count(Tinebase_Group::getInstance()->getGroupMembers($this->_configGroups[Courses_Config::STUDENTS_GROUP])), 'imported users not added to students group');
248     }
249
250     /**
251      * test for import of members (5) / json import
252      * 
253      * @see 0006942: group memberships and login shell missing for new users
254      */
255     public function testImportMembersIntoCourse5()
256     {
257         $result = $this->_importHelper(dirname(__FILE__) . '/files/tah2a.txt', $this->_getCourseImportDefinition3('iso-8859-1'), TRUE);
258         $this->assertEquals(3, count($result['members']), 'import failed');
259         
260         // check group memberships
261         $userId = NULL;
262         foreach ($result['members'] as $result) {
263             if ($result['name'] === 'Uffbass, Umud') {
264                 $userId = $result['id'];
265             }
266         }
267         $this->assertTrue($userId !== NULL);
268         
269         $groupMemberships = Tinebase_Group::getInstance()->getGroupMemberships($userId);
270         $this->assertEquals(3, count($groupMemberships), 'new user should have 3 group memberships');
271         $this->assertTrue(in_array($this->_configGroups[Courses_Config::INTERNET_ACCESS_GROUP_ON]->getId(), $groupMemberships), $userId . ' not member of the internet group ' . print_r($groupMemberships, TRUE));
272         
273         $user = Tinebase_User::getInstance()->getFullUserById($userId);
274         $this->assertEquals('/bin/false', $user->accountLoginShell);
275     }
276     
277     /**
278      * testGetCoursesPreferences
279      * 
280      * @see 0006436: Courses preferences do not work (in pref panel)
281      */
282     public function testGetCoursesPreferences()
283     {
284         $tinebaseJson = new Tinebase_Frontend_Json();
285         $coursesPrefs = $tinebaseJson->searchPreferencesForApplication('Courses', array());
286         
287         $this->assertTrue($coursesPrefs['totalcount'] > 0);
288         $pref = $coursesPrefs['results'][0];
289         
290         $this->assertEquals(Tinebase_Preference_Abstract::DEFAULTPERSISTENTFILTER, $pref['name']);
291         $this->assertGreaterThanOrEqual(2, count($pref['options']));
292     }
293
294     /**
295      * testImportWithMissingList
296      * 
297      * @see 0007460: check existence of group/list before user import
298      */
299     public function testImportWithMissingList()
300     {
301         $result = $this->_importHelper(dirname(__FILE__) . '/files/tah2a.txt', $this->_getCourseImportDefinition3('iso-8859-1'), TRUE, TRUE);
302         $this->assertEquals(3, count($result['members']), 'import failed');
303     }
304     
305     /**
306      * test internet access on/off/filtered
307      * 
308      * @todo remove some code duplication
309      */
310     public function testInternetAccess()
311     {
312         // create new course with internet access
313         $course = $this->_getCourseData();
314         $courseData = $this->_json->saveCourse($course);
315         $this->_groupsToDelete->addRecord(Tinebase_Group::getInstance()->getGroupById($courseData['group_id']));
316         $userId = $courseData['members'][0]['id'];
317         $groupMemberships = Tinebase_Group::getInstance()->getGroupMemberships($userId);
318         $this->assertTrue(in_array($this->_configGroups[Courses_Config::INTERNET_ACCESS_GROUP_ON]->getId(), $groupMemberships), $userId . ' not member of the internet group ' . print_r($groupMemberships, TRUE));
319         
320         // filtered internet access
321         $courseData['internet'] = 'FILTERED';
322         $courseData['type'] = $courseData['type']['value'];
323         $courseData = $this->_json->saveCourse($courseData);
324         $groupMemberships = Tinebase_Group::getInstance()->getGroupMemberships($userId);
325         $this->assertTrue(in_array($this->_configGroups[Courses_Config::INTERNET_ACCESS_GROUP_FILTERED]->getId(), $groupMemberships), 'not member of the filtered internet group ' . print_r($groupMemberships, TRUE));
326         $this->assertFalse(in_array($this->_configGroups[Courses_Config::INTERNET_ACCESS_GROUP_ON]->getId(), $groupMemberships), 'member of the internet group ' . print_r($groupMemberships, TRUE));
327         
328         // remove internet access
329         $courseData['internet'] = 'OFF';
330         $courseData['type'] = $courseData['type']['value'];
331         $courseData = $this->_json->saveCourse($courseData);
332         $groupMemberships = Tinebase_Group::getInstance()->getGroupMemberships($userId);
333         $this->assertFalse(in_array($this->_configGroups[Courses_Config::INTERNET_ACCESS_GROUP_ON]->getId(), $groupMemberships), 'member of the internet group ' . print_r($groupMemberships, TRUE));
334         $this->assertFalse(in_array($this->_configGroups[Courses_Config::INTERNET_ACCESS_GROUP_FILTERED]->getId(), $groupMemberships), 'member of the filtered internet group ' . print_r($groupMemberships, TRUE));
335     }
336     
337     /**
338      * testAddNewMember
339      * 
340      * @see 0006372: add new course member with a button
341      * @see 0006878: set primary group for manually added users
342      */
343     public function testAddNewMember()
344     {
345         $course = $this->_getCourseData();
346         $courseData = $this->_json->saveCourse($course);
347         $this->_groupsToDelete->addRecord(Tinebase_Group::getInstance()->getGroupById($courseData['group_id']));
348         
349         $result = $this->_json->addNewMember(array(
350             'accountFirstName' => 'jams',
351             'accountLastName'  => 'hot',
352         ), $courseData);
353         
354         $this->assertEquals(2, count($result['results']));
355         
356         $id = NULL;
357         foreach ($result['results'] as $result) {
358             if ($result['name'] === 'hot, jams') {
359                 $id = $result['id'];
360             }
361         }
362         $this->assertTrue($id !== NULL);
363         
364         $newUser = Tinebase_User::getInstance()->getFullUserById($id);
365         $this->assertEquals('hotja', $newUser->accountLoginName);
366         $this->assertEquals('/bin/false', $newUser->accountLoginShell);
367         
368         $newUserMemberships = Tinebase_Group::getInstance()->getGroupMemberships($newUser);
369         $this->assertEquals(3, count($newUserMemberships), 'new user should have 3 group memberships');
370         $this->assertTrue(in_array(Tinebase_Group::getInstance()->getDefaultGroup()->getId(), $newUserMemberships),
371             'could not find default group in memberships: ' . print_r($newUserMemberships, TRUE));
372         $this->assertTrue(in_array($this->_configGroups[Courses_Config::INTERNET_ACCESS_GROUP_ON]->getId(), $newUserMemberships),
373             $id . ' not member of the internet group ' . print_r($newUserMemberships, TRUE));
374     }
375     
376     /**
377      * testApplySambaSettings
378      * 
379      * @see 0006910: new manual users have no samba settings
380      */
381     public function testApplySambaSettings()
382     {
383         $user = Tinebase_Core::getUser();
384         $config = Courses_Config::getInstance()->samba;
385         $profilePath = $config->baseprofilepath . 'school' . '\\' . 'coursexy' . '\\';
386         $user->applyOptionsAndGeneratePassword(array('samba' => array(
387             'homePath'      => $config->basehomepath,
388             'homeDrive'     => $config->homedrive,
389             'logonScript'   => 'coursexy' . $config->logonscript_postfix_member,
390             'profilePath'   => $profilePath,
391             'pwdCanChange'  => new Tinebase_DateTime('@1'),
392             'pwdMustChange' => new Tinebase_DateTime('@1')
393         )));
394
395         // check samba settings
396         $this->assertEquals($profilePath . $user->accountLoginName, $user->sambaSAM->profilePath);
397     }
398     
399     /**
400      * testTeacherDefaultFavorite
401      * 
402      * @see 0006876: create "my course" default favorite for new teachers
403      */
404     public function testTeacherDefaultFavorite()
405     {
406         $course = $this->_getCourseData();
407         $courseData = $this->_json->saveCourse($course);
408         $this->_groupsToDelete->addRecord(Tinebase_Group::getInstance()->getGroupById($courseData['group_id']));
409         $teacher = Tinebase_User::getInstance()->getFullUserById($courseData['members'][0]['id']);
410         
411         $filter = Tinebase_PersistentFilter::getInstance()->getFilterById(
412             Tinebase_Core::getPreference('Courses')->getValueForUser(Courses_Preference::DEFAULTPERSISTENTFILTER, $teacher->getId())
413         );
414         $this->assertEquals(array(array('field' => 'name', 'operator' => 'equals', 'value' => $course['name'])), $filter->toArray());
415     }
416     
417     /************ protected helper funcs *************/
418     
419     /**
420      * get Course
421      *
422      * @return array
423      */
424     protected function _getCourseData()
425     {
426         return array(
427             'name'          => Tinebase_Record_Abstract::generateUID(),
428             'description'   => 'blabla',
429             'type'          => $this->_department->getId(),
430             'internet'      => 'ON',
431         );
432     }
433         
434     /**
435      * get paging
436      *
437      * @return array
438      */
439     protected function _getPaging()
440     {
441         return array(
442             'start' => 0,
443             'limit' => 50,
444             'sort' => 'creation_time',
445             'dir' => 'ASC',
446         );
447     }
448
449     /**
450      * get Course filter
451      *
452      * @return array
453      */
454     protected function _getCourseFilter($_courseName)
455     {
456         return array(
457             array(
458                 'field' => 'name', 
459                 'operator' => 'contains', 
460                 'value' => $_courseName
461             ),
462         );
463     }
464     
465     /**
466      * import file
467      * 
468      * @param string $_filename
469      * @param Tinebase_Model_ImportExportDefinition $_definition
470      * @param boolean $_useJsonImportFn
471      * @param boolean $removeGroupList
472      * @return array course data
473      */
474     protected function _importHelper($_filename, Tinebase_Model_ImportExportDefinition $_definition = NULL, $_useJsonImportFn = FALSE, $removeGroupList = FALSE)
475     {
476         $definition = ($_definition !== NULL) ? $_definition : $this->_getCourseImportDefinition();
477         
478         $course = $this->_getCourseData();
479         $courseData = $this->_json->saveCourse($course);
480         $this->_groupsToDelete->addRecord(Tinebase_Group::getInstance()->getGroupById($courseData['group_id']));
481         
482         if ($removeGroupList) {
483             $group = Admin_Controller_Group::getInstance()->get($courseData['group_id']);
484             Addressbook_Controller_List::getInstance()->delete($group->list_id);
485         }
486         
487         if ($_useJsonImportFn) {
488             $tempFileBackend = new Tinebase_TempFile();
489             $tempFile = $tempFileBackend->createTempFile($_filename);
490             Courses_Config::getInstance()->set(Courses_Config::STUDENTS_IMPORT_DEFINITION, $definition->name);
491             $result = $this->_json->importMembers($tempFile->getId(), $courseData['group_id'], $courseData['id']);
492             
493             $this->assertGreaterThan(0, $result['results']);
494             
495         } else {
496             $testConfig = Zend_Registry::get('testConfig');
497             $maildomain = ($testConfig->maildomain) ? $testConfig->maildomain : 'school.org';
498             
499             $importer = call_user_func($definition->plugin . '::createFromDefinition', $definition, array(
500                     'group_id'                  => $courseData['group_id'],
501                     'accountHomeDirectoryPrefix' => '//base/school/' . $courseData['name'] . '/',
502                     'accountEmailDomain'        => $maildomain,
503                     'password'                  => $courseData['name'],
504                     'samba'                     => array(
505                         'homePath'    => '//basehome/',
506                         'homeDrive'   => 'H:',
507                         'logonScript' => 'logon.bat',
508                         'profilePath' => '\\\\profile\\',
509                     )
510                 )
511             );
512             $tempFilename = TestServer::replaceEmailDomainInFile($_filename);
513             $importer->importFile($tempFilename);
514         }
515         $courseData = $this->_json->getCourse($courseData['id']);
516
517         return $courseData;
518     }
519     
520     /**
521      * returns course import definition
522      * 
523      * @return Tinebase_Model_ImportExportDefinition
524      */
525     protected function _getCourseImportDefinition()
526     {
527         try {
528             $definition = Tinebase_ImportExportDefinition::getInstance()->getByName('course_user_import_csv');
529         } catch (Tinebase_Exception_NotFound $e) {
530             $definition = Tinebase_ImportExportDefinition::getInstance()->create(new Tinebase_Model_ImportExportDefinition(array(
531                     'application_id'    => Tinebase_Application::getInstance()->getApplicationByName('Admin')->getId(),
532                     'name'              => 'course_user_import_csv',
533                     'type'              => 'import',
534                     'model'             => 'Tinebase_Model_FullUser',
535                     'plugin'            => 'Admin_Import_Csv',
536                     'plugin_options'    => '<?xml version="1.0" encoding="UTF-8"?>
537             <config>
538                 <headline>1</headline>
539                 <use_headline>0</use_headline>
540                 <dryrun>0</dryrun>
541                 <encoding>UTF-8</encoding>
542                 <delimiter>;</delimiter>
543                 <mapping>
544                     <field>
545                         <source>lastname</source>
546                         <destination>accountLastName</destination>
547                     </field>
548                     <field>
549                         <source>firstname</source>
550                         <destination>accountFirstName</destination>
551                     </field>
552                 </mapping>
553             </config>')
554             ));
555         }
556         
557         return $definition;
558     }
559     
560      /**
561      * returns course import definition
562      * 
563      * @return Tinebase_Model_ImportExportDefinition
564      */
565     protected function _getCourseImportDefinition2()
566     {
567         try {
568             $definition = Tinebase_ImportExportDefinition::getInstance()->getByName('course_user_import_csv2');
569         } catch (Tinebase_Exception_NotFound $e) {
570             $definition = Tinebase_ImportExportDefinition::getInstance()->create(new Tinebase_Model_ImportExportDefinition(array(
571                     'application_id'    => Tinebase_Application::getInstance()->getApplicationByName('Admin')->getId(),
572                     'name'              => 'course_user_import_csv2',
573                     'type'              => 'import',
574                     'model'             => 'Tinebase_Model_FullUser',
575                     'plugin'            => 'Admin_Import_Csv',
576                     'plugin_options'    => '<?xml version="1.0" encoding="UTF-8"?>
577             <config>
578                 <headline>1</headline>
579                 <use_headline>0</use_headline>
580                 <dryrun>0</dryrun>
581                 <encoding>MAC-CENTRALEUROPE</encoding>
582                 <delimiter>;</delimiter>
583                 <mapping>
584                     <field>
585                         <source>VORNAME</source>
586                         <destination>accountFirstName</destination>
587                     </field>
588                     <field>
589                         <source>NAME</source>
590                         <destination>accountLastName</destination>
591                     </field>
592                     </mapping>
593             </config>')
594             ));
595         }
596         
597         return $definition;
598     }
599     
600     /**
601      * returns course import definition
602      * 
603      * @param string $encoding
604      * @return Tinebase_Model_ImportExportDefinition
605      */
606     protected function _getCourseImportDefinition3($encoding = 'UTF-8')
607     {
608         try {
609             $definition = Tinebase_ImportExportDefinition::getInstance()->getByName('course_user_import_csv');
610         } catch (Tinebase_Exception_NotFound $e) {
611             $definition = Tinebase_ImportExportDefinition::getInstance()->create(new Tinebase_Model_ImportExportDefinition(array(
612                     'application_id'    => Tinebase_Application::getInstance()->getApplicationByName('Admin')->getId(),
613                     'name'              => 'course_user_import_csv',
614                     'type'              => 'import',
615                     'model'             => 'Tinebase_Model_FullUser',
616                     'plugin'            => 'Admin_Import_Csv',
617                     'plugin_options'    => '<?xml version="1.0" encoding="UTF-8"?>
618             <config>
619                 <headline>1</headline>
620                 <use_headline>0</use_headline>
621                 <dryrun>0</dryrun>
622                 <encoding>' . $encoding . '</encoding>
623                 <delimiter>;</delimiter>
624                 <mapping>
625                     <field>
626                         <source>Name</source>
627                         <destination>accountLastName</destination>
628                     </field>
629                     <field>
630                         <source>Vorname</source>
631                         <destination>accountFirstName</destination>
632                     </field>
633                 </mapping>
634             </config>')
635             ));
636         }
637         
638         
639         return $definition;
640     }
641 }