feat(commands): describe catalog rows per component with package fallback

This commit is contained in:
kj
2026-10-05 18:10:30 -03:00
parent 40d853b2b0
commit 90e800ba1f
6 changed files with 83 additions and 10 deletions
+24
View File
@@ -238,3 +238,27 @@ Harness::it('--force resuelve drift pero no salta avisos de compatibilidad', fun
rrmdir($proj);
rrmdir($tool);
});
Harness::it('el catálogo describe cada componente con su texto propio o heredado', function () {
$toolbox = g7_toolbox();
$manifest = json_decode((string) file_get_contents($toolbox . '/packages/http/duckbrain.json'), true);
$manifest['components']['curlRequest']['description'] = 'Cliente HTTP sobre cURL';
write_file($toolbox . '/packages/http/duckbrain.json', json_encode($manifest, JSON_PRETTY_PRINT));
$proj = tmpdir('proj');
$out = fopen('php://memory', 'rw');
$code = (new Toolbox\Commands\CatalogCommand(new Console($out)))->run(
['--root=' . $proj, '--toolbox=' . $toolbox]
);
rewind($out);
$text = (string) stream_get_contents($out);
eq(0, $code, 'catalog termina bien');
ok((bool) preg_match('/curlRequest.*Cliente HTTP sobre cURL/', $text), 'fila propia con su texto');
ok((bool) preg_match('/aria2.*Utilidades HTTP/', $text), 'fila sin texto hereda el del paquete');
ok((bool) preg_match('/compreFace.*Utilidades HTTP/', $text), 'vecino heredando igual');
ok(!preg_match('/aria2.*cURL/', $text), 'los textos no se mezclan entre filas');
rrmdir($toolbox);
rrmdir($proj);
});