1 path_pattern.test PathPatternUnitTestCase::testNoTokensNoAlias()

Test that path_save_automatic_alias() will not create a URL alias for a pattern that does not get any tokens replaced.


core/modules/path/tests/path_pattern.test, line 323
Functionality tests for automatic path generation.


Unit tests for Path pattern functions.


function testNoTokensNoAlias() {
  $node = $this->backdropCreateNode(array('title' => ''));
  $this->assertNoEntityAliasExists('node', $node);

  // On subsequent saves, the $node->path property is now populated indicating
  // this node does not have an automatic alias, so re-saving the node should
  // not give it one.
  $node->title = 'hello';
  $this->assertNoEntityAliasExists('node', $node);

  // Manually setting the auto flag and saving should create an alias.
  $node->path['auto'] = TRUE;
  $this->assertEntityAlias('node', $node, 'hello');