- 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$
|
|
|
|
|
|
|
|
class PathTestCase extends DrupalWebTestCase {
|
|
|
|
function getInfo() {
|
|
|
|
return array(
|
|
|
|
'name' => t('Path alias functionality'),
|
|
|
|
'description' => t('Add, edit, delete, and change alias and verify its consistency in the database.'),
|
|
|
|
'group' => t('Path'),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Create user, setup permissions, log user in, and create a node.
|
|
|
|
*/
|
|
|
|
function setUp() {
|
|
|
|
parent::setUp('path');
|
|
|
|
// 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'));
|
- 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);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Test alias functionality through the admin interfaces.
|
|
|
|
*/
|
|
|
|
function testAdminAlias() {
|
|
|
|
// 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();
|
|
|
|
$edit['src'] = 'node/' . $node1->nid;
|
|
|
|
$edit['dst'] = $this->randomName(8);
|
|
|
|
$this->drupalPost('admin/build/path/add', $edit, t('Create new alias'));
|
|
|
|
|
2008-04-25 18:26:02 +00:00
|
|
|
// Confirm that the alias 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($edit['dst']);
|
|
|
|
$this->assertText($node1->title, 'Alias works.');
|
|
|
|
|
2008-04-25 18:26:02 +00:00
|
|
|
// Change 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
|
|
|
$pid = $this->getPID($edit['dst']);
|
|
|
|
|
|
|
|
$previous = $edit['dst'];
|
|
|
|
$edit['dst'] = $this->randomName(8);
|
|
|
|
$this->drupalPost('admin/build/path/edit/' . $pid, $edit, t('Update alias'));
|
|
|
|
|
2008-04-25 18:26:02 +00:00
|
|
|
// Confirm that the alias 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($edit['dst']);
|
|
|
|
$this->assertText($node1->title, 'Changed alias works.');
|
|
|
|
|
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.
|
- 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['src'] = 'node/' . $node2->nid;
|
|
|
|
// leave $edit['dst'] the same
|
|
|
|
$this->drupalPost('admin/build/path/add', $edit, t('Create new alias'));
|
|
|
|
|
2008-04-25 18:26:02 +00:00
|
|
|
// Confirm no duplicate was created.
|
- 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->assertRaw(t('The alias %alias is already in use in this language.', array('%alias' => $edit['dst'])), 'Attempt to move alias was rejected.');
|
|
|
|
|
2008-04-25 18:26:02 +00:00
|
|
|
// Delete 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->drupalPost('admin/build/path/delete/' . $pid, array(), t('Confirm'));
|
|
|
|
|
2008-04-25 18:26:02 +00:00
|
|
|
// Confirm that the 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($edit['dst']);
|
|
|
|
$this->assertNoText($node1->title, 'Alias was successfully deleted.');
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 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();
|
|
|
|
$edit['path'] = $this->randomName(8);
|
|
|
|
$this->drupalPost('node/' . $node1->nid . '/edit', $edit, t('Save'));
|
|
|
|
|
2008-04-25 18:26:02 +00:00
|
|
|
// Confirm that the alias 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($edit['path']);
|
|
|
|
$this->assertText($node1->title, 'Alias works.');
|
|
|
|
|
2008-04-25 18:26:02 +00:00
|
|
|
// Change 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
|
|
|
$previous = $edit['path'];
|
|
|
|
$edit['path'] = $this->randomName(8);
|
|
|
|
$this->drupalPost('node/' . $node1->nid . '/edit', $edit, t('Save'));
|
|
|
|
|
2008-04-25 18:26:02 +00:00
|
|
|
// Confirm that the alias 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($edit['path']);
|
|
|
|
$this->assertText($node1->title, 'Changed alias works.');
|
|
|
|
|
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);
|
|
|
|
$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.
|
|
|
|
// Leave $edit['path'] 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.
|
- 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->assertText(t('The path is already in use.'), 'Attempt to moved alias was rejected.');
|
|
|
|
|
2008-04-25 18:26:02 +00:00
|
|
|
// Delete 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->drupalPost('node/' . $node1->nid . '/edit', array('path' => ''), t('Save'));
|
|
|
|
|
2008-04-25 18:26:02 +00:00
|
|
|
// Confirm that the 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($edit['path']);
|
|
|
|
$this->assertNoText($node1->title, 'Alias was successfully deleted.');
|
|
|
|
}
|
|
|
|
|
|
|
|
function getPID($dst) {
|
|
|
|
return db_result(db_query("SELECT pid FROM {url_alias} WHERE dst = '%s'", $dst));
|
|
|
|
}
|
|
|
|
}
|
2008-10-13 20:57:19 +00:00
|
|
|
|
|
|
|
class PathLanguageTestCase extends DrupalWebTestCase {
|
|
|
|
function getInfo() {
|
|
|
|
return array(
|
|
|
|
'name' => t('Path aliases with translated nodes'),
|
|
|
|
'description' => t('Confirm that paths work with translated nodes'),
|
|
|
|
'group' => t('Path'),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Create user, setup permissions, log user in, and create a node.
|
|
|
|
*/
|
|
|
|
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';
|
|
|
|
|
|
|
|
$this->drupalPost('admin/settings/language/add', $edit, t('Add language'));
|
|
|
|
|
|
|
|
// Set language negotiation to "Path prefix with fallback".
|
|
|
|
variable_set('language_negotiation', LANGUAGE_NEGOTIATION_PATH);
|
|
|
|
|
|
|
|
// Force inclusion of language.inc.
|
|
|
|
drupal_init_language();
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 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';
|
|
|
|
$edit['path'] = $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.
|
|
|
|
$this->drupalGet($edit['path']);
|
|
|
|
$this->assertText($english_node->title, 'Alias works.');
|
|
|
|
|
|
|
|
// Translate the node into French.
|
|
|
|
$this->drupalGet('node/' . $english_node->nid . '/translate');
|
|
|
|
$this->clickLink(t('add translation'));
|
|
|
|
$edit = array();
|
|
|
|
$edit['title'] = $this->randomName();
|
|
|
|
$edit['body'] = $this->randomName();
|
|
|
|
$edit['path'] = $this->randomName();
|
|
|
|
$this->drupalPost(NULL, $edit, t('Save'));
|
|
|
|
|
|
|
|
// Clear the path lookup cache.
|
|
|
|
drupal_lookup_path('wipe');
|
|
|
|
|
|
|
|
// Ensure the node was created.
|
|
|
|
// Check to make sure the node was created.
|
2008-12-05 22:18:46 +00:00
|
|
|
$french_node = $this->drupalGetNodeByTitle($edit['title']);
|
2008-10-13 20:57:19 +00:00
|
|
|
$this->assertTrue(($french_node), 'Node found in database.');
|
|
|
|
|
|
|
|
// Confirm that the alias works.
|
|
|
|
$this->drupalGet('fr/' . $edit['path']);
|
|
|
|
$this->assertText($french_node->title, 'Alias for French translation works.');
|
|
|
|
|
|
|
|
// Confirm that the alias is returned by url().
|
|
|
|
$languages = language_list();
|
|
|
|
$url = url('node/' . $french_node->nid, array('language' => $languages[$french_node->language]));
|
|
|
|
$this->assertTrue(strpos($url, $edit['path']), t('URL contains the path alias.'));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|