6 * Unit tests for drush_sql_expand_wildcard_tables and
7 * drush_sql_filter_tables.
12 class WildcardUnitCase extends UnitUnishTestCase {
14 public static function setUpBeforeClass() {
15 parent::setUpBeforeClass();
16 require_once(dirname(__FILE__) . '/../commands/sql/sql.drush.inc');
20 * Tests drush_sql_expand_wildcard_tables().
22 * @see drush_sql_expand_wildcard_tables().
24 public function testExpandWildcardTables() {
25 // Array of tables to search for.
26 $wildcard_input = array(
29 // Mock array of tables to test with. This is
30 // also the expected result.
44 $expanded_db_tables = drush_sql_expand_wildcard_tables($wildcard_input, $db_tables);
45 // We expect all but the last table to match.
46 array_pop($db_tables);
47 $this->assertEquals($db_tables, $expanded_db_tables);
51 * Tests drush_sql_filter_tables().
53 * @see drush_sql_filter_tables().
55 public function testFilterTables() {
56 // Array of tables to search for.
57 $wildcard_input = array(
61 // Mock array of tables to test with.
73 $expected_result = array(
77 $actual_result = drush_sql_filter_tables($wildcard_input, $db_tables);
78 $this->assertEquals($expected_result, $actual_result);