Index: tests/phpunit/tests/user/capabilities.php
===================================================================
--- tests/phpunit/tests/user/capabilities.php	(revision 35641)
+++ tests/phpunit/tests/user/capabilities.php	(working copy)
@@ -1081,4 +1081,50 @@
 
 	}
 
+	/**
+	 * @ticket 31518
+	 */
+	function test_no_meta_caps_results_in_no_caps() {
+
+		$this->markTestIncomplete();
+
+		add_filter( 'map_meta_cap', array( $this, '_return_empty_array' ) );
+
+		$users = array(
+			'administrator' => $this->factory->user->create_and_get( array( 'role' => 'administrator' ) ),
+			'editor'        => $this->factory->user->create_and_get( array( 'role' => 'editor' ) ),
+			'author'        => $this->factory->user->create_and_get( array( 'role' => 'author' ) ),
+			'contributor'   => $this->factory->user->create_and_get( array( 'role' => 'contributor' ) ),
+			'subscriber'    => $this->factory->user->create_and_get( array( 'role' => 'subscriber' ) ),
+		);
+
+		$caps = $this->getCapsAndRoles();
+
+		foreach ( $users as $role => $user ) {
+
+			// make sure the user is valid
+			$this->assertTrue( $user->exists(), "User with {$role} role does not exist" );
+
+			foreach ( $caps as $cap => $roles ) {
+				$this->assertFalse( $user->has_cap( $cap ), "User with the {$role} role should not have the {$cap} capability" );
+				$this->assertFalse( user_can( $user, $cap ), "User with the {$role} role should not have the {$cap} capability" );
+			}
+
+		}
+
+		if ( is_multisite() ) {
+			$super = $this->factory->user->create_and_get( array( 'role' => 'administrator' ) );
+			grant_super_admin( $super->ID );
+
+			foreach ( $caps as $cap => $roles ) {
+				$this->assertTrue( $super->has_cap( $cap ), "Super admin should have the {$cap} capability" );
+				$this->assertTrue( user_can( $super, $cap ), "Super admin should have the {$cap} capability" );
+			}
+
+		}
+
+		remove_filter( 'map_meta_cap', array( $this, '_return_empty_array' ) );
+
+	}
+
 }
