Index: tests/phpunit/tests/general/archives.php
===================================================================
--- tests/phpunit/tests/general/archives.php	(revision 28148)
+++ tests/phpunit/tests/general/archives.php	(working copy)
@@ -4,9 +4,19 @@
  * @group general
  */
 class Tests_General_Archives extends WP_UnitTestCase {
+
+	/**
+	 * Query log
+	 * @var array
+	 */
+	protected $_queries = array();
+
 	function setUp() {
 		parent::setUp();
 
+		$this->_queries = array();
+		add_filter( 'query', array( $this, 'query_filter' ) );
+
 		wp_cache_delete( 'last_changed', 'posts' );
 	}
 
@@ -108,4 +118,31 @@
 		$this->assertEquals( $time1, wp_cache_get( 'last_changed', 'posts' ) );
 		$this->assertEquals( $num_queries, $wpdb->num_queries );
 	}
-}
\ No newline at end of file
+
+	/**
+	 * @ticket 27834
+	 */
+	function test_get_archives_limit() {
+		global $wpdb;
+
+		// Try to get archives with limit of 0
+		$wpdb->suppress_errors( true );
+		$result = wp_get_archives( array( 'limit' => 0 ) );
+		$wpdb->suppress_errors( false );
+		$this->assertStringEndsNotWith( '0', array_pop( $this->_queries ) );
+
+		// Try to get archives with limit of 1
+		$result = wp_get_archives( array( 'limit' => 1 ) );
+		$this->assertContains( 'LIMIT 1', array_pop( $this->_queries ) );
+	}
+
+	/**
+	 * Log each query
+	 * @param string $sql
+	 * @return string
+	 */
+	function query_filter( $sql ) {
+		$this->_queries[] = $sql;
+		return $sql;
+	}
+}
