See Release Notes
Long Term Support Release
Differences Between: [Versions 311 and 401]
Unit tests for data_get_all_recordsids(), data_get_advance_search_ids(), data_get_record_ids(), and data_get_advanced_search_sql()
Copyright: | 2012 Adrian Greeve |
License: | http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later |
File Size: | 1122 lines (45 kb) |
Included or required: | 0 times |
Referenced: | 0 times |
Includes or requires: | 0 files |
search_test:: (11 methods):
setUp()
test_advanced_search_sql_section()
test_advanced_search_tags()
test_data_entries_indexing()
test_data_entries_document()
test_data_entries_group_support()
test_data_entries_access()
test_attach_files()
create_default_data_fields()
create_default_data_record()
get_entry_for_id()
Class: search_test - X-Ref
Unit tests for {@see data_get_all_recordids()}.setUp() X-Ref |
Set up function. In this instance we are setting up database records to be used in the unit tests. |
test_advanced_search_sql_section() X-Ref |
Test 1: The function data_get_all_recordids. Test 2: This tests the data_get_advance_search_ids() function. The function takes a set of all the record IDs in the database and then with the search details ($this->recordsearcharray) returns a comma seperated string of record IDs that match the search criteria. Test 3: This function tests data_get_recordids(). This is the function that is nested in the last function (see data_get_advance_search_ids). This function takes a couple of extra parameters. $alias is the field alias used in the sql query and $commaid is a comma seperated string of record IDs. Test 3.1: This tests that if no recordids are provided (In a situation where a search is done on an empty database) That an empty array is returned. Test 4: data_get_advanced_search_sql provides an array which contains an sql string to be used for displaying records to the user when they use the advanced search criteria and the parameters that go with the sql statement. This test takes that information and does a search on the database, returning a record. Test 5: Returning to data_get_all_recordids(). Here we are ensuring that the total amount of record ids is reduced to match the group conditions that are provided. There are 25 entries which relate to group 2. They are removed from the total so we should only have 75 records total. Test 6: data_get_all_recordids() again. This time we are testing approved database records. We only want to display the records that have been approved. In this record set we have 89 approved records. |
test_advanced_search_tags() X-Ref |
No description |
test_data_entries_indexing() X-Ref |
Indexing database entries contents. return: void |
test_data_entries_document() X-Ref |
Document contents. return: void |
test_data_entries_group_support() X-Ref |
Group support for data entries. |
test_data_entries_access() X-Ref |
Document accesses. return: void |
test_attach_files() X-Ref |
Test for file contents. return: void |
create_default_data_fields($fieldtypes, $data) X-Ref |
Creates default fields for a database instance param: array $fieldtypes param: mod_data $data return: void |
create_default_data_record($data, $groupid = 0) X-Ref |
Creates default database entry content values for default field param values param: mod_data $data param: int $groupid return: int |
get_entry_for_id($recordid ) X-Ref |
Creates default database entry content values for default field param values param: int $recordid return: stdClass |