4 * This file is part of the Behat.
5 * (c) Konstantin Kudryashov <ever.zet@gmail.com>
7 * For the full copyright and license information, please view the LICENSE
8 * file that was distributed with this source code.
11 namespace Behat\Behat\Output\Statistics;
13 use Behat\Testwork\Counter\Timer;
14 use Behat\Testwork\Counter\Memory;
17 * A TotalStatistics decorator to get statistics per phase.
19 * This is useful to show the amount of failures
20 * in a single suite for instance.
22 * @author Wouter J <wouter@wouterj.nl>
24 final class PhaseStatistics implements Statistics
27 * @var TotalStatistics
31 public function __construct()
33 $this->statistics = new TotalStatistics();
37 * Resets the statistics.
39 public function reset()
41 $this->statistics = new TotalStatistics();
47 public function startTimer()
49 $this->statistics->startTimer();
55 public function stopTimer()
57 $this->statistics->stopTimer();
61 * Returns timer object.
65 public function getTimer()
67 return $this->statistics->getTimer();
71 * Returns memory usage object.
75 public function getMemory()
77 return $this->statistics->getMemory();
81 * Registers scenario stat.
83 * @param ScenarioStat $stat
85 public function registerScenarioStat(ScenarioStat $stat)
87 $this->statistics->registerScenarioStat($stat);
91 * Registers step stat.
93 * @param StepStat $stat
95 public function registerStepStat(StepStat $stat)
97 $this->statistics->registerStepStat($stat);
101 * Registers hook stat.
103 * @param HookStat $stat
105 public function registerHookStat(HookStat $stat)
107 $this->statistics->registerHookStat($stat);
111 * Returns counters for different scenario result codes.
115 public function getScenarioStatCounts()
117 return $this->statistics->getScenarioStatCounts();
121 * Returns skipped scenario stats.
123 * @return ScenarioStat[]
125 public function getSkippedScenarios()
127 return $this->statistics->getSkippedScenarios();
131 * Returns failed scenario stats.
133 * @return ScenarioStat[]
135 public function getFailedScenarios()
137 return $this->statistics->getFailedScenarios();
141 * Returns counters for different step result codes.
145 public function getStepStatCounts()
147 return $this->statistics->getStepStatCounts();
151 * Returns failed step stats.
155 public function getFailedSteps()
157 return $this->statistics->getFailedSteps();
161 * Returns pending step stats.
165 public function getPendingSteps()
167 return $this->statistics->getPendingSteps();
171 * Returns failed hook stats.
175 public function getFailedHookStats()
177 return $this->statistics->getFailedHookStats();