Ticket #52220: 52220_1.diff
| File 52220_1.diff, 3.0 KB (added by , 3 months ago) |
|---|
-
src/wp-includes/functions.php
diff --git a/src/wp-includes/functions.php b/src/wp-includes/functions.php index f5002a45de..97de19ee8b 100644
a b function _wp_mysql_week( $column ) { 7182 7182 $start_of_week = (int) get_option( 'start_of_week' ); 7183 7183 switch ( $start_of_week ) { 7184 7184 case 1: 7185 return "WEEK( $column, 1)";7185 return "WEEK( $column, 3 )"; 7186 7186 case 2: 7187 7187 case 3: 7188 7188 case 4: 7189 7189 case 5: 7190 7190 case 6: 7191 return "WEEK( DATE_SUB( $column, INTERVAL $start_of_week DAY ), 0)";7191 return "WEEK( DATE_SUB( $column, INTERVAL $start_of_week DAY ), 2 )"; 7192 7192 case 0: 7193 7193 default: 7194 return "WEEK( $column, 0)";7194 return "WEEK( $column, 2 )"; 7195 7195 } 7196 7196 } 7197 7197 -
tests/phpunit/tests/functions/wpMysqlWeek.php
diff --git a/tests/phpunit/tests/functions/wpMysqlWeek.php b/tests/phpunit/tests/functions/wpMysqlWeek.php index 3649ee6c4c..340f614889 100644
a b class Tests_Functions_WpMysqlWeek extends WP_UnitTestCase { 31 31 */ 32 32 public function data_wp_mysql_week() { 33 33 return array( 34 array( '1969-12-25', 0, 'WEEK( col_name, 0)' ),35 array( '1969-12-25', 1, 'WEEK( col_name, 1)' ),36 array( '1969-12-25', 2, 'WEEK( DATE_SUB( col_name, INTERVAL 2 DAY ), 0)' ),37 array( '1969-12-25', 3, 'WEEK( DATE_SUB( col_name, INTERVAL 3 DAY ), 0)' ),38 array( '1969-12-25', 4, 'WEEK( DATE_SUB( col_name, INTERVAL 4 DAY ), 0)' ),39 array( '1969-12-25', 5, 'WEEK( DATE_SUB( col_name, INTERVAL 5 DAY ), 0)' ),40 array( '1969-12-25', 6, 'WEEK( DATE_SUB( col_name, INTERVAL 6 DAY ), 0)' ),41 array( '1969-12-25', 9, 'WEEK( col_name, 0)' ),34 array( '1969-12-25', 0, 'WEEK( col_name, 2 )' ), 35 array( '1969-12-25', 1, 'WEEK( col_name, 3 )' ), 36 array( '1969-12-25', 2, 'WEEK( DATE_SUB( col_name, INTERVAL 2 DAY ), 2 )' ), 37 array( '1969-12-25', 3, 'WEEK( DATE_SUB( col_name, INTERVAL 3 DAY ), 2 )' ), 38 array( '1969-12-25', 4, 'WEEK( DATE_SUB( col_name, INTERVAL 4 DAY ), 2 )' ), 39 array( '1969-12-25', 5, 'WEEK( DATE_SUB( col_name, INTERVAL 5 DAY ), 2 )' ), 40 array( '1969-12-25', 6, 'WEEK( DATE_SUB( col_name, INTERVAL 6 DAY ), 2 )' ), 41 array( '1969-12-25', 9, 'WEEK( col_name, 2 )' ), 42 42 ); 43 43 } 44 44 } -
tests/phpunit/tests/query/dateQuery.php
diff --git a/tests/phpunit/tests/query/dateQuery.php b/tests/phpunit/tests/query/dateQuery.php index a43e19f2b6..ab8763b495 100644
a b class Tests_Query_DateQuery extends WP_UnitTestCase { 953 953 954 954 $this->assertSame( array( $p2 ), wp_list_pluck( $posts, 'ID' ) ); 955 955 956 $this->assertStringContainsString( "WEEK( $wpdb->posts.post_date, 1) = 43", $this->q->request );957 $this->assertStringNotContainsString( "WEEK( $wpdb->posts.post_date, 1) = 42", $this->q->request );956 $this->assertStringContainsString( "WEEK( $wpdb->posts.post_date, 3 ) = 43", $this->q->request ); 957 $this->assertStringNotContainsString( "WEEK( $wpdb->posts.post_date, 3 ) = 42", $this->q->request ); 958 958 } 959 959 960 960 /**
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)