Skip to content

Commit e4612e2

Browse files
committed
Test auto-discovery in Make Command
1 parent 32a4707 commit e4612e2

2 files changed

Lines changed: 23 additions & 1 deletion

File tree

tests/Command/MakeDecisionCommandTest.php

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,4 +103,26 @@ public function testExecute()
103103

104104
$this->assertRegexp('/ADR created successfully/', $tester->getDisplay());
105105
}
106+
107+
public function testExecuteWithAutoDiscovery()
108+
{
109+
$originalValue = $GLOBALS['_composer_autoload_path'] ?? '';
110+
$GLOBALS['_composer_autoload_path'] = __DIR__ . '/../data/vendor/autoload.php';
111+
112+
try {
113+
(new Application())->add($this->command);
114+
115+
$tester = new CommandTester($this->command);
116+
117+
$tester->execute([
118+
'command' => $this->command->getName(),
119+
'title' => 'Foo',
120+
]);
121+
122+
$this->assertRegexp('/ADR created successfully/', $tester->getDisplay());
123+
124+
} finally {
125+
$GLOBALS['_composer_autoload_path'] = $originalValue;
126+
}
127+
}
106128
}

tests/data/adr.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
directory: tests/data/docs/arch
22
template:
3-
decision-record: ./skeleton.md
3+
decision-record: tests/data/skeleton.md

0 commit comments

Comments
 (0)