This information is from the code coverage report (see http://coverage.cwgordon.com/coverage).
We need to test:
1) _db_create_field_sql() with precision and scale.
2) db_rename_table().
3) db_add_field().
4) db_drop_field().
5) db_field_set_default().
6) db_field_set_no_default().
7) db_add_primary_key().
8) db_drop_primary_key().
9) db_add_unique_key().
10) db_drop_unique_key().
11) db_add_index().
12) db_drop_index().
13) db_change_field().
14) Unsupported database versions.
15) 'dev_query' database option.
16) db_query_temporary()
17) db_lock_table()
18) db_unlock_tables()
19) db_column_exists()
20) db_distinct_field()
| Comment | File | Size | Author |
|---|---|---|---|
| #17 | testInsertFieldOnlyDefinition.patch | 1.78 KB | mustafau |
| #18 | dbnotice.patch | 880 bytes | Crell |
| #14 | database_tests.patch | 59.16 KB | Crell |
| #10 | database_tests.patch | 53.61 KB | Crell |
| #9 | database_tests-276276-9.patch | 52.94 KB | floretan |
Comments
Comment #1
catchSince http://drupal.org/node/225450 comes with tests, we should postpone this pending the outcome of that issue (although let's hope there's only one possible outcome). Might as well test code that's not disappearing imminently.
Comment #2
Crell commentedI'm stealing this issue to submit the tests that were written for the new DB layer. This covers all tests written to date. We certainly can add more, but let's start with these. :-)
Comment #3
catchI had a very, very quick read through and nothing bad jumped out, and ran all tests (they pass). Are these what used to be with dbtest.module? In that case, they've probably been reviewed a few times before anyway, but leaving this open in case someone's got time to take a closer look.
Comment #4
floretan commentedThe patch looks good functionally, but some clean-up is required:
- Indentation is off in a few places.
- Some comments contain development messages (like
"// Barry, what's going on here? :-) --LG")- Empty setUp() declarations are not necessary.
Comment #5
Anonymous (not verified) commented@flobruit: You should have changed the Status to CNW.
Comment #6
dmitrig01 commentedYour code style is inconsitant
some places it's
field = valueothersfield=valueComment #7
floretan commentedA first round of fixes:
- Add t() to assertion messages, wrapped with single quotes where appropriate and sentences ending with a period.
- Remove empty setUp() calls.
- Fixed indentation in a few places.
All tests still pass.
Question:
Generally, the call to
parent::tearDown()should be at the end oftearDown(), but doing so causes the test to throw uncaught exceptions (the tests still pass).Comment #8
floretan commentedThe problem with the tearDown() function was duplicate code between DatabaseTestCase::tearDown() and DrupalWebTestCase::tearDown(). Deleting the test tables (test, test_people, test_one_blob, test_two_blob and test_task) in DatabaseTestCase::tearDown() is not necessary as those tables are deleted automatically by the parent method.
Only difference with previous patch is the absence of tearDown() method.
Comment #9
floretan commentedFixed the inconsistency pointed out in #6 (chose
field = value).Comment #10
Crell commentedThanks, flobruit!
The attached patch is the same as #9 except with a few whitespace changes to make the coding style of chained methods a little tighter.
Comment #11
zoo33 commentedAll tests passed!
Comment #12
zoo33 commentedPHP shows a notice though:
Apache/2.0.59
PHP Version 5.2.5
MySQL 5.0.41
Comment #13
catch100% pass for me in conjunction with #297860: Regression: Convert session.inc to the new database API (and _sess_write should use a merge)
Comment #14
Crell commentedNow with additional comments!
Comment #15
webchickCommitted! :D
Comment #16
webchickD'oh. :P Committed too soon.
Undefined property: stdClass::$age Notice database_test.test 1485
Comment #17
mustafau commentedTests do not finish on PostgreSQL. Edit: PostgreSQL 8.1
"testInsertFieldOnlyDefinition" gives "Uncaught exception" error.
Adding a try-catch statement allows tests to finish.
Comment #18
Crell commentedOopsies. Try this.
Comment #19
webchickOk, I committed Crell's small notice fix. mustafu's could use review.
Comment #20
cwgordon7 commentedDon't use $this->assertTrue(FALSE). Use $this->fail().
Comment #21
Crell commentedThe main bulk of this patch is already in, so can we file a separate issue for the cleanup? I much prefer that to fixing and re-opening an issue over and over again. Thanks.
Comment #22
Anonymous (not verified) commentedAutomatically closed -- issue fixed for two weeks with no activity.