From 2e2dd31deab0b70009f7282a60477858aa518035 Mon Sep 17 00:00:00 2001 From: Jon Waldstein Date: Thu, 25 Apr 2024 09:49:58 -0400 Subject: [PATCH] tests: add main give test for verifying versions between plugin header and readme header --- tests/Unit/TestGive.php | 64 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 tests/Unit/TestGive.php diff --git a/tests/Unit/TestGive.php b/tests/Unit/TestGive.php new file mode 100644 index 0000000000..5ac20ddce1 --- /dev/null +++ b/tests/Unit/TestGive.php @@ -0,0 +1,64 @@ + "Stable tag" + ] + ); + + $plugin = get_plugin_data(GIVE_PLUGIN_FILE); + + $this->assertEquals(GIVE_VERSION, $readme['Version']); + $this->assertEquals(GIVE_VERSION, $plugin['Version']); + $this->assertEquals($readme['Version'], $plugin['Version']); + } + + /** + * @unreleased + */ + public function testReadMeRequiresPHPVersionMatchesPluginVersion(): void + { + $readme = get_file_data( + trailingslashit(GIVE_PLUGIN_DIR) . "readme.txt", + [ + "RequiresPHP" => "Requires PHP" + ] + ); + + $plugin = get_plugin_data(GIVE_PLUGIN_FILE); + + $this->assertEquals($plugin['RequiresPHP'], $readme['RequiresPHP']); + } + + /** + * @unreleased + */ + public function testReadMeRequiresWPVersionMatchesPluginHeaderVersion(): void + { + $readme = get_file_data( + trailingslashit(GIVE_PLUGIN_DIR) . "readme.txt", + [ + "RequiresWP" => "Requires at least" + ] + ); + + $plugin = get_plugin_data(GIVE_PLUGIN_FILE); + + $this->assertEquals($plugin['RequiresWP'], $readme['RequiresWP']); + } +}