Skip to content
This repository was archived by the owner on Jan 31, 2020. It is now read-only.

Commit 39c7b22

Browse files
committed
Merge pull request #56 from mfpierre/fix-alias
Fixes #54, lost alias on single check
2 parents a8a3b58 + ad844eb commit 39c7b22

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

src/ZendDiagnostics/Runner/Runner.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ public function run($checkAlias = null)
103103
{
104104
$results = new ResultsCollection();
105105

106-
$checks = $checkAlias ? new ArrayObject(array($this->getCheck($checkAlias))) : $this->getChecks();
106+
$checks = $checkAlias ? new ArrayObject(array($checkAlias => $this->getCheck($checkAlias))) : $this->getChecks();
107107

108108
// Trigger START event
109109
$this->triggerReporters('onStart', $checks, $this->getConfig());

tests/ZendDiagnosticsTest/RunnerTest.php

+11
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,17 @@ public function testAfterRun()
230230
$this->runner->run();
231231
}
232232

233+
public function testAliasIsKeptAfterRun()
234+
{
235+
$checkAlias = 'foo';
236+
$check = new AlwaysSuccess();
237+
$this->runner->addCheck($check, $checkAlias);
238+
$mock = $this->getMock('ZendDiagnosticsTest\TestAsset\Reporter\AbstractReporter', array('onAfterRun'));
239+
$mock->expects($this->once())->method('onAfterRun')->with($this->identicalTo($check), $check->check(), $checkAlias);
240+
$this->runner->addReporter($mock);
241+
$this->runner->run($checkAlias);
242+
}
243+
233244
/**
234245
* @dataProvider checksAndResultsProvider
235246
*/

0 commit comments

Comments
 (0)