本文整理汇总了PHP中Zend::compareVersion方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend::compareVersion方法的具体用法?PHP Zend::compareVersion怎么用?PHP Zend::compareVersion使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend
的用法示例。
在下文中一共展示了Zend::compareVersion方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testCompareVersion
/**
* Tests that version_compare() and its "proxy" (Zend::compareVersion) work as expected.
*/
public function testCompareVersion()
{
$expect = -1;
// unit test breaks if ZF version > 10.x
for ($i = 0; $i <= 10; $i++) {
for ($j = 0; $j < 10; $j++) {
for ($k = 0; $k < 20; $k++) {
foreach (array('dev', 'alpha', 'beta', 'RC', '', 'pl') as $rel) {
$ver = "{$i}.{$j}.{$k}{$rel}";
if ($ver === Zend::VERSION || "{$i}.{$j}.{$k}-{$rel}" === Zend::VERSION || "{$i}.{$j}.{$k}.{$rel}" === Zend::VERSION || "{$i}.{$j}.{$k} {$rel}" === Zend::VERSION) {
if ($expect != -1) {
$this->fail("Unexpected double match for Zend::VERSION (" . Zend::VERSION . ")");
} else {
$expect = 1;
}
} else {
$this->assertSame(Zend::compareVersion($ver), $expect, "For version '{$ver}' and Zend::VERSION = '" . Zend::VERSION . "': result=" . Zend::compareVersion($ver) . ', but expected ' . $expect);
}
}
}
}
}
if ($expect === -1) {
$this->fail('Unable to recognize Zend::VERSION (' . Zend::VERSION . ')');
}
}