Code Duplication    Length = 13-14 lines in 7 locations

tests/phpunit/tests/date/query.php 7 locations

@@ 898-910 (lines=13) @@
895
     * @ticket 25834
896
     * @expectedIncorrectUsage WP_Date_Query
897
     */
898
    public function test_validate_date_values_month() 
899
    {
900
        // Valid values.
901
        $months = range(1, 12);
902
        foreach ( $months as $month ) {
903
            $this->assertTrue($this->q->validate_date_values(array( 'month' => $month )));
904
        }
905
906
        // Invalid values.
907
        $months = array( -1, 0, 13, 'string who wants to be a int' );
908
        foreach ( $months as $month ) {
909
            $this->assertFalse($this->q->validate_date_values(array( 'month' => $month )));
910
        }
911
    }
912
913
    /**
@@ 975-987 (lines=13) @@
972
     * @ticket 25834
973
     * @expectedIncorrectUsage WP_Date_Query
974
     */
975
    public function test_validate_date_values_hour() 
976
    {
977
        // Valid values.
978
        $hours = range(0, 23);
979
        foreach ( $hours as $hour ) {
980
            $this->assertTrue($this->q->validate_date_values(array( 'hour' => $hour )));
981
        }
982
983
        // Invalid values.
984
        $hours = array( -1, 24, 25, 'string' );
985
        foreach ( $hours as $hour ) {
986
            $this->assertFalse($this->q->validate_date_values(array( 'hour' => $hour )));
987
        }
988
    }
989
990
    /**
@@ 994-1006 (lines=13) @@
991
     * @ticket 25834
992
     * @expectedIncorrectUsage WP_Date_Query
993
     */
994
    public function test_validate_date_values_minute() 
995
    {
996
        // Valid values.
997
        $minutes = range(0, 59);
998
        foreach ( $minutes as $minute ) {
999
            $this->assertTrue($this->q->validate_date_values(array( 'minute' => $minute )));
1000
        }
1001
1002
        // Invalid values.
1003
        $minutes = array( -1, 60 );
1004
        foreach ( $minutes as $minute ) {
1005
            $this->assertFalse($this->q->validate_date_values(array( 'minute' => $minute )));
1006
        }
1007
    }
1008
1009
    /**
@@ 1013-1026 (lines=14) @@
1010
     * @ticket 25834
1011
     * @expectedIncorrectUsage WP_Date_Query
1012
     */
1013
    public function test_validate_date_values_second() 
1014
    {
1015
        // Valid values.
1016
        $seconds = range(0, 59);
1017
        foreach ( $seconds as $second ) {
1018
            $this->assertTrue($this->q->validate_date_values(array( 'second' => $second )));
1019
        }
1020
1021
        // Invalid values.
1022
        $seconds = array( -1, 60 );
1023
        foreach ( $seconds as $second ) {
1024
            $this->assertFalse($this->q->validate_date_values(array( 'second' => $second )));
1025
        }
1026
1027
    }
1028
1029
    /**
@@ 1033-1045 (lines=13) @@
1030
     * @ticket 25834
1031
     * @expectedIncorrectUsage WP_Date_Query
1032
     */
1033
    public function test_validate_date_values_day_of_week() 
1034
    {
1035
        // Valid values.
1036
        $days_of_week = range(1, 7);
1037
        foreach ( $days_of_week as $day_of_week ) {
1038
            $this->assertTrue($this->q->validate_date_values(array( 'dayofweek' => $day_of_week )));
1039
        }
1040
1041
        // Invalid values.
1042
        $days_of_week = array( -1, 0, 8 );
1043
        foreach ( $days_of_week as $day_of_week ) {
1044
            $this->assertFalse($this->q->validate_date_values(array( 'dayofweek' => $day_of_week )));
1045
        }
1046
    }
1047
1048
    /**
@@ 1052-1064 (lines=13) @@
1049
     * @ticket 28063
1050
     * @expectedIncorrectUsage WP_Date_Query
1051
     */
1052
    public function test_validate_date_values_day_of_week_iso() 
1053
    {
1054
        // Valid values.
1055
        $days_of_week = range(1, 7);
1056
        foreach ( $days_of_week as $day_of_week ) {
1057
            $this->assertTrue($this->q->validate_date_values(array( 'dayofweek_iso' => $day_of_week )));
1058
        }
1059
1060
        // Invalid values.
1061
        $days_of_week = array( -1, 0, 8 );
1062
        foreach ( $days_of_week as $day_of_week ) {
1063
            $this->assertFalse($this->q->validate_date_values(array( 'dayofweek_iso' => $day_of_week )));
1064
        }
1065
    }
1066
1067
    /**
@@ 1071-1083 (lines=13) @@
1068
     * @ticket 25834
1069
     * @expectedIncorrectUsage WP_Date_Query
1070
     */
1071
    public function test_validate_date_values_day_of_year() 
1072
    {
1073
        // Valid values.
1074
        $days_of_year = range(1, 366);
1075
        foreach ( $days_of_year as $day_of_year ) {
1076
            $this->assertTrue($this->q->validate_date_values(array( 'dayofyear' => $day_of_year )));
1077
        }
1078
1079
        // Invalid values.
1080
        $days_of_year = array( -1, 0, 367 );
1081
        foreach ( $days_of_year as $day_of_year ) {
1082
            $this->assertFalse(@$this->q->validate_date_values(array( 'dayofyear' => $day_of_year )));
1083
        }
1084
    }
1085
1086
    /**