Skip to content

Instantly share code, notes, and snippets.

@opdavies
Last active November 23, 2018 12:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save opdavies/eb262d54f6075085d83b0fdb67185070 to your computer and use it in GitHub Desktop.
Save opdavies/eb262d54f6075085d83b0fdb67185070 to your computer and use it in GitHub Desktop.
<?php
/**
* Tests Simple Smartling's path functionality.
*/
class SimpleSmartlingPathTest extends DrupalWebTestCase {
/**
* Implements getInfo().
*/
public function getInfo() {
return array(
'name' => 'Simple Smartling path tests',
'description' => '',
'group' => 'Simple Smartling',
);
}
/**
* {@inheritdoc}
*/
protected function setUp() {
parent::setUp(array('simple_smartling'));
}
public function testAliasedPath() {
$account = $this->drupalCreateUser(array('administer simple smartling'));
$this->drupalLogin($account);
$edit = array('simple_smartling_no_translate_path' => 'foo');
$this->drupalPost(SIMPLE_SMARTLING_ADMIN_SETTINGS_PATH, $edit, 'Save configuration');
$settings = array('path' => array('alias' => 'foo'));
$this->drupalCreateNode($settings);
$this->drupalGet('node/1');
$paths = variable_get('simple_smartling_no_translate_path', array());
var_dump(array(
$_GET['q'],
'current path' => current_path(),
'alias' => drupal_get_path_alias(),
'paths' => $paths,
'match' => drupal_match_path(drupal_get_path_alias(), $paths),
));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment