當前位置: 首頁>>代碼示例>>PHP>>正文


PHP dm::getVersion方法代碼示例

本文整理匯總了PHP中dm::getVersion方法的典型用法代碼示例。如果您正苦於以下問題:PHP dm::getVersion方法的具體用法?PHP dm::getVersion怎麽用?PHP dm::getVersion使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在dm的用法示例。


在下文中一共展示了dm::getVersion方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: dirname

<?php

require_once dirname(__FILE__) . '/helper/dmUnitTestHelper.php';
$helper = new dmUnitTestHelper();
$helper->boot();
$t = new lime_test(12);
$t->comment('Weird version numbers will be shown during this test.');
$t->comment('Diem real version number is ' . DIEM_VERSION);
dm::setVersion('5.2.14');
$t->is(dm::getVersion(), '5.2.14', 'Diem version is 5.2.14');
$t->is(dm::getVersionMajor(), '5', 'Diem version major is 5');
$t->is(dm::getVersionMinor(), '2', 'Diem version minor is 2');
$t->is(dm::getVersionMaintenance(), '14', 'Diem version maintenance is 14');
$t->is(dm::getVersionBranch(), '5.2', 'Diem version branch is 5.2');
dm::setVersion('5.0.0-BETA4_DEV');
$t->is(dm::getVersion(), '5.0.0-BETA4_DEV', 'Diem version is 5.0.0-BETA4_DEV');
$t->is(dm::getVersionMajor(), '5', 'Diem version major is 5');
$t->is(dm::getVersionMinor(), '0', 'Diem version minor is 0');
$t->is(dm::getVersionMaintenance(), '0-BETA4_DEV', 'Diem version maintenance is 0-BETA4_DEV');
$t->is(dm::getVersionBranch(), '5.0', 'Diem version branch is 5.0');
dm::setVersion(DIEM_VERSION);
$t->is(version_compare('5.0.0-BETA4_DEV', '5.0.0'), -1, '5.0.0-BETA4_DEV < 5.0.0');
$t->is(version_compare('5.0.0', '5.0.1'), -1, '5.0.0 < 5.0.1');
開發者ID:theolymp,項目名稱:diem,代碼行數:23,代碼來源:dmCoreTest.php

示例2: isUpToDate

 public function isUpToDate()
 {
     $this->getService('user')->setAttribute('version_check', true, 'dm');
     $serverVersion = $this->getLatestServerVersionForBranch(dm::getVersionBranch());
     return $this->versionCompare(dm::getVersion(), $serverVersion) >= 0;
 }
開發者ID:theolymp,項目名稱:diem,代碼行數:6,代碼來源:dmDiemVersionCheck.php

示例3: initialize

class dmDiemVersionCheckMock extends dmDiemVersionCheck
{
    protected function initialize(array $options)
    {
        parent::initialize($options);
        $this->cache = array('5.0' => '5.0.4', '5.1' => '5.1.0-BETA2');
    }
}
$versionCheck = $helper->get('diem_version_check', 'dmDiemVersionCheckMock');
dm::setVersion('5.0.0-BETA1');
$t->is(dm::getVersion(), '5.0.0-BETA1', 'Diem version is 5.0.0-BETA1');
$t->ok($versionCheck->shouldCheck(), 'versionCheck should check');
$t->is($versionCheck->getLatestServerVersionForBranch('5.0'), '5.0.4', 'Latest version for 5.0 is 5.0.4');
$t->is($versionCheck->getLatestServerVersionForBranch('5.1'), '5.1.0-BETA2', 'Latest version for 5.1 is 5.1.0-BETA2');
$t->is($versionCheck->isUpToDate(), false, 'Diem is not up to date');
$t->is($versionCheck->getRecommendedUpgrade(), '5.0.4', 'Recommended upgrade is 5.0.4');
dm::setVersion('5.0.4');
$t->is(dm::getVersion(), '5.0.4', 'Diem version is 5.0.4');
$t->ok(!$versionCheck->shouldCheck(), 'versionCheck should not check');
$t->is($versionCheck->getLatestServerVersionForBranch('5.0'), '5.0.4', 'Latest version for 5.0 is 5.0.4');
$t->is($versionCheck->getLatestServerVersionForBranch('5.1'), '5.1.0-BETA2', 'Latest version for 5.1 is 5.1.0-BETA2');
$t->is($versionCheck->isUpToDate(), true, 'Diem is up to date');
$t->is($versionCheck->getRecommendedUpgrade(), null, 'Recommended upgrade is null');
dm::setVersion('5.1.0-ALPHA4');
$t->is(dm::getVersion(), '5.1.0-ALPHA4', 'Diem version is 5.1.0-ALPHA4');
$t->ok(!$versionCheck->shouldCheck(), 'versionCheck should not check');
$t->is($versionCheck->getLatestServerVersionForBranch('5.0'), '5.0.4', 'Latest version for 5.0 is 5.0.4');
$t->is($versionCheck->getLatestServerVersionForBranch('5.1'), '5.1.0-BETA2', 'Latest version for 5.1 is 5.1.0-BETA2');
$t->is($versionCheck->isUpToDate(), false, 'Diem is not up to date');
$t->is($versionCheck->getRecommendedUpgrade(), '5.1.0-BETA2', 'Recommended upgrade is 5.1.0-BETA2');
dm::setVersion(DIEM_VERSION);
開發者ID:theolymp,項目名稱:diem,代碼行數:31,代碼來源:dmVersionCheckTest.php


注:本文中的dm::getVersion方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。