I am attempting to write simpletests to replicate the steps to reproduce on this d.o issue.
I need to create a test node with a custom alias, as if I had unchecked the "Generate automatic URL alias" checkbox and supplied my own value.
Currently, attempting to insert it with
$edit = array( 'title' => $this->randomName(), 'path' => array( 'source' => 'node/1', 'alias' => 'qwerty', ), );
fails, and generates errors, as does
$edit = array( 'title' => 'asdf', 'path[alias]' => 'qwerty', );
So, I tried:
$path = array('source' => 'node/1', 'alias' => 'qwerty'); path_save($path);
The above successfully creates an alias, but when I inspect
alias'] it shows me something other than
drupal_lookup_path('alias', "node/".$node->nid) also returns only the Pathauto-generated alias, and not any alias that was created manually, even in the node edit form.
Additionally, if I create a new alias from the same source, my original alias is not replaced, as it would be if I had manually entered a new alias into the field on the node edit form.
As I am attempting to exactly duplicate the steps to reproduce in the linked d.o issue, it matters how the alias gets created. Is there any way to more exactly replicate the manual creation of an alias on the node edit form, inside a test?