tmgmt_entity.pathauto.test in Translation Management Tool 7
File
sources/entity/tmgmt_entity.pathauto.test
View source
<?php
class TMGMTEntitySourcePathAutoTestCase extends TMGMTEntityTestCaseUtility {
static function getInfo() {
return array(
'name' => 'Entity Source Pathauto tests',
'description' => 'Verifies that the correct aliases are generated for entity transations',
'group' => 'Translation Management',
'dependencies' => array(
'entity_translation',
'pathauto',
),
);
}
function setUp() {
parent::setUp(array(
'tmgmt_entity',
'entity_translation',
'pathauto',
));
$this
->loginAsAdmin();
$this
->createNodeType('article', 'Article', ENTITY_TRANSLATION_ENABLED);
}
function testAliasCreation() {
$this
->setEnvironment('de');
$job = $this
->createJob();
$job->translator = $this->default_translator->name;
$job->settings = array();
$job
->save();
$node = $this
->createNode('article');
$job
->addItem('entity', 'node', $node->nid);
$job
->requestTranslation();
foreach ($job
->getItems() as $item) {
$item
->acceptTranslation();
}
$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.');
}
}