-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Jon Waldstein
authored and
Jon Waldstein
committed
May 15, 2024
1 parent
f6705d7
commit ad47bc9
Showing
12 changed files
with
126 additions
and
499 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
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
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 |
---|---|---|
@@ -1,33 +1,21 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<phpunit | ||
bootstrap="tests/unit/bootstrap.php" | ||
backupGlobals="false" | ||
colors="true" | ||
convertErrorsToExceptions="true" | ||
convertNoticesToExceptions="true" | ||
convertWarningsToExceptions="true" | ||
verbose="true" | ||
syntaxCheck="true" | ||
> | ||
<testsuites> | ||
<testsuite name="Give Test Suite"> | ||
<directory suffix="Test.php">./tests/unit/tests</directory> | ||
</testsuite> | ||
</testsuites> | ||
<filter> | ||
<blacklist> | ||
<directory suffix=".php">./templates/</directory> | ||
<directory suffix=".php">./tests/</directory> | ||
<directory suffix=".php">./tmp/</directory> | ||
<directory suffix=".php">./languages/</directory> | ||
<directory suffix=".php">./tests/</directory> | ||
<directory suffix=".php">./templates/</directory> | ||
<directory suffix=".php">./includes/libraries/</directory> | ||
<directory suffix=".php">./includes/admin/tools/export</directory> | ||
<directory suffix=".php">./includes/admin/reporting/tools/</directory> | ||
</blacklist> | ||
</filter> | ||
<logging> | ||
<log type="coverage-clover" target="./tmp/clover.xml" charset="UTF-8" /> | ||
</logging> | ||
</phpunit> | ||
bootstrap="tests/bootstrap.php" | ||
backupGlobals="false" | ||
colors="true" | ||
convertErrorsToExceptions="true" | ||
convertNoticesToExceptions="true" | ||
convertWarningsToExceptions="true" | ||
verbose="true" | ||
> | ||
<testsuites> | ||
<testsuite name="Unit Tests"> | ||
<directory suffix="Test.php">./tests/Unit</directory> | ||
<directory prefix="Test" suffix=".php">./tests/Unit</directory> | ||
</testsuite> | ||
<testsuite name="Feature Tests"> | ||
<directory suffix="Test.php">./tests/Feature</directory> | ||
<directory prefix="Test" suffix=".php">./tests/Feature</directory> | ||
</testsuite> | ||
</testsuites> | ||
</phpunit> |
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
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,90 @@ | ||
<?php | ||
|
||
namespace GiveDivi\Tests; | ||
|
||
use Give\Tests\TestCase; | ||
|
||
use GiveDivi\Addon\Environment; | ||
|
||
/** | ||
* @since 2.0.0 | ||
*/ | ||
class TestGiveDivi extends TestCase | ||
{ | ||
/** | ||
* @since 2.0.0 | ||
*/ | ||
public function testReadMeVersionMatchesPluginVersion(): void | ||
{ | ||
$readme = get_file_data( | ||
trailingslashit(GIVE_DIVI_ADDON_DIR) . "readme.txt", | ||
[ | ||
"Version" => "Stable tag" | ||
] | ||
); | ||
|
||
$plugin = get_plugin_data(GIVE_DIVI_ADDON_FILE); | ||
|
||
$this->assertEquals(GIVE_DIVI_ADDON_VERSION, $readme['Version']); | ||
$this->assertEquals(GIVE_DIVI_ADDON_VERSION, $plugin['Version']); | ||
$this->assertEquals($readme['Version'], $plugin['Version']); | ||
} | ||
|
||
/** | ||
* @since 2.0.0 | ||
*/ | ||
public function testHasMinimumGiveWPVersion(): void | ||
{ | ||
$this->assertSame('3.0.0', GIVE_DIVI_ADDON_MIN_GIVE_VERSION); | ||
} | ||
|
||
/** | ||
* @since 2.0.0 | ||
*/ | ||
public function testIsCompatibleWithGiveWP(): void | ||
{ | ||
$this->assertFalse(version_compare(GIVE_VERSION, GIVE_DIVI_ADDON_MIN_GIVE_VERSION, '<')); | ||
} | ||
|
||
/** | ||
* @since 2.0.0 | ||
*/ | ||
public function testCheckRequirementsShouldReturnTrue(): void | ||
{ | ||
$this->assertTrue(Environment::giveMinRequiredVersionCheck()); | ||
} | ||
|
||
/** | ||
* @since 2.0.0 | ||
*/ | ||
public function testReadMeRequiresPHPVersionMatchesPluginVersion(): void | ||
{ | ||
$readme = get_file_data( | ||
trailingslashit(GIVE_DIVI_ADDON_DIR) . "readme.txt", | ||
[ | ||
"RequiresPHP" => "Requires PHP" | ||
] | ||
); | ||
|
||
$plugin = get_plugin_data(GIVE_DIVI_ADDON_FILE); | ||
|
||
$this->assertEquals($plugin['RequiresPHP'], $readme['RequiresPHP']); | ||
} | ||
|
||
/** | ||
* @since 2.0.0 | ||
*/ | ||
public function testReadMeRequiresWPVersionMatchesPluginHeaderVersion(): void | ||
{ | ||
$readme = get_file_data( | ||
trailingslashit(GIVE_DIVI_ADDON_DIR) . "readme.txt", | ||
[ | ||
"RequiresWP" => "Requires at least" | ||
] | ||
); | ||
|
||
$plugin = get_plugin_data(GIVE_DIVI_ADDON_FILE); | ||
|
||
$this->assertEquals($plugin['RequiresWP'], $readme['RequiresWP']); | ||
} | ||
} |
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,7 @@ | ||
<?php | ||
|
||
use Give\Tests\Framework\Addons\Bootstrap; | ||
|
||
require __DIR__ . '/../../give/vendor/autoload.php'; | ||
|
||
(new Bootstrap(__DIR__ . '/../give-divi.php'))->load(); |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.