- Added a test framework to Drupal along with a first batch of tests for
Drupal core! This is an important milestone for the project so enable
the module and check it out ... :)
Thanks to Rok Žlender, Károly Négyesi, Jimmy Berry, Kevin Bridges, Charlie
Gordon, Douglas Hubler, Miglius Alaburda, Andy Kirkham, Dimitri13, Kieran
Lal, Moshe Weitzman, and the many other people that helped with testing
over the past years and that drove this home.
It all works but it is still rough around the edges (i.e. documentation
is still being written, the coding style is not 100% yet, a number of
tests still fail) but we spent the entire weekend working on it in Paris
and made a ton of progress. The best way to help and to get up to speed,
is to start writing and contributing some tests ... as well as fixing
some of the failures.
For those willing to help with improving the test framework, here are
some next steps and issues to resolve:
- How to best approach unit tests and mock functions?
- How to test drupal_mail() and drupal_http_request()?
- How to improve the admin UI so we have a nice progress bar?
- How best to do code coverage?
- See http://g.d.o/node/10099 for more ...
2008-04-20 18:24:07 +00:00
|
|
|
<?php
|
|
|
|
// $Id$
|
|
|
|
|
2009-04-22 15:53:00 +00:00
|
|
|
/**
|
|
|
|
* @file
|
|
|
|
* Tests for the path module
|
|
|
|
*/
|
|
|
|
|
- Added a test framework to Drupal along with a first batch of tests for
Drupal core! This is an important milestone for the project so enable
the module and check it out ... :)
Thanks to Rok Žlender, Károly Négyesi, Jimmy Berry, Kevin Bridges, Charlie
Gordon, Douglas Hubler, Miglius Alaburda, Andy Kirkham, Dimitri13, Kieran
Lal, Moshe Weitzman, and the many other people that helped with testing
over the past years and that drove this home.
It all works but it is still rough around the edges (i.e. documentation
is still being written, the coding style is not 100% yet, a number of
tests still fail) but we spent the entire weekend working on it in Paris
and made a ton of progress. The best way to help and to get up to speed,
is to start writing and contributing some tests ... as well as fixing
some of the failures.
For those willing to help with improving the test framework, here are
some next steps and issues to resolve:
- How to best approach unit tests and mock functions?
- How to test drupal_mail() and drupal_http_request()?
- How to improve the admin UI so we have a nice progress bar?
- How best to do code coverage?
- See http://g.d.o/node/10099 for more ...
2008-04-20 18:24:07 +00:00
|
|
|
class PathTestCase extends DrupalWebTestCase {
|
2009-03-31 01:49:55 +00:00
|
|
|
public static function getInfo() {
|
- Added a test framework to Drupal along with a first batch of tests for
Drupal core! This is an important milestone for the project so enable
the module and check it out ... :)
Thanks to Rok Žlender, Károly Négyesi, Jimmy Berry, Kevin Bridges, Charlie
Gordon, Douglas Hubler, Miglius Alaburda, Andy Kirkham, Dimitri13, Kieran
Lal, Moshe Weitzman, and the many other people that helped with testing
over the past years and that drove this home.
It all works but it is still rough around the edges (i.e. documentation
is still being written, the coding style is not 100% yet, a number of
tests still fail) but we spent the entire weekend working on it in Paris
and made a ton of progress. The best way to help and to get up to speed,
is to start writing and contributing some tests ... as well as fixing
some of the failures.
For those willing to help with improving the test framework, here are
some next steps and issues to resolve:
- How to best approach unit tests and mock functions?
- How to test drupal_mail() and drupal_http_request()?
- How to improve the admin UI so we have a nice progress bar?
- How best to do code coverage?
- See http://g.d.o/node/10099 for more ...
2008-04-20 18:24:07 +00:00
|
|
|
return array(
|
2009-07-13 21:51:42 +00:00
|
|
|
'name' => 'Path alias functionality',
|
|
|
|
'description' => 'Add, edit, delete, and change alias and verify its consistency in the database.',
|
|
|
|
'group' => 'Path',
|
- Added a test framework to Drupal along with a first batch of tests for
Drupal core! This is an important milestone for the project so enable
the module and check it out ... :)
Thanks to Rok Žlender, Károly Négyesi, Jimmy Berry, Kevin Bridges, Charlie
Gordon, Douglas Hubler, Miglius Alaburda, Andy Kirkham, Dimitri13, Kieran
Lal, Moshe Weitzman, and the many other people that helped with testing
over the past years and that drove this home.
It all works but it is still rough around the edges (i.e. documentation
is still being written, the coding style is not 100% yet, a number of
tests still fail) but we spent the entire weekend working on it in Paris
and made a ton of progress. The best way to help and to get up to speed,
is to start writing and contributing some tests ... as well as fixing
some of the failures.
For those willing to help with improving the test framework, here are
some next steps and issues to resolve:
- How to best approach unit tests and mock functions?
- How to test drupal_mail() and drupal_http_request()?
- How to improve the admin UI so we have a nice progress bar?
- How best to do code coverage?
- See http://g.d.o/node/10099 for more ...
2008-04-20 18:24:07 +00:00
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
function setUp() {
|
|
|
|
parent::setUp('path');
|
2009-04-22 09:57:10 +00:00
|
|
|
|
|
|
|
// Create test user and login.
|
|
|
|
$web_user = $this->drupalCreateUser(array('create page content', 'edit own page content', 'administer url aliases', 'create url aliases'));
|
- Added a test framework to Drupal along with a first batch of tests for
Drupal core! This is an important milestone for the project so enable
the module and check it out ... :)
Thanks to Rok Žlender, Károly Négyesi, Jimmy Berry, Kevin Bridges, Charlie
Gordon, Douglas Hubler, Miglius Alaburda, Andy Kirkham, Dimitri13, Kieran
Lal, Moshe Weitzman, and the many other people that helped with testing
over the past years and that drove this home.
It all works but it is still rough around the edges (i.e. documentation
is still being written, the coding style is not 100% yet, a number of
tests still fail) but we spent the entire weekend working on it in Paris
and made a ton of progress. The best way to help and to get up to speed,
is to start writing and contributing some tests ... as well as fixing
some of the failures.
For those willing to help with improving the test framework, here are
some next steps and issues to resolve:
- How to best approach unit tests and mock functions?
- How to test drupal_mail() and drupal_http_request()?
- How to improve the admin UI so we have a nice progress bar?
- How best to do code coverage?
- See http://g.d.o/node/10099 for more ...
2008-04-20 18:24:07 +00:00
|
|
|
$this->drupalLogin($web_user);
|
|
|
|
}
|
|
|
|
|
2009-05-16 19:07:02 +00:00
|
|
|
/**
|
|
|
|
* Test the path cache.
|
|
|
|
*/
|
|
|
|
function testPathCache() {
|
|
|
|
// Create test node.
|
|
|
|
$node1 = $this->drupalCreateNode();
|
|
|
|
|
|
|
|
// Create alias.
|
|
|
|
$edit = array();
|
2009-10-15 17:53:34 +00:00
|
|
|
$edit['source'] = 'node/' . $node1->nid;
|
|
|
|
$edit['alias'] = $this->randomName(8);
|
2009-08-28 14:40:12 +00:00
|
|
|
$this->drupalPost('admin/config/search/path/add', $edit, t('Create new alias'));
|
2009-05-16 19:07:02 +00:00
|
|
|
|
|
|
|
// Visit the system path for the node and confirm a cache entry is
|
|
|
|
// created.
|
|
|
|
cache_clear_all('*', 'cache_path', TRUE);
|
2009-10-15 17:53:34 +00:00
|
|
|
$this->drupalGet($edit['source']);
|
|
|
|
$this->assertTrue(cache_get($edit['source'], 'cache_path'), t('Cache entry was created.'));
|
2009-05-16 19:07:02 +00:00
|
|
|
|
|
|
|
// Visit the alias for the node and confirm a cache entry is created.
|
|
|
|
cache_clear_all('*', 'cache_path', TRUE);
|
2009-10-15 17:53:34 +00:00
|
|
|
$this->drupalGet($edit['alias']);
|
|
|
|
$this->assertTrue(cache_get($edit['source'], 'cache_path'), t('Cache entry was created.'));
|
2009-05-16 19:07:02 +00:00
|
|
|
}
|
|
|
|
|
- Added a test framework to Drupal along with a first batch of tests for
Drupal core! This is an important milestone for the project so enable
the module and check it out ... :)
Thanks to Rok Žlender, Károly Négyesi, Jimmy Berry, Kevin Bridges, Charlie
Gordon, Douglas Hubler, Miglius Alaburda, Andy Kirkham, Dimitri13, Kieran
Lal, Moshe Weitzman, and the many other people that helped with testing
over the past years and that drove this home.
It all works but it is still rough around the edges (i.e. documentation
is still being written, the coding style is not 100% yet, a number of
tests still fail) but we spent the entire weekend working on it in Paris
and made a ton of progress. The best way to help and to get up to speed,
is to start writing and contributing some tests ... as well as fixing
some of the failures.
For those willing to help with improving the test framework, here are
some next steps and issues to resolve:
- How to best approach unit tests and mock functions?
- How to test drupal_mail() and drupal_http_request()?
- How to improve the admin UI so we have a nice progress bar?
- How best to do code coverage?
- See http://g.d.o/node/10099 for more ...
2008-04-20 18:24:07 +00:00
|
|
|
/**
|
|
|
|
* Test alias functionality through the admin interfaces.
|
|
|
|
*/
|
|
|
|
function testAdminAlias() {
|
2009-04-22 09:57:10 +00:00
|
|
|
// Create test node.
|
2009-01-09 07:44:00 +00:00
|
|
|
$node1 = $this->drupalCreateNode();
|
- Added a test framework to Drupal along with a first batch of tests for
Drupal core! This is an important milestone for the project so enable
the module and check it out ... :)
Thanks to Rok Žlender, Károly Négyesi, Jimmy Berry, Kevin Bridges, Charlie
Gordon, Douglas Hubler, Miglius Alaburda, Andy Kirkham, Dimitri13, Kieran
Lal, Moshe Weitzman, and the many other people that helped with testing
over the past years and that drove this home.
It all works but it is still rough around the edges (i.e. documentation
is still being written, the coding style is not 100% yet, a number of
tests still fail) but we spent the entire weekend working on it in Paris
and made a ton of progress. The best way to help and to get up to speed,
is to start writing and contributing some tests ... as well as fixing
some of the failures.
For those willing to help with improving the test framework, here are
some next steps and issues to resolve:
- How to best approach unit tests and mock functions?
- How to test drupal_mail() and drupal_http_request()?
- How to improve the admin UI so we have a nice progress bar?
- How best to do code coverage?
- See http://g.d.o/node/10099 for more ...
2008-04-20 18:24:07 +00:00
|
|
|
|
2008-04-25 18:26:02 +00:00
|
|
|
// Create alias.
|
- Added a test framework to Drupal along with a first batch of tests for
Drupal core! This is an important milestone for the project so enable
the module and check it out ... :)
Thanks to Rok Žlender, Károly Négyesi, Jimmy Berry, Kevin Bridges, Charlie
Gordon, Douglas Hubler, Miglius Alaburda, Andy Kirkham, Dimitri13, Kieran
Lal, Moshe Weitzman, and the many other people that helped with testing
over the past years and that drove this home.
It all works but it is still rough around the edges (i.e. documentation
is still being written, the coding style is not 100% yet, a number of
tests still fail) but we spent the entire weekend working on it in Paris
and made a ton of progress. The best way to help and to get up to speed,
is to start writing and contributing some tests ... as well as fixing
some of the failures.
For those willing to help with improving the test framework, here are
some next steps and issues to resolve:
- How to best approach unit tests and mock functions?
- How to test drupal_mail() and drupal_http_request()?
- How to improve the admin UI so we have a nice progress bar?
- How best to do code coverage?
- See http://g.d.o/node/10099 for more ...
2008-04-20 18:24:07 +00:00
|
|
|
$edit = array();
|
2009-10-15 17:53:34 +00:00
|
|
|
$edit['source'] = 'node/' . $node1->nid;
|
|
|
|
$edit['alias'] = $this->randomName(8);
|
2009-08-28 14:40:12 +00:00
|
|
|
$this->drupalPost('admin/config/search/path/add', $edit, t('Create new alias'));
|
- Added a test framework to Drupal along with a first batch of tests for
Drupal core! This is an important milestone for the project so enable
the module and check it out ... :)
Thanks to Rok Žlender, Károly Négyesi, Jimmy Berry, Kevin Bridges, Charlie
Gordon, Douglas Hubler, Miglius Alaburda, Andy Kirkham, Dimitri13, Kieran
Lal, Moshe Weitzman, and the many other people that helped with testing
over the past years and that drove this home.
It all works but it is still rough around the edges (i.e. documentation
is still being written, the coding style is not 100% yet, a number of
tests still fail) but we spent the entire weekend working on it in Paris
and made a ton of progress. The best way to help and to get up to speed,
is to start writing and contributing some tests ... as well as fixing
some of the failures.
For those willing to help with improving the test framework, here are
some next steps and issues to resolve:
- How to best approach unit tests and mock functions?
- How to test drupal_mail() and drupal_http_request()?
- How to improve the admin UI so we have a nice progress bar?
- How best to do code coverage?
- See http://g.d.o/node/10099 for more ...
2008-04-20 18:24:07 +00:00
|
|
|
|
2008-04-25 18:26:02 +00:00
|
|
|
// Confirm that the alias works.
|
2009-10-15 17:53:34 +00:00
|
|
|
$this->drupalGet($edit['alias']);
|
2009-12-02 19:26:23 +00:00
|
|
|
$this->assertText($node1->title[LANGUAGE_NONE][0]['value'], 'Alias works.');
|
2009-12-09 19:22:04 +00:00
|
|
|
$this->assertResponse(200);
|
- Added a test framework to Drupal along with a first batch of tests for
Drupal core! This is an important milestone for the project so enable
the module and check it out ... :)
Thanks to Rok Žlender, Károly Négyesi, Jimmy Berry, Kevin Bridges, Charlie
Gordon, Douglas Hubler, Miglius Alaburda, Andy Kirkham, Dimitri13, Kieran
Lal, Moshe Weitzman, and the many other people that helped with testing
over the past years and that drove this home.
It all works but it is still rough around the edges (i.e. documentation
is still being written, the coding style is not 100% yet, a number of
tests still fail) but we spent the entire weekend working on it in Paris
and made a ton of progress. The best way to help and to get up to speed,
is to start writing and contributing some tests ... as well as fixing
some of the failures.
For those willing to help with improving the test framework, here are
some next steps and issues to resolve:
- How to best approach unit tests and mock functions?
- How to test drupal_mail() and drupal_http_request()?
- How to improve the admin UI so we have a nice progress bar?
- How best to do code coverage?
- See http://g.d.o/node/10099 for more ...
2008-04-20 18:24:07 +00:00
|
|
|
|
2008-04-25 18:26:02 +00:00
|
|
|
// Change alias.
|
2009-10-15 17:53:34 +00:00
|
|
|
$pid = $this->getPID($edit['alias']);
|
- Added a test framework to Drupal along with a first batch of tests for
Drupal core! This is an important milestone for the project so enable
the module and check it out ... :)
Thanks to Rok Žlender, Károly Négyesi, Jimmy Berry, Kevin Bridges, Charlie
Gordon, Douglas Hubler, Miglius Alaburda, Andy Kirkham, Dimitri13, Kieran
Lal, Moshe Weitzman, and the many other people that helped with testing
over the past years and that drove this home.
It all works but it is still rough around the edges (i.e. documentation
is still being written, the coding style is not 100% yet, a number of
tests still fail) but we spent the entire weekend working on it in Paris
and made a ton of progress. The best way to help and to get up to speed,
is to start writing and contributing some tests ... as well as fixing
some of the failures.
For those willing to help with improving the test framework, here are
some next steps and issues to resolve:
- How to best approach unit tests and mock functions?
- How to test drupal_mail() and drupal_http_request()?
- How to improve the admin UI so we have a nice progress bar?
- How best to do code coverage?
- See http://g.d.o/node/10099 for more ...
2008-04-20 18:24:07 +00:00
|
|
|
|
2009-10-15 17:53:34 +00:00
|
|
|
$previous = $edit['alias'];
|
|
|
|
$edit['alias'] = $this->randomName(8);
|
2009-08-28 14:40:12 +00:00
|
|
|
$this->drupalPost('admin/config/search/path/edit/' . $pid, $edit, t('Update alias'));
|
- Added a test framework to Drupal along with a first batch of tests for
Drupal core! This is an important milestone for the project so enable
the module and check it out ... :)
Thanks to Rok Žlender, Károly Négyesi, Jimmy Berry, Kevin Bridges, Charlie
Gordon, Douglas Hubler, Miglius Alaburda, Andy Kirkham, Dimitri13, Kieran
Lal, Moshe Weitzman, and the many other people that helped with testing
over the past years and that drove this home.
It all works but it is still rough around the edges (i.e. documentation
is still being written, the coding style is not 100% yet, a number of
tests still fail) but we spent the entire weekend working on it in Paris
and made a ton of progress. The best way to help and to get up to speed,
is to start writing and contributing some tests ... as well as fixing
some of the failures.
For those willing to help with improving the test framework, here are
some next steps and issues to resolve:
- How to best approach unit tests and mock functions?
- How to test drupal_mail() and drupal_http_request()?
- How to improve the admin UI so we have a nice progress bar?
- How best to do code coverage?
- See http://g.d.o/node/10099 for more ...
2008-04-20 18:24:07 +00:00
|
|
|
|
2008-04-25 18:26:02 +00:00
|
|
|
// Confirm that the alias works.
|
2009-10-15 17:53:34 +00:00
|
|
|
$this->drupalGet($edit['alias']);
|
2009-12-02 19:26:23 +00:00
|
|
|
$this->assertText($node1->title[LANGUAGE_NONE][0]['value'], 'Changed alias works.');
|
2009-12-09 19:22:04 +00:00
|
|
|
$this->assertResponse(200);
|
- Added a test framework to Drupal along with a first batch of tests for
Drupal core! This is an important milestone for the project so enable
the module and check it out ... :)
Thanks to Rok Žlender, Károly Négyesi, Jimmy Berry, Kevin Bridges, Charlie
Gordon, Douglas Hubler, Miglius Alaburda, Andy Kirkham, Dimitri13, Kieran
Lal, Moshe Weitzman, and the many other people that helped with testing
over the past years and that drove this home.
It all works but it is still rough around the edges (i.e. documentation
is still being written, the coding style is not 100% yet, a number of
tests still fail) but we spent the entire weekend working on it in Paris
and made a ton of progress. The best way to help and to get up to speed,
is to start writing and contributing some tests ... as well as fixing
some of the failures.
For those willing to help with improving the test framework, here are
some next steps and issues to resolve:
- How to best approach unit tests and mock functions?
- How to test drupal_mail() and drupal_http_request()?
- How to improve the admin UI so we have a nice progress bar?
- How best to do code coverage?
- See http://g.d.o/node/10099 for more ...
2008-04-20 18:24:07 +00:00
|
|
|
|
2009-10-15 17:53:34 +00:00
|
|
|
drupal_static_reset('drupal_lookup_path');
|
2008-04-25 18:26:02 +00:00
|
|
|
// Confirm that previous alias no longer works.
|
- Added a test framework to Drupal along with a first batch of tests for
Drupal core! This is an important milestone for the project so enable
the module and check it out ... :)
Thanks to Rok Žlender, Károly Négyesi, Jimmy Berry, Kevin Bridges, Charlie
Gordon, Douglas Hubler, Miglius Alaburda, Andy Kirkham, Dimitri13, Kieran
Lal, Moshe Weitzman, and the many other people that helped with testing
over the past years and that drove this home.
It all works but it is still rough around the edges (i.e. documentation
is still being written, the coding style is not 100% yet, a number of
tests still fail) but we spent the entire weekend working on it in Paris
and made a ton of progress. The best way to help and to get up to speed,
is to start writing and contributing some tests ... as well as fixing
some of the failures.
For those willing to help with improving the test framework, here are
some next steps and issues to resolve:
- How to best approach unit tests and mock functions?
- How to test drupal_mail() and drupal_http_request()?
- How to improve the admin UI so we have a nice progress bar?
- How best to do code coverage?
- See http://g.d.o/node/10099 for more ...
2008-04-20 18:24:07 +00:00
|
|
|
$this->drupalGet($previous);
|
|
|
|
$this->assertNoText($node1->title, 'Previous alias no longer works.');
|
|
|
|
$this->assertResponse(404);
|
|
|
|
|
2008-04-25 18:26:02 +00:00
|
|
|
// Create second test node.
|
2009-01-09 07:44:00 +00:00
|
|
|
$node2 = $this->drupalCreateNode();
|
- Added a test framework to Drupal along with a first batch of tests for
Drupal core! This is an important milestone for the project so enable
the module and check it out ... :)
Thanks to Rok Žlender, Károly Négyesi, Jimmy Berry, Kevin Bridges, Charlie
Gordon, Douglas Hubler, Miglius Alaburda, Andy Kirkham, Dimitri13, Kieran
Lal, Moshe Weitzman, and the many other people that helped with testing
over the past years and that drove this home.
It all works but it is still rough around the edges (i.e. documentation
is still being written, the coding style is not 100% yet, a number of
tests still fail) but we spent the entire weekend working on it in Paris
and made a ton of progress. The best way to help and to get up to speed,
is to start writing and contributing some tests ... as well as fixing
some of the failures.
For those willing to help with improving the test framework, here are
some next steps and issues to resolve:
- How to best approach unit tests and mock functions?
- How to test drupal_mail() and drupal_http_request()?
- How to improve the admin UI so we have a nice progress bar?
- How best to do code coverage?
- See http://g.d.o/node/10099 for more ...
2008-04-20 18:24:07 +00:00
|
|
|
|
2008-04-25 18:26:02 +00:00
|
|
|
// Set alias to second test node.
|
2009-10-15 17:53:34 +00:00
|
|
|
$edit['source'] = 'node/' . $node2->nid;
|
|
|
|
// leave $edit['alias'] the same
|
2009-08-28 14:40:12 +00:00
|
|
|
$this->drupalPost('admin/config/search/path/add', $edit, t('Create new alias'));
|
- Added a test framework to Drupal along with a first batch of tests for
Drupal core! This is an important milestone for the project so enable
the module and check it out ... :)
Thanks to Rok Žlender, Károly Négyesi, Jimmy Berry, Kevin Bridges, Charlie
Gordon, Douglas Hubler, Miglius Alaburda, Andy Kirkham, Dimitri13, Kieran
Lal, Moshe Weitzman, and the many other people that helped with testing
over the past years and that drove this home.
It all works but it is still rough around the edges (i.e. documentation
is still being written, the coding style is not 100% yet, a number of
tests still fail) but we spent the entire weekend working on it in Paris
and made a ton of progress. The best way to help and to get up to speed,
is to start writing and contributing some tests ... as well as fixing
some of the failures.
For those willing to help with improving the test framework, here are
some next steps and issues to resolve:
- How to best approach unit tests and mock functions?
- How to test drupal_mail() and drupal_http_request()?
- How to improve the admin UI so we have a nice progress bar?
- How best to do code coverage?
- See http://g.d.o/node/10099 for more ...
2008-04-20 18:24:07 +00:00
|
|
|
|
2008-04-25 18:26:02 +00:00
|
|
|
// Confirm no duplicate was created.
|
2009-10-15 17:53:34 +00:00
|
|
|
$this->assertRaw(t('The alias %alias is already in use in this language.', array('%alias' => $edit['alias'])), 'Attempt to move alias was rejected.');
|
- Added a test framework to Drupal along with a first batch of tests for
Drupal core! This is an important milestone for the project so enable
the module and check it out ... :)
Thanks to Rok Žlender, Károly Négyesi, Jimmy Berry, Kevin Bridges, Charlie
Gordon, Douglas Hubler, Miglius Alaburda, Andy Kirkham, Dimitri13, Kieran
Lal, Moshe Weitzman, and the many other people that helped with testing
over the past years and that drove this home.
It all works but it is still rough around the edges (i.e. documentation
is still being written, the coding style is not 100% yet, a number of
tests still fail) but we spent the entire weekend working on it in Paris
and made a ton of progress. The best way to help and to get up to speed,
is to start writing and contributing some tests ... as well as fixing
some of the failures.
For those willing to help with improving the test framework, here are
some next steps and issues to resolve:
- How to best approach unit tests and mock functions?
- How to test drupal_mail() and drupal_http_request()?
- How to improve the admin UI so we have a nice progress bar?
- How best to do code coverage?
- See http://g.d.o/node/10099 for more ...
2008-04-20 18:24:07 +00:00
|
|
|
|
2008-04-25 18:26:02 +00:00
|
|
|
// Delete alias.
|
2009-08-28 14:40:12 +00:00
|
|
|
$this->drupalPost('admin/config/search/path/delete/' . $pid, array(), t('Confirm'));
|
- Added a test framework to Drupal along with a first batch of tests for
Drupal core! This is an important milestone for the project so enable
the module and check it out ... :)
Thanks to Rok Žlender, Károly Négyesi, Jimmy Berry, Kevin Bridges, Charlie
Gordon, Douglas Hubler, Miglius Alaburda, Andy Kirkham, Dimitri13, Kieran
Lal, Moshe Weitzman, and the many other people that helped with testing
over the past years and that drove this home.
It all works but it is still rough around the edges (i.e. documentation
is still being written, the coding style is not 100% yet, a number of
tests still fail) but we spent the entire weekend working on it in Paris
and made a ton of progress. The best way to help and to get up to speed,
is to start writing and contributing some tests ... as well as fixing
some of the failures.
For those willing to help with improving the test framework, here are
some next steps and issues to resolve:
- How to best approach unit tests and mock functions?
- How to test drupal_mail() and drupal_http_request()?
- How to improve the admin UI so we have a nice progress bar?
- How best to do code coverage?
- See http://g.d.o/node/10099 for more ...
2008-04-20 18:24:07 +00:00
|
|
|
|
2008-04-25 18:26:02 +00:00
|
|
|
// Confirm that the alias no longer works.
|
2009-10-15 17:53:34 +00:00
|
|
|
$this->drupalGet($edit['alias']);
|
- Added a test framework to Drupal along with a first batch of tests for
Drupal core! This is an important milestone for the project so enable
the module and check it out ... :)
Thanks to Rok Žlender, Károly Négyesi, Jimmy Berry, Kevin Bridges, Charlie
Gordon, Douglas Hubler, Miglius Alaburda, Andy Kirkham, Dimitri13, Kieran
Lal, Moshe Weitzman, and the many other people that helped with testing
over the past years and that drove this home.
It all works but it is still rough around the edges (i.e. documentation
is still being written, the coding style is not 100% yet, a number of
tests still fail) but we spent the entire weekend working on it in Paris
and made a ton of progress. The best way to help and to get up to speed,
is to start writing and contributing some tests ... as well as fixing
some of the failures.
For those willing to help with improving the test framework, here are
some next steps and issues to resolve:
- How to best approach unit tests and mock functions?
- How to test drupal_mail() and drupal_http_request()?
- How to improve the admin UI so we have a nice progress bar?
- How best to do code coverage?
- See http://g.d.o/node/10099 for more ...
2008-04-20 18:24:07 +00:00
|
|
|
$this->assertNoText($node1->title, 'Alias was successfully deleted.');
|
2009-12-07 06:07:19 +00:00
|
|
|
$this->assertResponse(404);
|
- Added a test framework to Drupal along with a first batch of tests for
Drupal core! This is an important milestone for the project so enable
the module and check it out ... :)
Thanks to Rok Žlender, Károly Négyesi, Jimmy Berry, Kevin Bridges, Charlie
Gordon, Douglas Hubler, Miglius Alaburda, Andy Kirkham, Dimitri13, Kieran
Lal, Moshe Weitzman, and the many other people that helped with testing
over the past years and that drove this home.
It all works but it is still rough around the edges (i.e. documentation
is still being written, the coding style is not 100% yet, a number of
tests still fail) but we spent the entire weekend working on it in Paris
and made a ton of progress. The best way to help and to get up to speed,
is to start writing and contributing some tests ... as well as fixing
some of the failures.
For those willing to help with improving the test framework, here are
some next steps and issues to resolve:
- How to best approach unit tests and mock functions?
- How to test drupal_mail() and drupal_http_request()?
- How to improve the admin UI so we have a nice progress bar?
- How best to do code coverage?
- See http://g.d.o/node/10099 for more ...
2008-04-20 18:24:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Test alias functionality through the node interfaces.
|
|
|
|
*/
|
|
|
|
function testNodeAlias() {
|
2008-04-25 18:26:02 +00:00
|
|
|
// Create test node.
|
2009-01-09 07:44:00 +00:00
|
|
|
$node1 = $this->drupalCreateNode();
|
- Added a test framework to Drupal along with a first batch of tests for
Drupal core! This is an important milestone for the project so enable
the module and check it out ... :)
Thanks to Rok Žlender, Károly Négyesi, Jimmy Berry, Kevin Bridges, Charlie
Gordon, Douglas Hubler, Miglius Alaburda, Andy Kirkham, Dimitri13, Kieran
Lal, Moshe Weitzman, and the many other people that helped with testing
over the past years and that drove this home.
It all works but it is still rough around the edges (i.e. documentation
is still being written, the coding style is not 100% yet, a number of
tests still fail) but we spent the entire weekend working on it in Paris
and made a ton of progress. The best way to help and to get up to speed,
is to start writing and contributing some tests ... as well as fixing
some of the failures.
For those willing to help with improving the test framework, here are
some next steps and issues to resolve:
- How to best approach unit tests and mock functions?
- How to test drupal_mail() and drupal_http_request()?
- How to improve the admin UI so we have a nice progress bar?
- How best to do code coverage?
- See http://g.d.o/node/10099 for more ...
2008-04-20 18:24:07 +00:00
|
|
|
|
2008-04-25 18:26:02 +00:00
|
|
|
// Create alias.
|
- Added a test framework to Drupal along with a first batch of tests for
Drupal core! This is an important milestone for the project so enable
the module and check it out ... :)
Thanks to Rok Žlender, Károly Négyesi, Jimmy Berry, Kevin Bridges, Charlie
Gordon, Douglas Hubler, Miglius Alaburda, Andy Kirkham, Dimitri13, Kieran
Lal, Moshe Weitzman, and the many other people that helped with testing
over the past years and that drove this home.
It all works but it is still rough around the edges (i.e. documentation
is still being written, the coding style is not 100% yet, a number of
tests still fail) but we spent the entire weekend working on it in Paris
and made a ton of progress. The best way to help and to get up to speed,
is to start writing and contributing some tests ... as well as fixing
some of the failures.
For those willing to help with improving the test framework, here are
some next steps and issues to resolve:
- How to best approach unit tests and mock functions?
- How to test drupal_mail() and drupal_http_request()?
- How to improve the admin UI so we have a nice progress bar?
- How best to do code coverage?
- See http://g.d.o/node/10099 for more ...
2008-04-20 18:24:07 +00:00
|
|
|
$edit = array();
|
2009-10-20 01:24:34 +00:00
|
|
|
$edit['path[alias]'] = $this->randomName(8);
|
- Added a test framework to Drupal along with a first batch of tests for
Drupal core! This is an important milestone for the project so enable
the module and check it out ... :)
Thanks to Rok Žlender, Károly Négyesi, Jimmy Berry, Kevin Bridges, Charlie
Gordon, Douglas Hubler, Miglius Alaburda, Andy Kirkham, Dimitri13, Kieran
Lal, Moshe Weitzman, and the many other people that helped with testing
over the past years and that drove this home.
It all works but it is still rough around the edges (i.e. documentation
is still being written, the coding style is not 100% yet, a number of
tests still fail) but we spent the entire weekend working on it in Paris
and made a ton of progress. The best way to help and to get up to speed,
is to start writing and contributing some tests ... as well as fixing
some of the failures.
For those willing to help with improving the test framework, here are
some next steps and issues to resolve:
- How to best approach unit tests and mock functions?
- How to test drupal_mail() and drupal_http_request()?
- How to improve the admin UI so we have a nice progress bar?
- How best to do code coverage?
- See http://g.d.o/node/10099 for more ...
2008-04-20 18:24:07 +00:00
|
|
|
$this->drupalPost('node/' . $node1->nid . '/edit', $edit, t('Save'));
|
|
|
|
|
2008-04-25 18:26:02 +00:00
|
|
|
// Confirm that the alias works.
|
2009-10-20 01:24:34 +00:00
|
|
|
$this->drupalGet($edit['path[alias]']);
|
2009-12-02 19:26:23 +00:00
|
|
|
$this->assertText($node1->title[LANGUAGE_NONE][0]['value'], 'Alias works.');
|
2009-12-09 19:22:04 +00:00
|
|
|
$this->assertResponse(200);
|
- Added a test framework to Drupal along with a first batch of tests for
Drupal core! This is an important milestone for the project so enable
the module and check it out ... :)
Thanks to Rok Žlender, Károly Négyesi, Jimmy Berry, Kevin Bridges, Charlie
Gordon, Douglas Hubler, Miglius Alaburda, Andy Kirkham, Dimitri13, Kieran
Lal, Moshe Weitzman, and the many other people that helped with testing
over the past years and that drove this home.
It all works but it is still rough around the edges (i.e. documentation
is still being written, the coding style is not 100% yet, a number of
tests still fail) but we spent the entire weekend working on it in Paris
and made a ton of progress. The best way to help and to get up to speed,
is to start writing and contributing some tests ... as well as fixing
some of the failures.
For those willing to help with improving the test framework, here are
some next steps and issues to resolve:
- How to best approach unit tests and mock functions?
- How to test drupal_mail() and drupal_http_request()?
- How to improve the admin UI so we have a nice progress bar?
- How best to do code coverage?
- See http://g.d.o/node/10099 for more ...
2008-04-20 18:24:07 +00:00
|
|
|
|
2008-04-25 18:26:02 +00:00
|
|
|
// Change alias.
|
2009-10-20 01:24:34 +00:00
|
|
|
$previous = $edit['path[alias]'];
|
|
|
|
$edit['path[alias]'] = $this->randomName(8);
|
- Added a test framework to Drupal along with a first batch of tests for
Drupal core! This is an important milestone for the project so enable
the module and check it out ... :)
Thanks to Rok Žlender, Károly Négyesi, Jimmy Berry, Kevin Bridges, Charlie
Gordon, Douglas Hubler, Miglius Alaburda, Andy Kirkham, Dimitri13, Kieran
Lal, Moshe Weitzman, and the many other people that helped with testing
over the past years and that drove this home.
It all works but it is still rough around the edges (i.e. documentation
is still being written, the coding style is not 100% yet, a number of
tests still fail) but we spent the entire weekend working on it in Paris
and made a ton of progress. The best way to help and to get up to speed,
is to start writing and contributing some tests ... as well as fixing
some of the failures.
For those willing to help with improving the test framework, here are
some next steps and issues to resolve:
- How to best approach unit tests and mock functions?
- How to test drupal_mail() and drupal_http_request()?
- How to improve the admin UI so we have a nice progress bar?
- How best to do code coverage?
- See http://g.d.o/node/10099 for more ...
2008-04-20 18:24:07 +00:00
|
|
|
$this->drupalPost('node/' . $node1->nid . '/edit', $edit, t('Save'));
|
|
|
|
|
2008-04-25 18:26:02 +00:00
|
|
|
// Confirm that the alias works.
|
2009-10-20 01:24:34 +00:00
|
|
|
$this->drupalGet($edit['path[alias]']);
|
2009-12-02 19:26:23 +00:00
|
|
|
$this->assertText($node1->title[LANGUAGE_NONE][0]['value'], 'Changed alias works.');
|
2009-12-09 19:22:04 +00:00
|
|
|
$this->assertResponse(200);
|
- Added a test framework to Drupal along with a first batch of tests for
Drupal core! This is an important milestone for the project so enable
the module and check it out ... :)
Thanks to Rok Žlender, Károly Négyesi, Jimmy Berry, Kevin Bridges, Charlie
Gordon, Douglas Hubler, Miglius Alaburda, Andy Kirkham, Dimitri13, Kieran
Lal, Moshe Weitzman, and the many other people that helped with testing
over the past years and that drove this home.
It all works but it is still rough around the edges (i.e. documentation
is still being written, the coding style is not 100% yet, a number of
tests still fail) but we spent the entire weekend working on it in Paris
and made a ton of progress. The best way to help and to get up to speed,
is to start writing and contributing some tests ... as well as fixing
some of the failures.
For those willing to help with improving the test framework, here are
some next steps and issues to resolve:
- How to best approach unit tests and mock functions?
- How to test drupal_mail() and drupal_http_request()?
- How to improve the admin UI so we have a nice progress bar?
- How best to do code coverage?
- See http://g.d.o/node/10099 for more ...
2008-04-20 18:24:07 +00:00
|
|
|
|
2008-04-25 18:26:02 +00:00
|
|
|
// Make sure that previous alias no longer works.
|
- Added a test framework to Drupal along with a first batch of tests for
Drupal core! This is an important milestone for the project so enable
the module and check it out ... :)
Thanks to Rok Žlender, Károly Négyesi, Jimmy Berry, Kevin Bridges, Charlie
Gordon, Douglas Hubler, Miglius Alaburda, Andy Kirkham, Dimitri13, Kieran
Lal, Moshe Weitzman, and the many other people that helped with testing
over the past years and that drove this home.
It all works but it is still rough around the edges (i.e. documentation
is still being written, the coding style is not 100% yet, a number of
tests still fail) but we spent the entire weekend working on it in Paris
and made a ton of progress. The best way to help and to get up to speed,
is to start writing and contributing some tests ... as well as fixing
some of the failures.
For those willing to help with improving the test framework, here are
some next steps and issues to resolve:
- How to best approach unit tests and mock functions?
- How to test drupal_mail() and drupal_http_request()?
- How to improve the admin UI so we have a nice progress bar?
- How best to do code coverage?
- See http://g.d.o/node/10099 for more ...
2008-04-20 18:24:07 +00:00
|
|
|
$this->drupalGet($previous);
|
2009-12-02 19:26:23 +00:00
|
|
|
$this->assertNoText($node1->title[LANGUAGE_NONE][0]['value'], 'Previous alias no longer works.');
|
- Added a test framework to Drupal along with a first batch of tests for
Drupal core! This is an important milestone for the project so enable
the module and check it out ... :)
Thanks to Rok Žlender, Károly Négyesi, Jimmy Berry, Kevin Bridges, Charlie
Gordon, Douglas Hubler, Miglius Alaburda, Andy Kirkham, Dimitri13, Kieran
Lal, Moshe Weitzman, and the many other people that helped with testing
over the past years and that drove this home.
It all works but it is still rough around the edges (i.e. documentation
is still being written, the coding style is not 100% yet, a number of
tests still fail) but we spent the entire weekend working on it in Paris
and made a ton of progress. The best way to help and to get up to speed,
is to start writing and contributing some tests ... as well as fixing
some of the failures.
For those willing to help with improving the test framework, here are
some next steps and issues to resolve:
- How to best approach unit tests and mock functions?
- How to test drupal_mail() and drupal_http_request()?
- How to improve the admin UI so we have a nice progress bar?
- How best to do code coverage?
- See http://g.d.o/node/10099 for more ...
2008-04-20 18:24:07 +00:00
|
|
|
$this->assertResponse(404);
|
|
|
|
|
2008-04-25 18:26:02 +00:00
|
|
|
// Create second test node.
|
2009-01-09 07:44:00 +00:00
|
|
|
$node2 = $this->drupalCreateNode();
|
- Added a test framework to Drupal along with a first batch of tests for
Drupal core! This is an important milestone for the project so enable
the module and check it out ... :)
Thanks to Rok Žlender, Károly Négyesi, Jimmy Berry, Kevin Bridges, Charlie
Gordon, Douglas Hubler, Miglius Alaburda, Andy Kirkham, Dimitri13, Kieran
Lal, Moshe Weitzman, and the many other people that helped with testing
over the past years and that drove this home.
It all works but it is still rough around the edges (i.e. documentation
is still being written, the coding style is not 100% yet, a number of
tests still fail) but we spent the entire weekend working on it in Paris
and made a ton of progress. The best way to help and to get up to speed,
is to start writing and contributing some tests ... as well as fixing
some of the failures.
For those willing to help with improving the test framework, here are
some next steps and issues to resolve:
- How to best approach unit tests and mock functions?
- How to test drupal_mail() and drupal_http_request()?
- How to improve the admin UI so we have a nice progress bar?
- How best to do code coverage?
- See http://g.d.o/node/10099 for more ...
2008-04-20 18:24:07 +00:00
|
|
|
|
2008-04-25 18:26:02 +00:00
|
|
|
// Set alias to second test node.
|
2009-10-20 01:24:34 +00:00
|
|
|
// Leave $edit['path[alias]'] the same.
|
- Added a test framework to Drupal along with a first batch of tests for
Drupal core! This is an important milestone for the project so enable
the module and check it out ... :)
Thanks to Rok Žlender, Károly Négyesi, Jimmy Berry, Kevin Bridges, Charlie
Gordon, Douglas Hubler, Miglius Alaburda, Andy Kirkham, Dimitri13, Kieran
Lal, Moshe Weitzman, and the many other people that helped with testing
over the past years and that drove this home.
It all works but it is still rough around the edges (i.e. documentation
is still being written, the coding style is not 100% yet, a number of
tests still fail) but we spent the entire weekend working on it in Paris
and made a ton of progress. The best way to help and to get up to speed,
is to start writing and contributing some tests ... as well as fixing
some of the failures.
For those willing to help with improving the test framework, here are
some next steps and issues to resolve:
- How to best approach unit tests and mock functions?
- How to test drupal_mail() and drupal_http_request()?
- How to improve the admin UI so we have a nice progress bar?
- How best to do code coverage?
- See http://g.d.o/node/10099 for more ...
2008-04-20 18:24:07 +00:00
|
|
|
$this->drupalPost('node/' . $node2->nid . '/edit', $edit, t('Save'));
|
|
|
|
|
2008-04-25 18:26:02 +00:00
|
|
|
// Confirm that the alias didn't make a duplicate.
|
2009-10-20 01:24:34 +00:00
|
|
|
$this->assertText(t('The alias is already in use.'), 'Attempt to moved alias was rejected.');
|
- Added a test framework to Drupal along with a first batch of tests for
Drupal core! This is an important milestone for the project so enable
the module and check it out ... :)
Thanks to Rok Žlender, Károly Négyesi, Jimmy Berry, Kevin Bridges, Charlie
Gordon, Douglas Hubler, Miglius Alaburda, Andy Kirkham, Dimitri13, Kieran
Lal, Moshe Weitzman, and the many other people that helped with testing
over the past years and that drove this home.
It all works but it is still rough around the edges (i.e. documentation
is still being written, the coding style is not 100% yet, a number of
tests still fail) but we spent the entire weekend working on it in Paris
and made a ton of progress. The best way to help and to get up to speed,
is to start writing and contributing some tests ... as well as fixing
some of the failures.
For those willing to help with improving the test framework, here are
some next steps and issues to resolve:
- How to best approach unit tests and mock functions?
- How to test drupal_mail() and drupal_http_request()?
- How to improve the admin UI so we have a nice progress bar?
- How best to do code coverage?
- See http://g.d.o/node/10099 for more ...
2008-04-20 18:24:07 +00:00
|
|
|
|
2008-04-25 18:26:02 +00:00
|
|
|
// Delete alias.
|
2009-10-20 01:24:34 +00:00
|
|
|
$this->drupalPost('node/' . $node1->nid . '/edit', array('path[alias]' => ''), t('Save'));
|
- Added a test framework to Drupal along with a first batch of tests for
Drupal core! This is an important milestone for the project so enable
the module and check it out ... :)
Thanks to Rok Žlender, Károly Négyesi, Jimmy Berry, Kevin Bridges, Charlie
Gordon, Douglas Hubler, Miglius Alaburda, Andy Kirkham, Dimitri13, Kieran
Lal, Moshe Weitzman, and the many other people that helped with testing
over the past years and that drove this home.
It all works but it is still rough around the edges (i.e. documentation
is still being written, the coding style is not 100% yet, a number of
tests still fail) but we spent the entire weekend working on it in Paris
and made a ton of progress. The best way to help and to get up to speed,
is to start writing and contributing some tests ... as well as fixing
some of the failures.
For those willing to help with improving the test framework, here are
some next steps and issues to resolve:
- How to best approach unit tests and mock functions?
- How to test drupal_mail() and drupal_http_request()?
- How to improve the admin UI so we have a nice progress bar?
- How best to do code coverage?
- See http://g.d.o/node/10099 for more ...
2008-04-20 18:24:07 +00:00
|
|
|
|
2008-04-25 18:26:02 +00:00
|
|
|
// Confirm that the alias no longer works.
|
2009-10-20 01:24:34 +00:00
|
|
|
$this->drupalGet($edit['path[alias]']);
|
- Added a test framework to Drupal along with a first batch of tests for
Drupal core! This is an important milestone for the project so enable
the module and check it out ... :)
Thanks to Rok Žlender, Károly Négyesi, Jimmy Berry, Kevin Bridges, Charlie
Gordon, Douglas Hubler, Miglius Alaburda, Andy Kirkham, Dimitri13, Kieran
Lal, Moshe Weitzman, and the many other people that helped with testing
over the past years and that drove this home.
It all works but it is still rough around the edges (i.e. documentation
is still being written, the coding style is not 100% yet, a number of
tests still fail) but we spent the entire weekend working on it in Paris
and made a ton of progress. The best way to help and to get up to speed,
is to start writing and contributing some tests ... as well as fixing
some of the failures.
For those willing to help with improving the test framework, here are
some next steps and issues to resolve:
- How to best approach unit tests and mock functions?
- How to test drupal_mail() and drupal_http_request()?
- How to improve the admin UI so we have a nice progress bar?
- How best to do code coverage?
- See http://g.d.o/node/10099 for more ...
2008-04-20 18:24:07 +00:00
|
|
|
$this->assertNoText($node1->title, 'Alias was successfully deleted.');
|
2009-12-07 06:07:19 +00:00
|
|
|
$this->assertResponse(404);
|
- Added a test framework to Drupal along with a first batch of tests for
Drupal core! This is an important milestone for the project so enable
the module and check it out ... :)
Thanks to Rok Žlender, Károly Négyesi, Jimmy Berry, Kevin Bridges, Charlie
Gordon, Douglas Hubler, Miglius Alaburda, Andy Kirkham, Dimitri13, Kieran
Lal, Moshe Weitzman, and the many other people that helped with testing
over the past years and that drove this home.
It all works but it is still rough around the edges (i.e. documentation
is still being written, the coding style is not 100% yet, a number of
tests still fail) but we spent the entire weekend working on it in Paris
and made a ton of progress. The best way to help and to get up to speed,
is to start writing and contributing some tests ... as well as fixing
some of the failures.
For those willing to help with improving the test framework, here are
some next steps and issues to resolve:
- How to best approach unit tests and mock functions?
- How to test drupal_mail() and drupal_http_request()?
- How to improve the admin UI so we have a nice progress bar?
- How best to do code coverage?
- See http://g.d.o/node/10099 for more ...
2008-04-20 18:24:07 +00:00
|
|
|
}
|
|
|
|
|
2009-10-15 17:53:34 +00:00
|
|
|
function getPID($alias) {
|
|
|
|
return db_query("SELECT pid FROM {url_alias} WHERE alias = :alias", array(':alias' => $alias))->fetchField();
|
- Added a test framework to Drupal along with a first batch of tests for
Drupal core! This is an important milestone for the project so enable
the module and check it out ... :)
Thanks to Rok Žlender, Károly Négyesi, Jimmy Berry, Kevin Bridges, Charlie
Gordon, Douglas Hubler, Miglius Alaburda, Andy Kirkham, Dimitri13, Kieran
Lal, Moshe Weitzman, and the many other people that helped with testing
over the past years and that drove this home.
It all works but it is still rough around the edges (i.e. documentation
is still being written, the coding style is not 100% yet, a number of
tests still fail) but we spent the entire weekend working on it in Paris
and made a ton of progress. The best way to help and to get up to speed,
is to start writing and contributing some tests ... as well as fixing
some of the failures.
For those willing to help with improving the test framework, here are
some next steps and issues to resolve:
- How to best approach unit tests and mock functions?
- How to test drupal_mail() and drupal_http_request()?
- How to improve the admin UI so we have a nice progress bar?
- How best to do code coverage?
- See http://g.d.o/node/10099 for more ...
2008-04-20 18:24:07 +00:00
|
|
|
}
|
|
|
|
}
|
2008-10-13 20:57:19 +00:00
|
|
|
|
2009-10-20 01:24:34 +00:00
|
|
|
/**
|
|
|
|
* Test URL aliases for taxonomy terms.
|
|
|
|
*/
|
|
|
|
class PathTaxonomyTermTestCase extends DrupalWebTestCase {
|
|
|
|
public static function getInfo() {
|
|
|
|
return array(
|
|
|
|
'name' => 'Taxonomy term URL aliases',
|
|
|
|
'description' => 'Tests URL aliases for taxonomy terms.',
|
|
|
|
'group' => 'Path',
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
function setUp() {
|
|
|
|
parent::setUp('path', 'taxonomy');
|
|
|
|
|
|
|
|
// Create and login user.
|
|
|
|
$web_user = $this->drupalCreateUser(array('administer url aliases', 'administer taxonomy', 'access administration pages'));
|
|
|
|
$this->drupalLogin($web_user);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Test alias functionality through the admin interfaces.
|
|
|
|
*/
|
|
|
|
function testTermAlias() {
|
|
|
|
// Create a term in the default 'Tags' vocabulary with URL alias.
|
|
|
|
$edit = array();
|
|
|
|
$edit['name'] = $this->randomName();
|
|
|
|
$edit['description'] = $this->randomName();
|
|
|
|
$edit['path[alias]'] = $this->randomName();
|
2009-11-08 11:19:02 +00:00
|
|
|
$this->drupalPost('admin/structure/taxonomy/1/add', $edit, t('Save'));
|
2009-10-20 01:24:34 +00:00
|
|
|
|
|
|
|
// Confirm that the alias works.
|
|
|
|
$this->drupalGet($edit['path[alias]']);
|
|
|
|
$this->assertText($edit['description'], 'Term can be accessed on URL alias.');
|
|
|
|
|
|
|
|
// Change the term's URL alias.
|
|
|
|
$tid = db_query("SELECT tid FROM {taxonomy_term_data} WHERE name = :name", array(':name' => $edit['name']))->fetchField();
|
|
|
|
$edit2 = array();
|
|
|
|
$edit2['path[alias]'] = $this->randomName();
|
|
|
|
$this->drupalPost('taxonomy/term/' . $tid . '/edit', $edit2, t('Save'));
|
|
|
|
|
|
|
|
// Confirm that the changed alias works.
|
|
|
|
$this->drupalGet($edit2['path[alias]']);
|
|
|
|
$this->assertText($edit['description'], 'Term can be accessed on changed URL alias.');
|
|
|
|
|
|
|
|
// Confirm that the old alias no longer works.
|
|
|
|
$this->drupalGet($edit['path[alias]']);
|
|
|
|
$this->assertNoText($edit['description'], 'Old URL alias has been removed after altering.');
|
|
|
|
$this->assertResponse(404, 'Old URL alias returns 404.');
|
|
|
|
|
|
|
|
// Remove the term's URL alias.
|
|
|
|
$edit3 = array();
|
|
|
|
$edit3['path[alias]'] = '';
|
|
|
|
$this->drupalPost('taxonomy/term/' . $tid . '/edit', $edit3, t('Save'));
|
|
|
|
|
|
|
|
// Confirm that the alias no longer works.
|
|
|
|
$this->drupalGet($edit2['path[alias]']);
|
|
|
|
$this->assertNoText($edit['description'], 'Old URL alias has been removed after altering.');
|
|
|
|
$this->assertResponse(404, 'Old URL alias returns 404.');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-10-13 20:57:19 +00:00
|
|
|
class PathLanguageTestCase extends DrupalWebTestCase {
|
2009-03-31 01:49:55 +00:00
|
|
|
public static function getInfo() {
|
2008-10-13 20:57:19 +00:00
|
|
|
return array(
|
2009-07-13 21:51:42 +00:00
|
|
|
'name' => 'Path aliases with translated nodes',
|
|
|
|
'description' => 'Confirm that paths work with translated nodes',
|
|
|
|
'group' => 'Path',
|
2008-10-13 20:57:19 +00:00
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
function setUp() {
|
|
|
|
parent::setUp('path', 'locale', 'translation');
|
|
|
|
|
|
|
|
// Create and login user.
|
2009-01-09 07:44:00 +00:00
|
|
|
$web_user = $this->drupalCreateUser(array('edit any page content', 'create page content', 'administer url aliases', 'create url aliases', 'administer languages', 'translate content', 'access administration pages'));
|
2008-10-13 20:57:19 +00:00
|
|
|
$this->drupalLogin($web_user);
|
|
|
|
|
|
|
|
// Enable French language.
|
|
|
|
$edit = array();
|
|
|
|
$edit['langcode'] = 'fr';
|
|
|
|
|
2009-08-21 14:28:52 +00:00
|
|
|
$this->drupalPost('admin/config/regional/language/add', $edit, t('Add language'));
|
2008-10-13 20:57:19 +00:00
|
|
|
|
|
|
|
// Set language negotiation to "Path prefix with fallback".
|
2009-10-09 16:33:14 +00:00
|
|
|
include_once DRUPAL_ROOT . '/includes/locale.inc';
|
|
|
|
variable_set('language_negotiation_' . LANGUAGE_TYPE_CONTENT, locale_language_negotiation_info());
|
|
|
|
variable_set('locale_language_negotiation_url_part', LOCALE_LANGUAGE_NEGOTIATION_URL_PREFIX);
|
2008-10-13 20:57:19 +00:00
|
|
|
|
|
|
|
// Force inclusion of language.inc.
|
2009-07-14 10:22:17 +00:00
|
|
|
drupal_language_initialize();
|
2008-10-13 20:57:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Test alias functionality through the admin interfaces.
|
|
|
|
*/
|
|
|
|
function testAliasTranslation() {
|
|
|
|
// Set 'page' content type to enable translation.
|
|
|
|
variable_set('language_content_type_page', 2);
|
|
|
|
|
2009-01-09 07:44:00 +00:00
|
|
|
$english_node = $this->drupalCreateNode(array('type' => 'page'));
|
|
|
|
|
|
|
|
// Edit the node to set language and path.
|
2008-10-13 20:57:19 +00:00
|
|
|
$edit = array();
|
|
|
|
$edit['language'] = 'en';
|
2009-10-20 01:24:34 +00:00
|
|
|
$edit['path[alias]'] = $this->randomName();
|
2009-01-09 07:44:00 +00:00
|
|
|
$this->drupalPost('node/' . $english_node->nid . '/edit', $edit, t('Save'));
|
2008-10-13 20:57:19 +00:00
|
|
|
|
|
|
|
// Confirm that the alias works.
|
2009-10-20 01:24:34 +00:00
|
|
|
$this->drupalGet($edit['path[alias]']);
|
2009-12-02 19:26:23 +00:00
|
|
|
$this->assertText($english_node->title[LANGUAGE_NONE][0]['value'], 'Alias works.');
|
2008-10-13 20:57:19 +00:00
|
|
|
|
|
|
|
// Translate the node into French.
|
|
|
|
$this->drupalGet('node/' . $english_node->nid . '/translate');
|
|
|
|
$this->clickLink(t('add translation'));
|
|
|
|
$edit = array();
|
2009-10-16 02:04:44 +00:00
|
|
|
$langcode = 'fr';
|
|
|
|
$edit["body[$langcode][0][value]"] = $this->randomName();
|
2009-12-02 19:26:23 +00:00
|
|
|
$langcode = LANGUAGE_NONE;
|
2009-10-11 03:07:21 +00:00
|
|
|
$edit["title[$langcode][0][value]"] = $this->randomName();
|
2009-10-20 01:24:34 +00:00
|
|
|
$edit['path[alias]'] = $this->randomName();
|
2008-10-13 20:57:19 +00:00
|
|
|
$this->drupalPost(NULL, $edit, t('Save'));
|
|
|
|
|
|
|
|
// Clear the path lookup cache.
|
|
|
|
drupal_lookup_path('wipe');
|
|
|
|
|
|
|
|
// Ensure the node was created.
|
2009-10-11 03:07:21 +00:00
|
|
|
$french_node = $this->drupalGetNodeByTitle($edit["title[$langcode][0][value]"]);
|
2008-10-13 20:57:19 +00:00
|
|
|
$this->assertTrue(($french_node), 'Node found in database.');
|
|
|
|
|
|
|
|
// Confirm that the alias works.
|
2009-10-20 01:24:34 +00:00
|
|
|
$this->drupalGet('fr/' . $edit['path[alias]']);
|
2009-12-02 19:26:23 +00:00
|
|
|
$this->assertText($french_node->title[LANGUAGE_NONE][0]['value'], 'Alias for French translation works.');
|
2008-10-13 20:57:19 +00:00
|
|
|
|
|
|
|
// Confirm that the alias is returned by url().
|
2009-10-16 02:04:44 +00:00
|
|
|
drupal_static_reset('language_list');
|
2008-10-13 20:57:19 +00:00
|
|
|
$languages = language_list();
|
|
|
|
$url = url('node/' . $french_node->nid, array('language' => $languages[$french_node->language]));
|
2009-10-20 01:24:34 +00:00
|
|
|
$this->assertTrue(strpos($url, $edit['path[alias]']), t('URL contains the path alias.'));
|
2008-10-13 20:57:19 +00:00
|
|
|
}
|
|
|
|
}
|