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


PHP jApp::saveContext方法代碼示例

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


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

示例1: testEntryPointsList

 function testEntryPointsList()
 {
     jApp::saveContext();
     jApp::initPaths(dirname(__FILE__) . '/app1/');
     $app = new testInstallApp('project_empty.xml');
     $this->assertEquals(array(), $app->getEntryPointsList());
     $app = new testInstallApp('project_empty2.xml');
     $this->assertEquals(array(), $app->getEntryPointsList());
     $app = new testInstallApp('project.xml');
     $list = $app->getEntryPointsList();
     $this->assertEquals(2, count($list));
     $ep = $app->getEntryPointInfo('index');
     $this->assertFalse($ep->isCliScript);
     $this->assertEquals('/index.php', $ep->scriptName);
     $this->assertEquals('index.php', $ep->file);
     $this->assertEquals('', $ep->type);
     $this->assertEquals('aaa', $ep->config->startModule);
     $ep = $app->getEntryPointInfo('foo');
     $this->assertFalse($ep->isCliScript);
     $this->assertEquals('/foo.php', $ep->scriptName);
     $this->assertEquals('foo.php', $ep->file);
     $this->assertEquals('', $ep->type);
     $this->assertEquals('foo', $ep->config->startModule);
     jApp::restoreContext();
 }
開發者ID:hadrienl,項目名稱:jelix,代碼行數:25,代碼來源:installAppTest.php

示例2: testContext

 function testContext()
 {
     $appPath = jApp::appPath();
     $varPath = jApp::varPath();
     $logPath = jApp::logPath();
     $configPath = jApp::configPath();
     $wwwPath = jApp::wwwPath();
     $scriptsPath = jApp::scriptsPath();
     $tempPath = jApp::tempPath();
     // first save
     jApp::saveContext();
     // verify that we still have the current path
     $this->assertEquals($appPath, jApp::appPath());
     $this->assertEquals($varPath, jApp::varPath());
     $this->assertEquals($logPath, jApp::logPath());
     $this->assertEquals($configPath, jApp::configPath());
     $this->assertEquals($wwwPath, jApp::wwwPath());
     $this->assertEquals($scriptsPath, jApp::scriptsPath());
     $this->assertEquals($tempPath, jApp::tempPath());
     // change the path
     jApp::initPaths('/myapp/');
     $this->assertEquals('/myapp/', jApp::appPath());
     $this->assertEquals('/myapp/var/', jApp::varPath());
     $this->assertEquals('/myapp/var/log/', jApp::logPath());
     $this->assertEquals('/myapp/var/config/', jApp::configPath());
     $this->assertEquals('/myapp/www/', jApp::wwwPath());
     $this->assertEquals('/myapp/scripts/', jApp::scriptsPath());
     $this->assertEquals($tempPath, jApp::tempPath());
     // second save
     jApp::saveContext();
     jApp::initPaths('/myapp2/');
     $this->assertEquals('/myapp2/', jApp::appPath());
     $this->assertEquals('/myapp2/var/', jApp::varPath());
     $this->assertEquals('/myapp2/var/log/', jApp::logPath());
     $this->assertEquals('/myapp2/var/config/', jApp::configPath());
     $this->assertEquals('/myapp2/www/', jApp::wwwPath());
     $this->assertEquals('/myapp2/scripts/', jApp::scriptsPath());
     $this->assertEquals($tempPath, jApp::tempPath());
     // pop the second save, we should be with the first saved values
     jApp::restoreContext();
     $this->assertEquals('/myapp/', jApp::appPath());
     $this->assertEquals('/myapp/var/', jApp::varPath());
     $this->assertEquals('/myapp/var/log/', jApp::logPath());
     $this->assertEquals('/myapp/var/config/', jApp::configPath());
     $this->assertEquals('/myapp/www/', jApp::wwwPath());
     $this->assertEquals('/myapp/scripts/', jApp::scriptsPath());
     $this->assertEquals($tempPath, jApp::tempPath());
     // pop the first save, we should be with initial paths
     jApp::restoreContext();
     $this->assertEquals($appPath, jApp::appPath());
     $this->assertEquals($varPath, jApp::varPath());
     $this->assertEquals($logPath, jApp::logPath());
     $this->assertEquals($configPath, jApp::configPath());
     $this->assertEquals($wwwPath, jApp::wwwPath());
     $this->assertEquals($scriptsPath, jApp::scriptsPath());
     $this->assertEquals($tempPath, jApp::tempPath());
 }
開發者ID:hadrienl,項目名稱:jelix,代碼行數:57,代碼來源:jAppContextTest.php


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