Skip to content
This repository was archived by the owner on Apr 16, 2024. It is now read-only.

Commit 478eeda

Browse files
committed
throw exception when feature is not found in describe:feature
1 parent b9e0402 commit 478eeda

File tree

1 file changed

+16
-11
lines changed

1 file changed

+16
-11
lines changed

src/Commands/FeatureDescribeCommand.php

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -45,19 +45,24 @@ class FeatureDescribeCommand extends Command
4545
*/
4646
public function fire()
4747
{
48-
$feature = $this->findFeature('Create Article');
49-
$parser = new Parser();
50-
$jobs = $parser->parseFeatureJobs($feature);
48+
if ($feature = $this->findFeature($this->argument('feature'))) {
49+
$parser = new Parser();
50+
$jobs = $parser->parseFeatureJobs($feature);
5151

52-
$features = [];
53-
foreach ($jobs as $index => $job) {
54-
$features[$feature->title][] = [$index+1, $job->title, $job->domain->name, $job->relativePath];
55-
}
52+
$features = [];
53+
foreach ($jobs as $index => $job) {
54+
$features[$feature->title][] = [$index+1, $job->title, $job->domain->name, $job->relativePath];
55+
}
5656

57-
foreach ($features as $feature => $jobs) {
58-
$this->comment("\n$feature\n");
59-
$this->table(['', 'Job', 'Domain', 'Path'], $jobs);
60-
}
57+
foreach ($features as $feature => $jobs) {
58+
$this->comment("\n$feature\n");
59+
$this->table(['', 'Job', 'Domain', 'Path'], $jobs);
60+
}
61+
62+
return true;
63+
}
64+
65+
throw new InvalidArgumentException('Feature with name "'.$this->argument('feature').'" not found.');
6166
}
6267

6368

0 commit comments

Comments
 (0)