diff options
author | Frederic Guillot <fred@kanboard.net> | 2017-01-08 17:02:31 -0500 |
---|---|---|
committer | Frederic Guillot <fred@kanboard.net> | 2017-01-08 17:02:31 -0500 |
commit | 07f9700179da74b056485375652c3b26d6fbce0d (patch) | |
tree | 027408d8895514daa33297d1fbfdda7f26f3dc1c /tests | |
parent | 17ac414d744155d77c729f150115e8fd9e18f285 (diff) |
Offer the possibility to define version compatibility from plugins
Diffstat (limited to 'tests')
-rw-r--r-- | tests/units/Core/Plugin/VersionTest.php | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/tests/units/Core/Plugin/VersionTest.php b/tests/units/Core/Plugin/VersionTest.php new file mode 100644 index 00000000..78f10d95 --- /dev/null +++ b/tests/units/Core/Plugin/VersionTest.php @@ -0,0 +1,29 @@ +<?php + +use Kanboard\Core\Plugin\Version; + +require_once __DIR__.'/../../Base.php'; + +class VersionTest extends Base +{ + public function testIsCompatible() + { + $this->assertFalse(Version::isCompatible('1.0.29', '1.0.28')); + $this->assertTrue(Version::isCompatible('1.0.28', '1.0.28')); + $this->assertTrue(Version::isCompatible('1.0.28', 'master.1234')); + $this->assertTrue(Version::isCompatible('>=1.0.32', 'master')); + $this->assertTrue(Version::isCompatible('>=1.0.32', '1.0.32')); + $this->assertTrue(Version::isCompatible('>=1.0.32', '1.0.33')); + $this->assertTrue(Version::isCompatible('>1.0.32', '1.0.33')); + $this->assertFalse(Version::isCompatible('>1.0.32', '1.0.32')); + $this->assertTrue(Version::isCompatible('1.0.32', 'v1.0.32')); + $this->assertTrue(Version::isCompatible('>=v1.0.32', 'v1.0.32')); + $this->assertTrue(Version::isCompatible('<=v1.0.36', 'v1.0.36')); + $this->assertFalse(Version::isCompatible('<1.0.36', 'v1.0.36')); + $this->assertTrue(Version::isCompatible('<1.0.40', '1.0.36')); + $this->assertTrue(Version::isCompatible('<=1.0.40', '1.0.36')); + $this->assertFalse(Version::isCompatible('<1.0.40', '1.0.40')); + $this->assertFalse(Version::isCompatible('1.0.40', 'v1.0.36')); + $this->assertTrue(Version::isCompatible('<1.1.0', 'v1.0.36')); + } +} |