[drupal-devel] [SimpleTest] The Idea of new test working on WWW Layer
Hi, I would like to write below how I imagine a test, which acts like browser and checks accessibility of the contents. I've succesfully logged in Drupal, using SimpleTest class, so now I put my ideas and go to code. :-) We don't have access to the users existing in database, so we have to create 3 new test's users who will be deleted after finishing the test. 1. Creating users (3 steps) * insert in table {permission} 3 new perm. ( '', 'access content', 'access content, create stories, edit own stories' ) [ I'm working on story module :-) ] * insert in table {role} new roles (is this step is necessary? ) * insert in table {user} 3 new users * insert data in table {users_roles} to make a connection between users and roles. 2. Creating node (for example with uid = 1) I perform this because I will need this to check access of editing not own node. For each created user I will do : 3. Log into Drupal and check on access to: * content page * editing form * submit data for create node * submit data for editing node * submit data for deleting node and I will check access when node->uid != user->uid * editing form * submit data for editing node * submit data for deleting node -------- 4. Delete node 5. Delete users So, do you think that any additional tests need to be added ? Or Is my way of testing right? Regards, Kuba Zygmunt
Hi Kuba. Yes, I like this test. I would like to simulate an actual user registration, instead of directly entering records into tables. Also, uid=1 has special permissions so we should not test with that. Kuba Zygmunt wrote:
Hi,
I would like to write below how I imagine a test, which acts like browser and checks accessibility of the contents. I've succesfully logged in Drupal, using SimpleTest class, so now I put my ideas and go to code. :-)
We don't have access to the users existing in database, so we have to create 3 new test's users who will be deleted after finishing the test.
1. Creating users (3 steps) * insert in table {permission} 3 new perm. ( '', 'access content', 'access content, create stories, edit own stories' ) [ I'm working on story module :-) ] * insert in table {role} new roles (is this step is necessary? ) * insert in table {user} 3 new users * insert data in table {users_roles} to make a connection between users and roles.
2. Creating node (for example with uid = 1) I perform this because I will need this to check access of editing not own node.
For each created user I will do :
3. Log into Drupal and check on access to: * content page * editing form
* submit data for create node * submit data for editing node * submit data for deleting node
and I will check access when node->uid != user->uid * editing form * submit data for editing node * submit data for deleting node
--------
4. Delete node 5. Delete users
So, do you think that any additional tests need to be added ? Or Is my way of testing right?
Regards, Kuba Zygmunt
participants (2)
-
Kuba Zygmunt -
Moshe Weitzman