Skip to content

Commit 68b2f51

Browse files
committed
test: align DevTools test with Application::all loader contract
1 parent 55f75ee commit 68b2f51

1 file changed

Lines changed: 12 additions & 3 deletions

File tree

tests/Console/DevToolsTest.php

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ public function __construct()
114114
* @return void
115115
*/
116116
#[Test]
117-
public function getCommandsWillYieldLoaderCommandsWithPreservedKeys(): void
117+
public function allWillReturnLoaderCommandsWithPreservedKeys(): void
118118
{
119119
$commands = [
120120
'agents' => new class extends Command {
@@ -133,14 +133,23 @@ public function __construct()
133133

134134
$this->commandLoader->getNames()
135135
->willReturn(array_keys($commands));
136+
$this->commandLoader->has('agents')
137+
->willReturn(true)
138+
->shouldBeCalledOnce();
139+
$this->commandLoader->has('sync')
140+
->willReturn(true)
141+
->shouldBeCalledOnce();
136142
$this->commandLoader->get('agents')
137143
->willReturn($commands['agents']);
138144
$this->commandLoader->get('sync')
139145
->willReturn($commands['sync']);
140146

141-
$providedCommands = iterator_to_array($this->devTools->getCommands());
147+
$providedCommands = $this->devTools->all();
142148

143-
self::assertSame($commands, $providedCommands);
149+
self::assertArrayHasKey('agents', $providedCommands);
150+
self::assertArrayHasKey('sync', $providedCommands);
151+
self::assertSame($commands['agents'], $providedCommands['agents']);
152+
self::assertSame($commands['sync'], $providedCommands['sync']);
144153
}
145154

146155
/**

0 commit comments

Comments
 (0)