Skip to content

Commit 0875d9c

Browse files
committed
add test
1 parent e4f584d commit 0875d9c

1 file changed

Lines changed: 47 additions & 0 deletions

File tree

tests/Unit/Show/SharpShowTestDefault.php

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -297,3 +297,50 @@ public function execute(mixed $instanceId, array $data = []): array
297297
expect($show->showConfig(1)['commands']['instance'][0][0]['key'])->toEqual('cmd1')
298298
->and($show->showConfig(1)['commands']['my-section'][0][0]['key'])->toEqual('cmd2');
299299
});
300+
301+
it('allows to configure primary instance commands', function () {
302+
$show = new class() extends FakeSharpShow
303+
{
304+
public function buildShowConfig(): void
305+
{
306+
$this->configurePrimaryInstanceCommands(['cmd1', 'cmd-section']);
307+
}
308+
309+
public function getInstanceCommands(): ?array
310+
{
311+
return [
312+
'cmd1' => new class() extends InstanceCommand
313+
{
314+
public function label(): ?string
315+
{
316+
return 'test';
317+
}
318+
319+
public function execute(mixed $instanceId, array $data = []): array
320+
{
321+
return [];
322+
}
323+
},
324+
'my-section' => [
325+
'cmd-section' => new class() extends InstanceCommand
326+
{
327+
public function label(): ?string
328+
{
329+
return 'test-2';
330+
}
331+
332+
public function execute(mixed $instanceId, array $data = []): array
333+
{
334+
return [];
335+
}
336+
},
337+
],
338+
];
339+
}
340+
};
341+
342+
$show->buildShowConfig();
343+
344+
expect($show->showConfig(1)['commands']['instance'][0][0]['primary'])->toEqual(true)
345+
->and($show->showConfig(1)['commands']['my-section'][0][0]['primary'])->toEqual(true);
346+
});

0 commit comments

Comments
 (0)