コード例 #1
0
 public function putAction()
 {
     $regex = $this->getInvokeArg('bootstrap')->getOption('paramregex');
     if (preg_match($regex['envid'], $this->_getParam('id')) === 0) {
         throw new Exception('Illegal Environment Id.');
     }
     $id = $this->_getParam('id');
     $environment = Application_Model_EnvironmentPeer::getEnvironmentFromJsonFile('php://input');
     $content = $environment->content;
     $envConfig = $this->getInvokeArg('bootstrap')->getOption('environment');
     if (is_array($envConfig) && array_key_exists('addUsernameFromEnv', $envConfig)) {
         if ($envConfig['addUsernameFromEnv'] != '' && getenv($envConfig['addUsernameFromEnv']) != '') {
             if ($environment->by != getenv($envConfig['addUsernameFromEnv'])) {
                 $environment->by .= ' (' . getenv($envConfig['addUsernameFromEnv']) . ')';
             }
         }
     }
     $environment->save();
     $data = $this->getEmptyResult();
     $environment = Application_Model_EnvironmentPeer::getEnvironment($id);
     $environment->content = $content;
     $data['results'] = $environment;
     $this->getResponse()->setBody(json_encode($data));
     $this->getResponse()->setHttpResponseCode(200);
 }
コード例 #2
0
 public function testGetEnvironmentFromJsonFile_ExpiredLock()
 {
     $env = Application_Model_EnvironmentPeer::getEnvironmentFromJsonFile(Zend_Registry::get("datadir") . '/testenv04.json');
     $this->assertEquals($this->expected04, $env);
 }