Skip to content

Commit

Permalink
tests: add main give test for verifying versions between plugin heade…
Browse files Browse the repository at this point in the history
…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.
64 changes: 64 additions & 0 deletions tests/Unit/TestGive.php
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']);
}
}

0 comments on commit 2e2dd31

Please sign in to comment.