private function greaterOrEqual($givenAppVersion, $pluginMinAppVersion) { try { $givenAppVersionSem = Parser::parse($givenAppVersion); $pluginMinAppVersionSem = Parser::parse($pluginMinAppVersion); return Compare::greaterThan($givenAppVersionSem, $pluginMinAppVersionSem) || Compare::equals($givenAppVersionSem, $pluginMinAppVersionSem); } catch (\Exception $e) { return false; } }
/** * Assert that of two version strings the first is bigger than the other * * @return void **/ private function assertVersionBiggerThan($v1String, $v2String) { // Parse them $v1 = Parser::parse($v1String); $v2 = Parser::parse($v2String); // Versions should not be equal $this->assertFalse(Compare::equals($v1, $v2), 'Version "' . $v1 . '" should *not* be equal to "' . $v2 . '"'); // Greater than and not greater than $this->assertTrue(Compare::greaterThan($v1, $v2), 'Version "' . $v1 . '" should be greater than "' . $v2 . '"'); $this->assertFalse(Compare::greaterThan($v2, $v1), 'Version "' . $v2 . '" should be greater than "' . $v1 . '"'); // Smaller than and not smaller than $this->assertTrue(Compare::smallerThan($v2, $v1), 'Version "' . $v2 . '" should be smaller than "' . $v1 . '"'); $this->assertFalse(Compare::smallerThan($v1, $v2), 'Version "' . $v1 . '" should *not* be smaller than "' . $v2 . '"'); }