Esempio n. 1
0
 /**
  * Gets the standard host name for the local machine.
  *
  * @return bool|string
  *   a string with the hostname on success, otherwise FALSE is returned.
  *
  * @see http://php.net/gethostname
  */
 public static function gethostname()
 {
     // In order to be consistent with PHP core implementation, wrap any
     // exception and return false.
     try {
         return ModulesService::getHostname();
     } catch (\Exception $e) {
         return false;
     }
 }
 public function testGetHostnameWithInvalidInstancesError()
 {
     $req = new GetHostnameRequest();
     $resp = new ApplicationError(ErrorCode::INVALID_INSTANCES, 'invalid instances');
     $this->setExpectedException('\\google\\appengine\\api\\modules\\ModulesException');
     $this->apiProxyMock->expectCall('modules', 'GetHostname', $req, $resp);
     $this->assertEquals('hostname', ModulesService::getHostname());
     $this->apiProxyMock->verify();
 }