Changeset 26055 for trunk/tests/phpunit/tests/meta/query.php
- Timestamp:
- 11/08/2013 11:10:41 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/meta/query.php
r26053 r26055 109 109 /** 110 110 * @ticket 22967 111 */ 111 */ 112 112 function test_null_value_sql() { 113 113 global $wpdb; … … 120 120 $this->assertEquals( 1, substr_count( $sql['where'], "CAST($wpdb->postmeta.meta_value AS CHAR) = '')" ) ); 121 121 } 122 123 /** 124 * @ticket 23033 125 */ 126 function test_get_cast_for_type() { 127 $query = new WP_Meta_Query(); 128 $this->assertEquals( 'BINARY', $query->get_cast_for_type( 'BINARY' ) ); 129 $this->assertEquals( 'CHAR', $query->get_cast_for_type( 'CHAR' ) ); 130 $this->assertEquals( 'DATE', $query->get_cast_for_type( 'DATE' ) ); 131 $this->assertEquals( 'DATETIME', $query->get_cast_for_type( 'DATETIME' ) ); 132 $this->assertEquals( 'SIGNED', $query->get_cast_for_type( 'SIGNED' ) ); 133 $this->assertEquals( 'UNSIGNED', $query->get_cast_for_type( 'UNSIGNED' ) ); 134 $this->assertEquals( 'TIME', $query->get_cast_for_type( 'TIME' ) ); 135 $this->assertEquals( 'SIGNED', $query->get_cast_for_type( 'NUMERIC' ) ); 136 $this->assertEquals( 'NUMERIC(10)', $query->get_cast_for_type( 'NUMERIC(10)' ) ); 137 $this->assertEquals( 'CHAR', $query->get_cast_for_type( 'NUMERIC( 10)' ) ); 138 $this->assertEquals( 'CHAR', $query->get_cast_for_type( 'NUMERIC( 10 )' ) ); 139 $this->assertEquals( 'NUMERIC(10, 5)', $query->get_cast_for_type( 'NUMERIC(10, 5)' ) ); 140 $this->assertEquals( 'CHAR', $query->get_cast_for_type( 'NUMERIC(10, 5)' ) ); 141 $this->assertEquals( 'NUMERIC(10,5)', $query->get_cast_for_type( 'NUMERIC(10,5)' ) ); 142 $this->assertEquals( 'CHAR', $query->get_cast_for_type( 'NUMERIC( 10, 5 )' ) ); 143 $this->assertEquals( 'CHAR', $query->get_cast_for_type( 'NUMERIC(10, 5 )' ) ); 144 $this->assertEquals( 'DECIMAL', $query->get_cast_for_type( 'DECIMAL' ) ); 145 $this->assertEquals( 'DECIMAL(10)', $query->get_cast_for_type( 'DECIMAL(10)' ) ); 146 $this->assertEquals( 'CHAR', $query->get_cast_for_type( 'DECIMAL( 10 )' ) ); 147 $this->assertEquals( 'CHAR', $query->get_cast_for_type( 'DECIMAL( 10)' ) ); 148 $this->assertEquals( 'CHAR', $query->get_cast_for_type( 'DECIMAL(10 )' ) ); 149 $this->assertEquals( 'DECIMAL(10, 5)', $query->get_cast_for_type( 'DECIMAL(10, 5)' ) ); 150 $this->assertEquals( 'DECIMAL(10,5)', $query->get_cast_for_type( 'DECIMAL(10,5)' ) ); 151 $this->assertEquals( 'CHAR', $query->get_cast_for_type( 'DECIMAL(10, 5)' ) ); 152 153 $this->assertEquals( 'CHAR', $query->get_cast_for_type( 'ANYTHING ELSE' ) ); 154 } 122 155 }
Note: See TracChangeset
for help on using the changeset viewer.