Skip to content

Commit a90634a

Browse files
committed
Test auto-discovery in Count Command
1 parent bbbf0e7 commit a90634a

1 file changed

Lines changed: 21 additions & 0 deletions

File tree

tests/Command/WorkspaceCountCommandTest.php

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,4 +83,25 @@ public function testExecute()
8383

8484
$this->assertRegexp('/2/', $tester->getDisplay());
8585
}
86+
87+
public function testExecuteWithAutoDiscovery()
88+
{
89+
$originalValue = $GLOBALS['_composer_autoload_path'] ?? '';
90+
$GLOBALS['_composer_autoload_path'] = __DIR__ . '/../data/vendor/autoload.php';
91+
92+
try {
93+
$input = [
94+
'command' => $this->command->getName(),
95+
];
96+
97+
(new Application())->add($this->command);
98+
99+
$tester = new CommandTester($this->command);
100+
$tester->execute($input);
101+
102+
$this->assertRegexp('/2/', $tester->getDisplay());
103+
} finally {
104+
$GLOBALS['_composer_autoload_path'] = $originalValue;
105+
}
106+
}
86107
}

0 commit comments

Comments
 (0)