/**
  * Displays projects information in ccmenu format
  *
  * @param $projectId
  * @return bool
  * @throws \Exception
  * @throws b8\Exception\HttpException
  */
 public function ccxml($projectId)
 {
     /* @var Project $project */
     $project = $this->projectStore->getById($projectId);
     $xml = new \SimpleXMLElement('<Projects/>');
     if (!$project instanceof Project || !$project->getAllowPublicStatus()) {
         return $this->renderXml($xml);
     }
     try {
         $branchList = $this->buildStore->getBuildBranches($projectId);
         if (!$branchList) {
             $branchList = array($project->getBranch());
         }
         foreach ($branchList as $branch) {
             $buildStatusService = new BuildStatusService($branch, $project, $project->getLatestBuild($branch));
             if ($attributes = $buildStatusService->toArray()) {
                 $projectXml = $xml->addChild('Project');
                 foreach ($attributes as $attributeKey => $attributeValue) {
                     $projectXml->addAttribute($attributeKey, $attributeValue);
                 }
             }
         }
     } catch (\Exception $e) {
         $xml = new \SimpleXMLElement('<projects/>');
     }
     return $this->renderXml($xml);
 }
 /**
  * @dataProvider finishedProvider
  *
  * @param int $buildConfigId
  * @param array $expectedResult
  */
 public function testFinished($buildConfigId, array $expectedResult)
 {
     $build = $this->getBuild($buildConfigId);
     $service = new BuildStatusService(self::BRANCH, $this->project, $build);
     $service->setUrl('http://phpci.dev/');
     $this->assertEquals($expectedResult, $service->toArray());
 }