Révision 4444412d
Ajouté par Julien Enselme il y a presque 10 ans
drupal7/modules/simpletest/tests/database_test.test | ||
---|---|---|
2621 | 2621 |
$this->assertFalse($query->hasAnyTag('other', 'stuff'), 'hasAnyTag() returned false.'); |
2622 | 2622 |
} |
2623 | 2623 |
|
2624 |
/** |
|
2625 |
* Confirm that an extended query has a "tag" added to it. |
|
2626 |
*/ |
|
2627 |
function testExtenderHasTag() { |
|
2628 |
$query = db_select('test') |
|
2629 |
->extend('SelectQueryExtender'); |
|
2630 |
$query->addField('test', 'name'); |
|
2631 |
$query->addField('test', 'age', 'age'); |
|
2632 |
|
|
2633 |
$query->addTag('test'); |
|
2634 |
|
|
2635 |
$this->assertTrue($query->hasTag('test'), 'hasTag() returned true.'); |
|
2636 |
$this->assertFalse($query->hasTag('other'), 'hasTag() returned false.'); |
|
2637 |
} |
|
2638 |
|
|
2639 |
/** |
|
2640 |
* Test extended query tagging "has all of these tags" functionality. |
|
2641 |
*/ |
|
2642 |
function testExtenderHasAllTags() { |
|
2643 |
$query = db_select('test') |
|
2644 |
->extend('SelectQueryExtender'); |
|
2645 |
$query->addField('test', 'name'); |
|
2646 |
$query->addField('test', 'age', 'age'); |
|
2647 |
|
|
2648 |
$query->addTag('test'); |
|
2649 |
$query->addTag('other'); |
|
2650 |
|
|
2651 |
$this->assertTrue($query->hasAllTags('test', 'other'), 'hasAllTags() returned true.'); |
|
2652 |
$this->assertFalse($query->hasAllTags('test', 'stuff'), 'hasAllTags() returned false.'); |
|
2653 |
} |
|
2654 |
|
|
2655 |
/** |
|
2656 |
* Test extended query tagging "has at least one of these tags" functionality. |
|
2657 |
*/ |
|
2658 |
function testExtenderHasAnyTag() { |
|
2659 |
$query = db_select('test') |
|
2660 |
->extend('SelectQueryExtender'); |
|
2661 |
$query->addField('test', 'name'); |
|
2662 |
$query->addField('test', 'age', 'age'); |
|
2663 |
|
|
2664 |
$query->addTag('test'); |
|
2665 |
|
|
2666 |
$this->assertTrue($query->hasAnyTag('test', 'other'), 'hasAnyTag() returned true.'); |
|
2667 |
$this->assertFalse($query->hasAnyTag('other', 'stuff'), 'hasAnyTag() returned false.'); |
|
2668 |
} |
|
2669 |
|
|
2624 | 2670 |
/** |
2625 | 2671 |
* Test that we can attach meta data to a query object. |
2626 | 2672 |
* |
... | ... | |
3091 | 3137 |
|
3092 | 3138 |
$this->assertEqual($this->countTableRows($table_name_system), $this->countTableRows("system"), 'A temporary table was created successfully in this request.'); |
3093 | 3139 |
$this->assertEqual($this->countTableRows($table_name_users), $this->countTableRows("users"), 'A second temporary table was created successfully in this request.'); |
3140 |
|
|
3141 |
// Check that leading whitespace and comments do not cause problems |
|
3142 |
// in the modified query. |
|
3143 |
$sql = " |
|
3144 |
-- Let's select some rows into a temporary table |
|
3145 |
SELECT name FROM {test} |
|
3146 |
"; |
|
3147 |
$table_name_test = db_query_temporary($sql, array()); |
|
3148 |
$this->assertEqual($this->countTableRows($table_name_test), $this->countTableRows('test'), 'Leading white space and comments do not interfere with temporary table creation.'); |
|
3094 | 3149 |
} |
3095 | 3150 |
} |
3096 | 3151 |
|
Formats disponibles : Unified diff
Update drupal 7.27 -> 7.28