/** * Tests that the chart factory creates a dot chart for timeline input. * * @return void */ public function testCreateDotChartFromBuildBreakdownTimeline() { $this->markTestSkippedWhenEzcGraphChartNotExists(); $input = new phpucBuildBreakdownTimelineInput(); $input->processLog(new DOMXPath(new DOMDocument())); $factory = new phpucChartFactory(); $chart = $factory->createChart($input); $this->assertType('phpucDotChart', $chart); }
/** * Extracts the test data for a single log file and tests the result. * * @param DOMXPath $xpath The xpath instance for the log file. * * @return void */ protected function doTestSingleLog(DOMXPath $xpath) { $error = $xpath->query('/cruisecontrol[build/@error]/info/property[@name = "builddate"]/@value'); $input = new phpucBuildBreakdownTimelineInput(); $input->processLog($xpath); $data = $input->data; $this->assertEquals(1, count($data)); if ($error->length === 1) { $this->assertArrayHasKey('Broken Builds', $data); $this->assertArrayNotHasKey('Good Builds', $data); $this->assertEquals(1, count($data['Broken Builds'])); $this->assertRegExp('/[0-2][0-9]:[0-5][0-9]/', reset($data['Broken Builds'])); } else { $this->assertArrayHasKey('Good Builds', $data); $this->assertArrayNotHasKey('Broken Builds', $data); $this->assertEquals(1, count($data['Good Builds'])); $this->assertRegExp('/[0-2][0-9]:[0-5][0-9]/', reset($data['Good Builds'])); } }