user_import.test 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586
  1. <?php
  2. /**
  3. * User Import module base test class.
  4. */
  5. class UserImportWebTestCase extends DrupalWebTestCase {
  6. protected $admin_user;
  7. protected $user_importer;
  8. /**
  9. * Select CSV file (the included example file)
  10. */
  11. function settingsFileSelect() {
  12. $edit = array('file_ftp' => 1);
  13. $this->drupalPost('admin/people/user_import/add', $edit, t('Next'));
  14. /* Check file was selected */
  15. $this->assertText(t('Use Different CSV File'), '[assert] File was selected');
  16. }
  17. function settingsEmailMatch(&$edit) {
  18. $edit['field_match[5][field_match]'] = 'user-email';
  19. }
  20. function settingsIgnoreFirstLine(&$edit) {
  21. $edit['first_line_skip'] = 1;
  22. }
  23. function checkAccountsExist($list_failures = FALSE) {
  24. $failures_list = '';
  25. $users_email = $this->usersList();
  26. $failed = array();
  27. foreach ($users_email as $mail) {
  28. $user = user_load_by_mail($mail);
  29. if (empty($user)) $failed[] = $mail;
  30. }
  31. if (!empty($failed) && $list_failures) {
  32. $failures_list = t('. Failed accounts: %failures', array('%failures' => implode(', ', $failed)));
  33. }
  34. $this->assertTrue(empty($failed), t('Accounts created for users imported') . $failures_list);
  35. }
  36. /**
  37. * List of users (email addresses) being imported
  38. * To Do - Generate this dynamically, bearing in mind it could be used for stress testing
  39. */
  40. function usersList() {
  41. return array(
  42. 'john@example.com',
  43. 'mandy@example.com',
  44. 'charles@example.com',
  45. 'sarah@example.com',
  46. 'sarah_smith@example.com',
  47. 'helen@example.com',
  48. 'claire@example.com',
  49. 'victoria@example.com',
  50. 'james@example.com',
  51. 'anna@example.com',
  52. 'tino@example.com',
  53. 'sofia@example.com',
  54. 'steve@example.com',
  55. 'lucy@example.com',
  56. 'angie@example.com',
  57. 'carmen@example.com',
  58. 'paul@example.com',
  59. 'jason@example.com',
  60. 'mike@example.com',
  61. 'mary@example.com',
  62. 'simon@example.com',
  63. 'kieran@example.com',
  64. 'arthur@example.com',
  65. 'gwen@example.com',
  66. 'chester@example.com',
  67. 'dorothy@example.com',
  68. 'cameron@example.com',
  69. 'trisha@example.com',
  70. 'david@example.com',
  71. 'peter@example.com',
  72. 'saul@example.com',
  73. 'noel@example.com',
  74. 'matt@example.com',
  75. 'aston@example.com',
  76. 'mille@example.com',
  77. 'ernest@example.com',
  78. );
  79. }
  80. /**
  81. * Store import ID
  82. * - set on import settings page, retrieve on later tasks
  83. */
  84. function importID($url = NULL) {
  85. static $import_id = 0;
  86. if (empty($import_id) && !empty($url)) {
  87. $args = explode('/', $url);
  88. $import_id = $args[7];
  89. }
  90. return $import_id;
  91. }
  92. /**
  93. * SimpleTest core method: code run after each and every test method.
  94. */
  95. function tearDown() {
  96. // delete accounts of users imported
  97. $users_email = $this->usersList();
  98. foreach ($users_email as $mail) {
  99. $account = user_load_by_mail($mail);
  100. if (!empty($account)) user_delete($account->uid);
  101. }
  102. // delete the import
  103. $import_id = $this->importID();
  104. $this->assertTrue(!empty($import_id), t('Import ID: !id', array('!id' => $import_id)));
  105. _user_import_settings_deletion($import_id);
  106. // Always call the tearDown() function from the parent class.
  107. parent::tearDown();
  108. }
  109. }
  110. /**
  111. * User Import module base test class.
  112. */
  113. class UserImportBasicsTestCase extends UserImportWebTestCase {
  114. public static function getInfo() {
  115. return array(
  116. 'name' => 'Import Users (Basics)',
  117. 'description' => 'Import users from a CSV file, test basic functions.',
  118. 'group' => 'User Import',
  119. );
  120. }
  121. function setUp() {
  122. parent::setUp(array('user_import'));
  123. $this->admin_user = $this->drupalCreateUser(array('administer users', 'access administration pages', 'access overlay'));
  124. $this->user_importer = $this->drupalCreateUser(array('import users'));
  125. }
  126. /**
  127. * User with right permissions creates import (with new settings)
  128. * - test core functions
  129. */
  130. function testCreateImport() {
  131. // Prepare a user to do testing
  132. $this->drupalLogin($this->user_importer);
  133. // Select CSV file (the included example file)
  134. $this->settingsFileSelect();
  135. // import settings
  136. $this->importID($this->getUrl()); // store import ID for later
  137. $setting_edit = array();
  138. $this->settingsEmailMatch($settings);
  139. $this->settingsIgnoreFirstLine($settings);
  140. $this->drupalPost($this->getUrl(), $settings, 'Import');
  141. // check if users have been imported
  142. $this->checkAccountsExist(TRUE);
  143. }
  144. }
  145. /**
  146. * Test import of user data into Profile module
  147. */
  148. //class UserImportNodeprofileTestCase extends UserImportWebTestCase {
  149. //
  150. // public static function getInfo() {
  151. // return array(
  152. // 'name' => 'Import Users (Nodeprofile)',
  153. // 'description' => 'Test import of user data into Nodeprofile module.',
  154. // 'group' => 'User Import',
  155. // );
  156. // }
  157. //
  158. // function setUp() {
  159. // parent::setUp('content', 'number', 'optionwidgets', 'text', 'link', 'date_api', 'date', 'node_import', 'content_profile', 'user_import');
  160. // $this->admin_user = $this->drupalCreateUser(array('administer users', 'administer permissions', 'access administration pages', 'administer site configuration', 'administer content types', 'administer taxonomy'));
  161. // $this->user_importer = $this->drupalCreateUser(array('import users'));
  162. // }
  163. //
  164. // /**
  165. // * User with right permissions creates import (with new settings)
  166. // * - test import of user data into Nodeprofile module
  167. // */
  168. // function testCreateImport() {
  169. // $this->drupalLogin($this->admin_user);
  170. // // $this->drupalGet('admin/build/modules');
  171. // // file_put_contents('output.html', $this->drupalGetContent());
  172. //
  173. // $this->nodeprofileConfiguration();
  174. //
  175. // // Prepare a user to do testing
  176. // $this->drupalGet('logout'); // log out first
  177. // $this->drupalLogin($this->user_importer);
  178. //
  179. // // Select CSV file (the included example file)
  180. // $this->settingsFileSelect();
  181. //
  182. // // import settings
  183. // $this->importID($this->getUrl()); // store import ID for later
  184. // $settings = array();
  185. // $this->settingsEmailMatch($settings);
  186. // $this->settingsNodeprofileMatch($settings);
  187. // $this->settingsIgnoreFirstLine($settings);
  188. // $this->drupalPost($this->getUrl(), $settings, 'Import');
  189. //
  190. // // check if users have been imported
  191. // $this->checkNodeprofileExist();
  192. //
  193. // }
  194. //
  195. // /**
  196. // * Configure modules
  197. // */
  198. // function nodeprofileConfiguration() {
  199. //
  200. // // create Identity content type
  201. // $edit = array('name' => 'Identity', 'type' => 'identity', 'title_label' => 'Title', 'body_label' => '', 'node_options[promote]' => 0, 'content_profile_use' => 1);
  202. // $this->drupalPost('admin/content/types/add', $edit, t('Save content type'));
  203. //
  204. // // create First Name field
  205. // $edit = array('_add_new_field[label]' => 'First Name', '_add_new_field[field_name]' => 'first_name', '_add_new_field[type]' => 'text', '_add_new_field[widget_type]' => 'text_textfield');
  206. // $this->drupalPost('admin/content/node-type/identity/fields', $edit, t('Save'));
  207. //
  208. // $edit = array('required' => 1);
  209. // $this->drupalPost('admin/content/node-type/identity/fields/field_first_name', $edit, t('Save field settings'));
  210. //
  211. // // create Last Name field
  212. // $edit = array('_add_new_field[label]' => 'Last Name', '_add_new_field[field_name]' => 'last_name', '_add_new_field[type]' => 'text', '_add_new_field[widget_type]' => 'text_textfield');
  213. // $this->drupalPost('admin/content/node-type/identity/fields', $edit, t('Save'));
  214. //
  215. // $edit = array('required' => 1);
  216. // $this->drupalPost('admin/content/node-type/identity/fields/field_last_name', $edit, t('Save field settings'));
  217. //
  218. // // create Biography content type
  219. // $edit = array('name' => 'Biography', 'type' => 'biography', 'title_label' => 'Title', 'body_label' => '', 'node_options[promote]' => 0, 'content_profile_use' => 1);
  220. // $this->drupalPost('admin/content/types/add', $edit, t('Save content type'));
  221. //
  222. // // create CV field
  223. // $edit = array('_add_new_field[label]' => 'CV', '_add_new_field[field_name]' => 'cv', '_add_new_field[type]' => 'text', '_add_new_field[widget_type]' => 'text_textarea');
  224. // $this->drupalPost('admin/content/node-type/biography/fields', $edit, t('Save'));
  225. //
  226. // $edit = array('required' => 1, 'rows' => 5);
  227. // $this->drupalPost('admin/content/node-type/biography/fields/field_cv', $edit, t('Save field settings'));
  228. //
  229. // // create Blog field (URL)
  230. // $edit = array('_add_new_field[label]' => 'Blog', '_add_new_field[field_name]' => 'blog', '_add_new_field[type]' => 'link', '_add_new_field[widget_type]' => 'link');
  231. // $this->drupalPost('admin/content/node-type/biography/fields', $edit, t('Save'));
  232. //
  233. // // create Birthday field (date)
  234. // $edit = array('_add_new_field[label]' => 'Birthday', '_add_new_field[field_name]' => 'birthday', '_add_new_field[type]' => 'datestamp', '_add_new_field[widget_type]' => 'date_text');
  235. // $this->drupalPost('admin/content/node-type/biography/fields', $edit, t('Save'));
  236. //
  237. // // create Interests Vocabulary
  238. // $edit = array('name' => 'Interests', 'nodes[biography]' => 'biography', 'tags' => 1);
  239. // $this->drupalPost('admin/content/taxonomy/add/vocabulary', $edit, t('Save'));
  240. //
  241. // $vocabularies = taxonomy_get_vocabularies('biography');
  242. //
  243. // foreach ($vocabularies as $vocabulary) {
  244. // $this->vocabulary_id = $vocabulary->vid;
  245. // }
  246. //
  247. // // create Contact Details contact type
  248. // $edit = array('name' => 'Contact Details', 'type' => 'contact_details', 'title_label' => 'Title', 'body_label' => '', 'node_options[promote]' => 0, 'content_profile_use' => 1);
  249. // $this->drupalPost('admin/content/types/add', $edit, t('Save content type'));
  250. //
  251. // // create Can Be Contacted field
  252. // $edit = array('_add_new_field[label]' => 'Contact', '_add_new_field[field_name]' => 'can_be_contacted', '_add_new_field[type]' => 'number_integer', '_add_new_field[widget_type]' => 'optionwidgets_onoff');
  253. // $this->drupalPost('admin/content/node-type/contact-details/fields', $edit, t('Save'));
  254. //
  255. // $edit = array('allowed_values' => "0
  256. // 1|Can be contacted");
  257. // $this->drupalPost('admin/content/node-type/contact-details/fields/field_can_be_contacted', $edit, t('Save field settings'));
  258. //
  259. // // create Contact Preference field
  260. // $edit = array('_add_new_field[label]' => 'Contact Preference', '_add_new_field[field_name]' => 'contact_preference', '_add_new_field[type]' => 'text', '_add_new_field[widget_type]' => 'optionwidgets_select');
  261. // $this->drupalPost('admin/content/node-type/contact-details/fields', $edit, t('Save'));
  262. //
  263. // $edit = array('allowed_values' => 'email|email
  264. // telephone|telephone
  265. // post|post');
  266. // $this->drupalPost('admin/content/node-type/contact-details/fields/field_contact_preference', $edit, t('Save field settings'));
  267. //
  268. // // set access perm for authenticated users to creade profile nodes
  269. // $edit = array('2[create identity content]' => 'create identity content', '2[create biography content]' => 'create biography content', '2[create contact_details content]' => 'create contact_details content');
  270. // $this->drupalPost('admin/people/permissions', $edit, t('Save permissions'));
  271. // }
  272. //
  273. //
  274. // /**
  275. // * Match CSV columns to Profile fields
  276. // */
  277. // function settingsNodeprofileMatch(&$edit) {
  278. // $edit['field_match[0][field_match]'] = 'content_profile-identity cck:field_first_name:value'; // First Name
  279. // $edit['field_match[1][field_match]'] = 'content_profile-identity cck:field_last_name:value'; // Last Name
  280. // $edit['field_match[10][field_match]'] = 'content_profile-biography cck:field_cv:value'; // CV
  281. // $edit['field_match[7][field_match]'] = 'content_profile-contact_details cck:field_can_be_contacted:value'; // Contact Permision
  282. // $edit['field_match[8][field_match]'] = 'content_profile-contact_details cck:field_contact_preference:value'; // Contact Preference
  283. //// $edit['field_match[9][field_match]'] = 'taxonomy-' . $this->vocabulary_id; // Interests
  284. // $edit['field_match[6][field_match]'] = 'content_profile-biography cck:field_blog:url'; // Blog
  285. // $edit['field_match[11][field_match]'] = 'content_profile-biography cck:field_birthday:value'; // Birthday
  286. // }
  287. //
  288. // /**
  289. // * Check data in CSV file matches data in profiles
  290. // */
  291. // function checkNodeprofileExist() {
  292. // $file_path = drupal_get_path('module', 'user_import') . '/sample.txt';
  293. // $handle = @fopen($file_path, "r");
  294. // $row = 0;
  295. //
  296. // while ($csv = fgetcsv($handle, 1000, ',')) {
  297. //
  298. // if ($row > 0) {
  299. //
  300. // $user = user_load_by_mail($csv[5]);
  301. // // test each data cell against nodeprofile field content
  302. // $identity = node_load(array('type' => 'identity', 'uid' => $user->uid), NULL, TRUE);
  303. // $this->drupalGet("node/$identity->nid");
  304. // $this->assertText(check_plain($csv[0]), "[Compare CSV and Profile data] Row: $row Field: First Name");
  305. // $this->assertText(check_plain($csv[1]), "[Compare CSV and Profile data] Row: $row Field: Last Name " . $csv[1]);
  306. //
  307. // $biography = node_load(array('type' => 'biography', 'uid' => $user->uid), NULL, TRUE);
  308. // $this->drupalGet("node/$biography->nid");
  309. // $this->assertText($csv[6], "[Compare CSV and Profile data] Row: $row Field: Blog");
  310. // $this->assertText($csv[10], "[Compare CSV and Profile data] Row: $row Field: CV");
  311. // $birthday = format_date(strtotime($csv[11]), 'custom', 'D, j/m/Y');
  312. // $this->assertText($birthday, "[Compare CSV and Profile data] Row: $row Field: Birthday " . $birthday);
  313. //
  314. //
  315. // $contact_details = node_load(array('type' => 'contact_details', 'uid' => $user->uid), NULL, TRUE);
  316. // $this->drupalGet("node/$contact_details->nid");
  317. //
  318. // if (isset($csv[7]) && !empty($csv[7])) {
  319. // $this->assertText('Can be contacted', "[Compare CSV and Profile data] Row: $row Field: Contact Permission set");
  320. // }
  321. // else {
  322. // $this->assertNoText('Can be contacted', "[Compare CSV and Profile data] Row: $row Field: Contact Permission not set");
  323. // }
  324. //
  325. // $this->assertText($csv[8], "[Compare CSV and Profile data] Row: $row Field: Contact Preference");
  326. //
  327. // //test interests link on profile page
  328. // if (!empty($user->profile_interests)) {
  329. // $interests = explode(',', $user->profile_interests);
  330. // $this->drupalGet('profile/profile_interests/' . $interests[0]);
  331. // $this->assertWantedRaw('<a title="View user profile." href="/' . url('user/' . $user->uid) . '">' . $user->name . '</a>' , '[Freeform List] User is listed on page about item in list');
  332. // }
  333. //
  334. // }
  335. //
  336. // $row++;
  337. // }
  338. //
  339. // }
  340. //
  341. // /**
  342. // * SimpleTest core method: code run after each and every test method.
  343. // */
  344. // function tearDown() {
  345. //
  346. // // delete accounts of users imported
  347. // $users_email = $this->usersList();
  348. //
  349. // foreach ($users_email as $mail) {
  350. // $account = user_load_by_mail($mail);
  351. // // delete node profile nodes
  352. // if (!empty($account)) {
  353. // $identity = node_load(array('type' => 'identity', 'uid' => $account->uid));
  354. // $biography = node_load(array('type' => 'biography', 'uid' => $account->uid));
  355. // $contact_details = node_load(array('type' => 'contact_details', 'uid' => $account->uid));
  356. // node_delete($identity->nid);
  357. // node_delete($biography->nid);
  358. // node_delete($contact_details->nid);
  359. // user_delete(array(), $account->uid);
  360. // }
  361. // }
  362. //
  363. // // delete the import
  364. // $import_id = $this->importID();
  365. // $this->assertTrue(!empty($import_id), t('Import ID: !id', array('!id' => $import_id)));
  366. // _user_import_settings_deletion($import_id);
  367. //
  368. // // delete vocabulary
  369. // taxonomy_del_vocabulary($this->vocabulary_id);
  370. //
  371. // // uninstall modules
  372. // // - tear down disable doesn't seem to do this
  373. // // foreach($this->modules as $module) {
  374. // // if (function_exists($module . '_uninstall')) {
  375. // // $result = call_user_func_array($module . '_uninstall', array());
  376. // // }
  377. // // }
  378. //
  379. // // delete nodeprofile content types
  380. // node_type_delete('dummy'); // (for some reason) the first node_type_delete is completely ignored
  381. // node_type_delete('identity');
  382. // node_type_delete('biography');
  383. // node_type_delete('contact_details');
  384. //
  385. // // Always call the tearDown() function from the parent class.
  386. // parent::tearDown();
  387. // }
  388. //}
  389. /**
  390. * Test import of user data into Profile module
  391. */
  392. //class UserImportProfileTestCase extends UserImportWebTestCase {
  393. //
  394. //
  395. // public static function getInfo() {
  396. // return array(
  397. // 'name' => 'Import Users (Profile)',
  398. // 'description' => 'Test import of user data into Profile module.',
  399. // 'group' => 'User Import',
  400. // );
  401. // }
  402. //
  403. // function setUp() {
  404. // parent::setUp('user_import', 'profile');
  405. // $this->admin_user = $this->drupalCreateUser(array('administer users', 'access administration pages', 'administer site configuration'));
  406. // $this->user_importer = $this->drupalCreateUser(array('import users'));
  407. // }
  408. //
  409. // /**
  410. // * User with right permissions creates import (with new settings)
  411. // * - test import of user data into Profile module
  412. // */
  413. // function testCreateImport() {
  414. // $this->drupalLogin($this->admin_user);
  415. // $this->profileFieldsCreate();
  416. //
  417. // // Prepare a user to do testing
  418. // $this->drupalGet('logout'); // log out first
  419. // $this->drupalLogin($this->user_importer);
  420. //
  421. // // Select CSV file (the included example file)
  422. // $this->settingsFileSelect();
  423. //
  424. // // import settings
  425. // $this->importID($this->getUrl()); // store import ID for later
  426. //
  427. // $settings = array();
  428. // $this->settingsEmailMatch($settings);
  429. // $this->settingsProfileMatch($settings);
  430. // $this->settingsIgnoreFirstLine($settings);
  431. // $this->drupalPost($this->getUrl(), $settings, 'Import');
  432. //
  433. // // check if users have been imported
  434. // $this->checkProfileExist();
  435. // }
  436. //
  437. // /**
  438. // * create profile fields
  439. // */
  440. // function profileFieldsCreate() {
  441. //
  442. // // Textfield
  443. // $edit = array('category' => 'Name', 'title' => 'First Name', 'name' => 'profile_first_name');
  444. // $this->drupalPost('admin/people/profile/add/textfield', $edit, t('Save field'));
  445. //
  446. // // Textfield
  447. // $edit = array('category' => 'Name', 'title' => 'Last Name', 'name' => 'profile_last_name');
  448. // $this->drupalPost('admin/people/profile/add/textfield', $edit, t('Save field'));
  449. //
  450. // // Textarea
  451. // $edit = array('category' => 'Biography', 'title' => 'CV', 'name' => 'profile_cv');
  452. // $this->drupalPost('admin/people/profile/add/textarea', $edit, t('Save field'));
  453. //
  454. // // Checkbox
  455. // $edit = array('category' => 'Contact Details', 'title' => 'Can Be Contacted', 'name' => 'profile_contact_permission');
  456. // $this->drupalPost('admin/people/profile/add/checkbox', $edit, t('Save field'));
  457. //
  458. // // List
  459. // $edit = array('category' => 'Contact Details', 'title' => 'Contact Preference', 'name' => 'profile_contact_preference', 'options' => 'email,telephone,post');
  460. // $this->drupalPost('admin/people/profile/add/selection', $edit, t('Save field'));
  461. //
  462. // // Freeform List
  463. // $edit = array('category' => 'Biography', 'title' => 'Interests', 'name' => 'profile_interests');
  464. // $this->drupalPost('admin/people/profile/add/list', $edit, t('Save field'));
  465. //
  466. // // URL
  467. // $edit = array('category' => 'Biography', 'title' => 'Blog', 'name' => 'profile_blog');
  468. // $this->drupalPost('admin/people/profile/add/url', $edit, t('Save field'));
  469. //
  470. // // Date
  471. // $edit = array('category' => 'Biography', 'title' => 'Birthday', 'name' => 'profile_birthday');
  472. // $this->drupalPost('admin/people/profile/add/date', $edit, t('Save field'));
  473. // }
  474. //
  475. // /**
  476. // * Match CSV columns to Profile fields
  477. // */
  478. // function settingsProfileMatch(&$edit) {
  479. // $edit['field_match[0][field_match]'] = 'profile-1'; // First Name
  480. // $edit['field_match[1][field_match]'] = 'profile-2'; // Last Name
  481. // $edit['field_match[10][field_match]'] = 'profile-3'; // CV
  482. // $edit['field_match[7][field_match]'] = 'profile-4'; // Contact Permision
  483. // $edit['field_match[8][field_match]'] = 'profile-5'; // Contact Preference
  484. // $edit['field_match[9][field_match]'] = 'profile-6'; // Interests
  485. // $edit['field_match[6][field_match]'] = 'profile-7'; // Blog
  486. // $edit['field_match[11][field_match]'] = 'profile-8'; // Birthday
  487. // }
  488. //
  489. // /**
  490. // * Check data in CSV file matches data in profiles
  491. // */
  492. // function checkProfileExist() {
  493. //
  494. // $file_path = drupal_get_path('module', 'user_import') . '/sample.txt';
  495. // $handle = @fopen($file_path, "r");
  496. // $row = 0;
  497. //
  498. // while ($csv = fgetcsv($handle, 1000, ',')) {
  499. //
  500. // if ($row > 0) {
  501. // $user = user_load_by_mail($csv[5]);
  502. // // test each data cell against Profile field content
  503. // $profile_first_name = isset($user->profile_first_name) ? $user->profile_first_name : '';
  504. // $this->assertEqual($profile_first_name, $csv[0], "[Compare CSV data to Profile data] Row: $row Field: First Name");
  505. //
  506. // $profile_last_name = isset($user->profile_last_name) ? $user->profile_last_name : '';
  507. // $this->assertEqual($profile_last_name, $csv[1], "[Compare CSV data to Profile data] Row: $row Field: Last Name");
  508. //
  509. // $profile_blog = isset($user->profile_blog) ? $user->profile_blog : '';
  510. // $this->assertEqual($profile_blog, $csv[6], "[Compare CSV data to Profile data] Row: $row Field: Blog");
  511. //
  512. // $profile_contact_permission = isset($user->profile_contact_permission) ? $user->profile_contact_permission : '';
  513. // $file_field_value = (!isset($csv[7]) || empty($csv[7])) ? 0 : 1;
  514. // $this->assertEqual($profile_contact_permission, $file_field_value, "[Compare CSV data to Profile data] Row: $row Field: Contact Permission");
  515. //
  516. // $profile_contact_preference = isset($user->profile_contact_preference) ? $user->profile_contact_preference : '';
  517. // $this->assertEqual($profile_contact_preference, $csv[8], "[Compare CSV data to Profile data] Row: $row Field: Contact Preference");
  518. //
  519. // $profile_interests = isset($user->profile_interests) ? $user->profile_interests : '';
  520. // $this->assertEqual($profile_interests, $csv[9], "[Compare CSV data to Profile data] Row: $row Field: Profile Interests");
  521. //
  522. // $profile_cv = isset($user->profile_cv) ? $user->profile_cv : '';
  523. // $this->assertEqual($profile_cv, $csv[10], "[Compare CSV data to Profile data] Row: $row Field: CV");
  524. //
  525. // $profile_birthday = isset($user->profile_birthday) ? implode('/', $user->profile_birthday) : '';
  526. //
  527. // if (isset($user->profile_birthday)) {
  528. // $profile_birthday = $user->profile_birthday['month'] . '/' . $user->profile_birthday['day'] . '/' . $user->profile_birthday['year'];
  529. // }
  530. // else {
  531. // $profile_birthday = '';
  532. // }
  533. //
  534. // $this->assertEqual($profile_birthday, $csv[11], "[Compare CSV data to Profile data] Row: $row Field: Birthday");
  535. // /**
  536. // * @todo test below fails because it gets an access denied message.
  537. // */
  538. // //test interests link on profile page
  539. // // if (!empty($user->profile_interests)) {
  540. // // $interests = explode(',', $user->profile_interests);
  541. // // $this->drupalGet('profile/profile_interests/' . $interests[0]);
  542. // // $this->assertRaw('<a title="View user profile." href="/'. url('user/'. $user->uid) .'">'. $user->name .'</a>', '[Freeform List] User is listed on page about item in list');
  543. // // }
  544. //
  545. // }
  546. //
  547. // $row++;
  548. // }
  549. // }
  550. //
  551. //}