function TMGMTEntitySourcePathAutoTestCase::testAliasCreation in Translation Management Tool 7
Tests that pathauto aliases are correctly created.
File
- sources/
entity/ tmgmt_entity.pathauto.test, line 26
Class
- TMGMTEntitySourcePathAutoTestCase
- Tests integration with pathauto.
Code
function testAliasCreation() {
$this
->setEnvironment('de');
// Create a translation job.
$job = $this
->createJob();
$job->translator = $this->default_translator->name;
$job->settings = array();
$job
->save();
// Create a node.
$node = $this
->createNode('article');
// Create a job item for this node and add it to the job.
$job
->addItem('entity', 'node', $node->nid);
// Translate the job.
$job
->requestTranslation();
// Check the translated job items.
foreach ($job
->getItems() as $item) {
$item
->acceptTranslation();
}
// Make sure that the correct url aliases were created.
$aliases = db_query('SELECT * FROM {url_alias} where source = :source', array(
':source' => 'node/' . $node->nid,
))
->fetchAllAssoc('language');
$this
->assertEqual(2, count($aliases));
$this
->assertTrue(isset($aliases['en']), 'English alias created.');
$this
->assertTrue(isset($aliases['de']), 'German alias created.');
}