public function postAction() { $branch = $this->_getParam('branch'); $bundle = $this->_getParam('bundle'); $comment = $this->_getParam('comment'); $regex = $this->getInvokeArg('bootstrap')->getOption('paramregex'); if (preg_match($regex['branch'], $branch) === 0) { throw new Exception("No valid branch for editing comment specified: '{$branch}'"); } if (empty($bundle)) { throw new Exception("No bundle for editing comment specified"); } Application_Model_BundlePeer::setComment($branch, $bundle, $comment); $this->getResponse()->setBody(json_encode(array('success' => true))); $this->getResponse()->setHttpResponseCode(200); }
public function testSetComment() { $data = Application_Model_BundlePeer::setComment('branchA', '88.941106ff.2', 'Super build!'); $this->assertNotEquals('false', $data); $data = Application_Model_BundlePeer::getComment('branchA', '88.941106ff.2'); $this->assertEquals('Super build!', $data); unlink(Zend_Registry::get("repodir") . '/branchA/88.941106ff.2/metadata/comment'); }