-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Toolbar Pattern + Test #19
Comments
The Toolbar module manages the black bar on top of the site which contains link to the important sections of the website (e.g. People, Configuration, Patterns, etc.). It also manages another bar for shortcuts that users can add. Now the top links are automatically added depending on the path which is given inside each module. The shortcuts can be set through the form reachable if you click on the top right link 'Edit shortcuts'. For me that is available at the url: http://localhost/drupal-7.8/admin/config/user-interface/shortcut/shortcut-set-1 Write a pattern that set the permission for the toolbar, e.g. who can see it (which roles?) and enable the shortcuts. |
I have thought about this test for some time, but I haven't got the point of "set the permission for the toolbar". Opinion2: I look at the page "localhost/~ray/drupal78/admin/people/permissions" (on my PC), the permission "access toolbar" named "Use the administration toolbar" is on the list. the last question: besides of the yaml file, do I need to write the toolbar.inc file like "Patterns/components/block.inc"? |
Hi, I didn't mention explicitly on my previous post, but
As for point 3. I believe that @csko may have already written the component for setting the permissions, but I am not sure whether it was ported to the new version of pattern. Please ask him, in the chat or by mailing list. |
thanks, ste. |
Hi I looked the shortcut module's code, I think a independent components/patterns.shortcut.inc should be better, now the pattern.shortcut.inc can do two things: add shortcut set and rename a shortcut set( there are two shortcut**.yaml in pattern dir), this two works fine. I will add the other test to shortcut later. |
Hi, I've commented on your commit 9ec4582. You can see my comments between the lines of your code. |
@shakty, @xrfind I'm not sure how to integrate this into an other component, but I'm pretty sure replicating it (as in patterns.toolbar.inc right now) is not right. |
thanks for the job! Some remarks: 1- I don't find the test. That should be under the patterns/tests/ directory. Thanks a lot, I see you did a lot of work! |
3 - Isn't that beacuse the roles are commented out in the yaml file? Why is that? |
for @shakty 1: for @shakty 2&2.b: for @shakty 3: for @shakty 4: |
for @csko 3: for @csko 4: |
@xrfind 1. You are supposed to write classes which are run by the SimpleTest module. See the examples in tests/ directory, the Patterns7 wiki page in our internal wiki, and the links below. http://drupal.org/simpletest-tutorial-drupal7 |
@csko |
@xrfind, I still have some problems. First I don't understand completely why it looks so complicated to add a link to the toolbar (but I have no deep knowledge of the toolbar module). My questions here are: what exactly is a shortcut_set and why do I need to switch users ? I tried to follow your instructions but I got this error for pattern switch shortcut set for users (modify): An AJAX HTTP error occurred. HTTP Result Code: 500 Debugging information follows. Path: /drupal-7.9/batch?id=38&op=do StatusText: Service unavailable (with message) ResponseText: PDOException: SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'uid' cannot be null: INSERT INTO {shortcut_set_users} (uid, set_name) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1); Array ( [:db_insert_placeholder_0] => [:db_insert_placeholder_1] => shortcut-set-3 ) in shortcut_set_assign_user() (line 445 of /var/www/drupal-7.9/modules/shortcut/shortcut.module). Anybody has this problem? I think writing the test will help |
Hi,@msssm, "switch users" can be thought as "a user chooses another shortcut_set". I run the "switch shortcut set for users(modify)" just now, it's ok. Thanks for your test! |
Ok, thanks, I got it. That error happens when switch shortcut set for users (modify) is run with the name of a non-existing user. Please make sure to raise an error, and stop the process before. This should be done in the validate hook. Write a test for that as well. There are still some chinese-like names in the yaml files. Could you substitute them all? |
toolbar's test is done. the features:
How to deal with problems of this kind? |
LINKS: I think $this->std_user->name should give you the name of the user for that test. Or you could write some extra code. Something like the following: --code-- $account = user_save(drupal_anonymous_user(), $edit); --code-- Then you can login that user and doing the test. |
the ---- in simple test has been deleted. |
No description provided.
The text was updated successfully, but these errors were encountered: