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


PHP Client::getServerParameter方法代码示例

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


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

示例1: testJsonDeleteGame

 /**
  * Test deleting a game
  */
 public function testJsonDeleteGame()
 {
     $this->authenticate('IAmDev', 'passdev');
     $games = $this->loadGames();
     // find a game created by user
     $gamesByUser = array_filter($games, function ($item) {
         return $item->getOwner()->getUsername() == $this->client->getServerParameter('PHP_AUTH_USER');
     });
     if (empty($gamesByUser)) {
         $this->markTestSkipped('You need an user with games to perform a delete');
     }
     $game = array_pop($gamesByUser);
     $this->client->request('DELETE', $this->getUrl('api_1_delete_game', array('slug' => $game->getSlug())));
     $response = $this->client->getResponse();
     $this->assertEquals($response->getStatusCode(), 204, 'The response must be 204 No Content');
     // Verify that the game was well deleted
     $this->client->request('GET', $this->getUrl('api_1_get_game', array('slug' => $game->getSlug())));
     $response = $this->client->getResponse();
     $this->assertEquals($response->getStatusCode(), 404, 'The game has not been deleted as expected');
 }
开发者ID:Brindesable,项目名称:website,代码行数:23,代码来源:GameControllerTest.php

示例2: getAbsoluteUri

 /**
  * Takes a URI and converts it to absolute if it is not already absolute.
  *
  * @param string $uri A URI
  * @return string An absolute URI
  */
 public function getAbsoluteUri($uri)
 {
     // already absolute?
     if (0 === strpos($uri, 'http://') || 0 === strpos($uri, 'https://')) {
         return $uri;
     }
     $currentUri = sprintf('http%s://%s/', $this->client->getServerParameter('HTTPS') ? 's' : '', $this->client->getServerParameter('HTTP_HOST', 'localhost'));
     // protocol relative URL
     if (0 === strpos($uri, '//')) {
         return parse_url($currentUri, PHP_URL_SCHEME) . ':' . $uri;
     }
     // anchor?
     if (!$uri || '#' == $uri[0]) {
         return preg_replace('/#.*?$/', '', $currentUri) . $uri;
     }
     if ('/' !== $uri[0]) {
         $path = parse_url($currentUri, PHP_URL_PATH);
         if ('/' !== substr($path, -1)) {
             $path = substr($path, 0, strrpos($path, '/') + 1);
         }
         $uri = $path . $uri;
     }
     return preg_replace('#^(.*?//[^/]+)\\/.*$#', '$1', $currentUri) . $uri;
 }
开发者ID:glavweb,项目名称:GlavwebRestBundle,代码行数:30,代码来源:RestTestCase.php

示例3: getServerParameter

 /**
  * Gets single server parameter for specified key.
  *
  * @param string $key     A key of the parameter to get
  * @param string $default A default value when key is undefined
  *
  * @return string A value of the parameter
  */
 public function getServerParameter($key, $default = '')
 {
     return $this->subject->getServerParameter($key, $default);
 }
开发者ID:kleijnweb,项目名称:swagger-bundle,代码行数:12,代码来源:ApiTestClient.php


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