v1.0.0
This commit is contained in:
parent
0fcf42b47b
commit
443dceb8ca
1 changed files with 566609 additions and 230 deletions
53
vendor/eduardovillao/wp-since/tests/CompatibilityCheckerTest.php
vendored
Normal file
53
vendor/eduardovillao/wp-since/tests/CompatibilityCheckerTest.php
vendored
Normal file
|
|
@ -0,0 +1,53 @@
|
|||
<?php
|
||||
|
||||
namespace WP_Since\Tests;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use WP_Since\Checker\CompatibilityChecker;
|
||||
|
||||
class CompatibilityCheckerTest extends TestCase
|
||||
{
|
||||
public function testDetectsIncompatibleSymbols()
|
||||
{
|
||||
$sinceMap = [
|
||||
'register_setting' => ['since' => '5.5.0'],
|
||||
'WP_Query' => ['since' => '3.0.0'],
|
||||
'MyClass::boot' => ['since' => '6.2.0'],
|
||||
'custom_hook' => ['since' => '6.0.0'],
|
||||
];
|
||||
|
||||
$symbols = [
|
||||
'register_setting',
|
||||
'WP_Query',
|
||||
'MyClass::boot',
|
||||
'custom_hook',
|
||||
];
|
||||
|
||||
$declaredVersion = '5.5';
|
||||
|
||||
$checker = new CompatibilityChecker($sinceMap);
|
||||
$incompatible = $checker->check($symbols, $declaredVersion);
|
||||
|
||||
$this->assertArrayHasKey('MyClass::boot', $incompatible);
|
||||
$this->assertArrayHasKey('custom_hook', $incompatible);
|
||||
$this->assertArrayNotHasKey('register_setting', $incompatible);
|
||||
$this->assertArrayNotHasKey('WP_Query', $incompatible);
|
||||
$this->assertEquals('6.2.0', $incompatible['MyClass::boot']);
|
||||
}
|
||||
|
||||
public function testAllSymbolsCompatible()
|
||||
{
|
||||
$sinceMap = [
|
||||
'function_one' => ['since' => '5.1.0'],
|
||||
'function_two' => ['since' => '5.0.0'],
|
||||
];
|
||||
|
||||
$symbols = ['function_one', 'function_two'];
|
||||
$declaredVersion = '5.5.0';
|
||||
|
||||
$checker = new CompatibilityChecker($sinceMap);
|
||||
$incompatible = $checker->check($symbols, $declaredVersion);
|
||||
|
||||
$this->assertEmpty($incompatible);
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue