| 111 | | } |
| 112 | | No newline at end of file |
| | 121 | |
| | 122 | /** |
| | 123 | * @ticket 27834 |
| | 124 | */ |
| | 125 | function test_get_archives_limit() { |
| | 126 | global $wpdb; |
| | 127 | |
| | 128 | // Try to get archives with limit of 0 |
| | 129 | $wpdb->suppress_errors( true ); |
| | 130 | $result = wp_get_archives( array( 'limit' => 0 ) ); |
| | 131 | $wpdb->suppress_errors( false ); |
| | 132 | $this->assertStringEndsNotWith( '0', array_pop( $this->_queries ) ); |
| | 133 | |
| | 134 | // Try to get archives with limit of 1 |
| | 135 | $result = wp_get_archives( array( 'limit' => 1 ) ); |
| | 136 | $this->assertContains( 'LIMIT 1', array_pop( $this->_queries ) ); |
| | 137 | } |
| | 138 | |
| | 139 | /** |
| | 140 | * Log each query |
| | 141 | * @param string $sql |
| | 142 | * @return string |
| | 143 | */ |
| | 144 | function query_filter( $sql ) { |
| | 145 | $this->_queries[] = $sql; |
| | 146 | return $sql; |
| | 147 | } |
| | 148 | } |