当前位置: 首页>>代码示例>>PHP>>正文


PHP Terminus::getCache方法代码示例

本文整理汇总了PHP中Terminus::getCache方法的典型用法代码示例。如果您正苦于以下问题:PHP Terminus::getCache方法的具体用法?PHP Terminus::getCache怎么用?PHP Terminus::getCache使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Terminus的用法示例。


在下文中一共展示了Terminus::getCache方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: testGetCache

 public function testGetCache()
 {
     setDummyCredentials();
     $cache = Terminus::getCache();
     setDummyCredentials();
     $session = $cache->getData('session');
     $this->assertEquals($session->user_uuid, '0ffec038-4410-43d0-a404-46997f672d7a');
 }
开发者ID:barkinet,项目名称:cli,代码行数:8,代码来源:test-terminus.php

示例2: testCheckForUpdate

 /**
  * @vcr utils#checkCurrentVersion
  */
 public function testCheckForUpdate()
 {
     $log_file = getLogFileName();
     setOutputDestination($log_file);
     Terminus::getCache()->putData('latest_release', ['check_date' => strtotime('8 days ago')]);
     Utils\checkForUpdate();
     $file_contents = explode("\n", file_get_contents($log_file));
     $this->assertFalse(strpos(array_pop($file_contents), 'An update to Terminus is available.'));
     resetOutputDestination($log_file);
 }
开发者ID:karudonaldson,项目名称:terminus,代码行数:13,代码来源:test-utils.php

示例3: __construct

 /**
  * Instantiates object, sets cache and session
  *
  * @return [TerminusCommand] $this
  */
 public function __construct()
 {
     //Load commonly used data from cache
     $this->cache = Terminus::getCache();
     $this->logger = Terminus::getLogger();
     $this->outputter = Terminus::getOutputter();
     $this->session = Session::instance();
     if (!Terminus::isTest()) {
         $this->checkForUpdate();
     }
 }
开发者ID:blueprintmrk,项目名称:cli,代码行数:16,代码来源:class-terminus-command.php

示例4: testSetCache

 public function testSetCache()
 {
     //Default target
     $terminus = new Terminus();
     $root = Terminus::getCache()->getRoot();
     $this->assertTrue(strpos($root, getenv('HOME')) !== false);
     //Giving no env var for explicitly set cache dir
     putenv('TERMINUS_CACHE_DIR=');
     $terminus->setCache();
     $root = Terminus::getCache()->getRoot();
     $this->assertTrue(strpos($root, getenv('HOME')) !== false);
     //Targeting a dir the Windows way
     exec('mkdir /tmp/out');
     $home = getenv('HOME');
     putenv('HOME=0');
     putenv('HOMEDRIVE=/tmp');
     putenv('HOMEPATH=out');
     $terminus->setCache();
     $root = Terminus::getCache()->getRoot();
     $this->assertTrue(strpos($root, '/tmp/out') !== false);
     //Clean-up
     putenv("HOME={$home}");
     exec("rm -r /tmp/out");
 }
开发者ID:karudonaldson,项目名称:terminus,代码行数:24,代码来源:test-terminus.php

示例5: request

 /**
  * Make a request to the Pantheon API
  *
  * @param [string] $realm   Permissions realm for data request (e.g. user,
  *   site organization, etc. Can also be "public" to simply pull read-only
  *   data that is not privileged.
  * @param [string] $uuid    The UUID of the item in the realm to access
  * @param [string] $path    API path (URL)
  * @param [string] $method  HTTP method to use
  * @param [mixed]  $options A native PHP data structure (e.g. int, string,
  *   array, or stdClass) to be sent along with the request
  * @return [array] $data
  */
 public static function request($realm, $uuid, $path = false, $method = 'GET', $options = null)
 {
     if (!in_array($realm, array('login', 'user', 'public'))) {
         Auth::loggedIn();
     }
     try {
         $cache = Terminus::getCache();
         if (!in_array($realm, array('login', 'user'))) {
             $options['cookies'] = array('X-Pantheon-Session' => Session::getValue('session'));
             $options['verify'] = false;
         }
         $url = Endpoint::get(array('realm' => $realm, 'uuid' => $uuid, 'path' => $path));
         if (Terminus::getConfig('debug')) {
             Terminus::log('debug', 'Request URL: ' . $url);
         }
         $resp = Request::send($url, $method, $options);
         $json = $resp->getBody(true);
         $data = array('info' => $resp->getInfo(), 'headers' => $resp->getRawHeaders(), 'json' => $json, 'data' => json_decode($json), 'status_code' => $resp->getStatusCode());
         return $data;
     } catch (Guzzle\Http\Exception\BadResponseException $e) {
         $response = $e->getResponse();
         throw new TerminusException($response->getBody(true));
     } catch (Guzzle\Http\Exception\HttpException $e) {
         $request = $e->getRequest();
         $sanitized_request = TerminusCommand::stripSensitiveData((string) $request, TerminusCommand::$blacklist);
         throw new TerminusException('API Request Error. {msg} - Request: {req}', array('req' => $sanitized_request, 'msg' => $e->getMessage()));
     } catch (Exception $e) {
         throw new TerminusException('API Request Error: {msg}', array('msg' => $e->getMessage()));
     }
 }
开发者ID:andrefy,项目名称:cli,代码行数:43,代码来源:class-terminus-command.php

示例6: __construct

 public function __construct()
 {
     $this->file_cache = Terminus::getCache();
 }
开发者ID:barkinet,项目名称:cli,代码行数:4,代码来源:test-filecache.php


注:本文中的Terminus::getCache方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。