From 15cda34a8a2f66dde93ffe77b2238b33c2481882 Mon Sep 17 00:00:00 2001
From: Erick Hitter <git-contrib@ethitter.com>
Date: Sat, 9 Jul 2022 14:26:10 -0700
Subject: [PATCH] Test coverage

---
 tests/inc/class-test-plugin.php | 125 ++++++++++++++++++++++++--------
 1 file changed, 96 insertions(+), 29 deletions(-)

diff --git a/tests/inc/class-test-plugin.php b/tests/inc/class-test-plugin.php
index 28c9604..7dd0de8 100755
--- a/tests/inc/class-test-plugin.php
+++ b/tests/inc/class-test-plugin.php
@@ -82,6 +82,45 @@ class Test_Plugin extends WP_UnitTestCase {
 		);
 	}
 
+	/**
+	 * Test `prepare_session()` method.
+	 *
+	 * @covers ::prepare_session()
+	 * @return void
+	 */
+	public function test_prepare_session() {
+		$this->assertEquals(
+			array(
+				'expiration' => 1,
+			),
+			$this->_invoke_method(
+				0,
+				'prepare_session',
+				array(
+					1,
+				)
+			),
+			'Failed to assert that session data is transformed as expected.'
+		);
+
+		$test_data = array(
+			'expiration' => 2,
+			'foo'        => 'bar',
+		);
+
+		$this->assertEquals(
+			$test_data,
+			$this->_invoke_method(
+				0,
+				'prepare_session',
+				array(
+					$test_data,
+				)
+			),
+			'Failed to assert that session data is not transformed if it is already prepared.'
+		);
+	}
+
 	/**
 	 * Test `get_session()` method.
 	 *
@@ -125,41 +164,69 @@ class Test_Plugin extends WP_UnitTestCase {
 	}
 
 	/**
-	 * Test `prepare_session()` method.
+	 * Test `update_session()` method.
 	 *
-	 * @covers ::prepare_session()
+	 * @covers ::update_session()
 	 * @return void
 	 */
-	public function test_prepare_session() {
-		$this->assertEquals(
-			array(
-				'expiration' => 1,
-			),
-			$this->_invoke_method(
-				0,
-'prepare_session',
-				array(
-					1,
-				)
-			),
-			'Failed to assert that session data is transformed as expected.'
-		);
+	public function test_update_session() {
+		$this->markTestIncomplete();
+	}
 
-		$test_data = array(
-			'expiration' => 2,
-			'foo'        => 'bar',
-		);
+	/**
+	 * Test `update_sessions()` method.
+	 *
+	 * @covers ::update_sessions()
+	 * @return void
+	 */
+	public function test_update_sessions() {
+		$this->markTestIncomplete();
+	}
+
+	/**
+	 * Test `destroy_other_sessions()` method.
+	 *
+	 * @covers ::destroy_other_sessions()
+	 * @return void
+	 */
+	public function test_destroy_other_sessions() {
+		$this->markTestIncomplete();
+	}
+
+	/**
+	 * Test `destroy_all_sessions()` method.
+	 *
+	 * @covers ::destroy_all_sessions()
+	 * @return void
+	 */
+	public function test_destroy_all_sessions() {
+		$this->markTestIncomplete();
+	}
+
+	/**
+	 * Test `drop_sessions()` method.
+	 *
+	 * @covers ::drop_sessions()
+	 * @covers ::flush_redis_db()
+	 * @return void
+	 */
+	public function test_drop_sessions() {
+		$this->markTestIncomplete();
+	}
+
+	/**
+	 * Test `get_key()` method.
+	 *
+	 * @covers ::get_key()
+	 * @return void
+	 */
+	public function test_get_key() {
+		$user_id = $this->factory->user->create();
+		$plugin  = new Plugin( $user_id );
 
 		$this->assertEquals(
-			$test_data,
-			$this->_invoke_method(
-				0,
-				'prepare_session',
-				array(
-					$test_data,
-				)
-			),
-			'Failed to assert that session data is not transformed if it is already prepared.'
+			$plugin->prefix . ':' . $user_id,
+			$this->_invoke_method( $user_id, 'get_key' )
 		);
 	}
 
-- 
GitLab