This patch adds test for variable_get, variable_set and variable_del to the bootstrap tests. Any comments/additions appreciated.
| Comment | File | Size | Author |
|---|---|---|---|
| #7 | variabletest.patch | 2.42 KB | robloach |
| #6 | variabletest.patch | 2.69 KB | beeradb |
| #4 | variabletest.patch | 1.7 KB | beeradb |
| #2 | variabletest.patch | 1.75 KB | beeradb |
| variabletest.patch | 1.7 KB | robloach |
Comments
Comment #1
boombatower commentedComment #2
beeradb commentedTests passed and the code looks sane.
I went ahead and added periods to the comments as per coding standards. Marking RTBC.
Comment #3
damien tournoud commentedThere is
DrupalWebTestCase::assertEqualandDrupalWebTestCase::assertIdenticalfor asserting equality. Also, you can useDrupalWebTestCase::randomNameto generate random patterns.Also I'm not sure if we want to hit the database directly. I'll rather see an new menu callback created in the system_test mockup module for this (ie. modules/simpletests/tests/system_test.module).
Comment #4
beeradb commentedI went ahead and implimented Damiens suggestions RE: Random string generation and asserts. I didn't touch the additional menu item stuff, as I'm not sure I track what he's asking for there.
Comment #5
damien tournoud commentedThere is two things to test here:
* Does the variable storage works locally: ie. if I call variable_set, and then variable_get, do I get the stored value? if I call variable_del and then variable_get, does the value is invalidated?
* Does the variable storage works across requests: ie. if I call variable_set, does an other request that later calls variable_get will get the stored value?
To test the later, I suggest to implement a menu callback in system_test.module that does:
echo variable_get('simpletest_bootstrap_variable_test'); return;, and use adrupalGet()to hit that page and check the returned value.Comment #6
beeradb commentedHere we go. I implemented the suggested changes regarding a menu item in system_test.module. Because of this I've gone ahead and removed the direct database query - my thinking is that if the value is persisting across requests we can safely assume it's being stored correctly in the database.
Marking CNR..
Comment #7
robloachVery nicely done, I removed the
system_test_variable_getfunction and stuck the call directly in the menu hook:This was the only change I made, and tests all pass. RTBC in my eyes, but another review would be good.
Comment #8
damien tournoud commentedThe patch looks good, thanks beeradb.
Comment #9
dries commentedCommitted to CVS HEAD. Thanks.
Comment #10
beeradb commentedRob built the house, I just did a little finishing work :)
Comment #11
Anonymous (not verified) commentedAutomatically closed -- issue fixed for two weeks with no activity.