コード例 #1
0
ファイル: JobResultPeerTest.php プロジェクト: minishri9/dash
 public function testGetJobResults()
 {
     $data = Application_Model_JobResultPeer::getJobResults('branchA', '88.941106ff.2', 2);
     $this->assertInternalType('array', $data);
     $this->assertEquals(2, count($data));
     $this->assertInstanceOf('Application_Model_JobResult', $data[0]);
     $this->assertAttributeEquals('foo', 'name', $data[0]);
     $this->assertAttributeEquals('bar', 'url', $data[0]);
     $this->assertAttributeEquals('SUCCESS', 'status', $data[0]);
     $this->assertAttributeEquals(1, 'total', $data[0]);
     $this->assertAttributeEquals(0, 'skipped', $data[0]);
     $this->assertAttributeEquals(0, 'failed', $data[0]);
     $this->assertInstanceOf('Application_Model_JobResult', $data[1]);
     $this->assertAttributeEquals('test', 'name', $data[1]);
     $this->assertAttributeEquals('url', 'url', $data[1]);
     $this->assertAttributeEquals('FAILURE', 'status', $data[1]);
     $this->assertAttributeEquals(2, 'total', $data[1]);
     $this->assertAttributeEquals(4, 'skipped', $data[1]);
     $this->assertAttributeEquals(2, 'failed', $data[1]);
 }
コード例 #2
0
 public function indexAction()
 {
     $regex = $this->getInvokeArg('bootstrap')->getOption('paramregex');
     if (preg_match($regex['bundle'], $this->_getParam('bundle')) === 0) {
         throw new Exception('Ungueltige Bundle Id');
     }
     $bundleId = $this->_getParam('bundle');
     if (preg_match($regex['branch'], $this->_getParam('branch')) === 0) {
         throw new Exception('Ungueltiger Branch');
     }
     $branch = $this->_getParam('branch');
     if (preg_match($regex['stage'], $this->_getParam('stage')) === 0) {
         throw new Exception('Ungueltige Stage');
     }
     $stage = $this->_getParam('stage');
     $data = $this->getEmptyResult();
     $data['results'] = Application_Model_JobResultPeer::getJobResults($branch, $bundleId, $stage);
     $this->getResponse()->setBody(json_encode($data));
     $this->getResponse()->setHttpResponseCode(200);
 }