-
Notifications
You must be signed in to change notification settings - Fork 191
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
tests: add main give test for verifying versions between plugin heade…
…r and readme header
- Loading branch information
Jon Waldstein
committed
Apr 25, 2024
1 parent
36878d9
commit 2e2dd31
Showing
1 changed file
with
64 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
<?php | ||
|
||
namespace Give\Tests\Unit; | ||
|
||
use Give\Tests\TestCase; | ||
|
||
/** | ||
* @unreleased | ||
*/ | ||
class TestGive extends TestCase | ||
{ | ||
/** | ||
* @unreleased | ||
*/ | ||
public function testReadMeVersionMatchesPluginVersion(): void | ||
{ | ||
$readme = get_file_data( | ||
trailingslashit(GIVE_PLUGIN_DIR) . "readme.txt", | ||
[ | ||
"Version" => "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']); | ||
} | ||
} |