pathauto.test 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. <?php
  2. /**
  3. * Test pathauto migration.
  4. */
  5. class MigrateExtrasPathautoUnitTest extends DrupalWebTestCase {
  6. public static function getInfo() {
  7. return array(
  8. 'name' => 'Pathauto migration',
  9. 'description' => 'Test disabling of pathauto during migration',
  10. 'group' => 'Migrate',
  11. );
  12. }
  13. function setUp() {
  14. parent::setUp('migrate', 'migrate_extras', 'features', 'token', 'path',
  15. 'pathauto', 'migrate_extras_pathauto');
  16. }
  17. /**
  18. * Verify that setting 'pathauto' to FALSE when migrating actually prevents
  19. * pathauto from creating an alias.
  20. */
  21. function testPathautoImport() {
  22. $migration = Migration::getInstance('MigrateExamplePathauto');
  23. $result = $migration->processImport();
  24. $this->assertEqual($result, Migration::RESULT_COMPLETED,
  25. t('Import returned RESULT_COMPLETED'));
  26. $rawnodes = node_load_multiple(FALSE, array('type' => 'migrate_example_pathauto'), TRUE);
  27. $this->assertEqual(count($rawnodes), 2, t('Two sample nodes created'));
  28. $count = db_select('url_alias', 'ua')
  29. ->fields('ua', array('source'))
  30. ->countQuery()
  31. ->execute()
  32. ->fetchField();
  33. $this->assertEqual($count, 0, t('No aliases generated'));
  34. }
  35. }