function ShurlyTestCase::testHashEditedUrl in ShURLy 7
Test that, when editing a destination URL, the hash is updated accordingly.
File
- ./
shurly.test, line 54 - Tests for the Shurly module.
Class
- ShurlyTestCase
- Shurly tests.
Code
function testHashEditedUrl() {
// Sign in.
$user = $this
->drupalCreateUser(array(
'Create short URLs',
'Edit own URLs',
'View own URL stats',
));
$this
->drupalLogin($user);
// Shrink http://foo.net and verify we have 1 shrinked URL in {shurly}.
$this
->drupalGet('shurly');
$edit = array(
'long_url' => 'http://foo.net',
);
$this
->drupalPost(NULL, $edit, t('Shrink it!'));
$this
->assertEqual($this
->getNbUrlsShrinked(), 1);
// Edit the destination URL to http://bar.net.
$this
->drupalGet('myurls');
$this
->clickLink('edit');
$this
->assertFieldByName('destination', 'http://foo.net');
$edit = array(
'destination' => 'http://bar.net',
);
$this
->drupalPost(NULL, $edit, t('Submit'));
$this
->assertText(t('Are you sure you want to continue editing this short URL?'));
$this
->drupalPost(NULL, array(), t('Proceed'));
// Shrink http://foo.net and verify we now have 2 shrinked URLs in {shurly}: one for http://bar.net and one for http://foo.net.
$this
->drupalGet('shurly');
$edit = array(
'long_url' => 'http://foo.net',
);
$this
->drupalPost(NULL, $edit, t('Shrink it!'));
$this
->assertEqual($this
->getNbUrlsShrinked(), 2);
}