aboutsummaryrefslogtreecommitdiffhomepage
path: root/crates/shirabe/tests
AgeCommit message (Collapse)Author
2026-06-27fix(validate-command): release Composer borrow before dispatching CommandEventnsfisis
Holding a RefMut<Composer> across execute() conflicted with the shared borrow taken inside EventDispatcher::get_script_listeners, panicking with "RefCell already mutably borrowed". All accessors used here take &self, so a shared borrow suffices. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-27refactor: fix compiler warnings and clippy warningsnsfisis
2026-06-26feat(show-command): port the real configure() input definitionnsfisis
ShowCommand::configure registered an empty set_definition (placeholder), so every show invocation failed with option/argument-does-not-exist. Port the full argument/option list (package, version, --all/--locked/--installed/--platform/ --available/--self/--tree/--latest/--outdated/--format/... ) from PHP ShowCommand::configure. Completion-suggestion closures and the format allowed-value list are dropped to match the current InputArgument/InputOption API. Un-ignores 14 ShowCommandTest cases; the remaining 28 keep faithful bodies but stay ignored (show-rendering output gaps and remote-HTTP paths), reasons updated. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-26fix(remove-command,pool-builder): drop Composer re-entrancy and ↵nsfisis
PRE_POOL_CREATE todo RemoveCommand::execute held composer_full_mut across deactivate_installed_plugins and event dispatch, both of which re-enter the same RefCell (composer.rs:500/446); it only uses &self getters, so borrow it immutably. PoolBuilder dispatched PluginEvents::PRE_POOL_CREATE by building an event that required moving the (unclonable) repositories/Request — left as todo!(). The event is purely plugin-facing and its result is never read in the no-plugin path (Pool::new reads self.packages directly), so skip it with a TODO(plugin) note. Removes the composer.rs re-entrancy and two todo!()s from the remove install path; remove's tests now reach the unregistered-installers blocker (factory.rs). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-26fix(check-platform-reqs-command): add PlatformRepository to existing compositensfisis
execute nested the already-built InstalledRepository inside a second InstalledRepository, tripping the assertion that an InstalledRepository may not contain another. PHP adds a PlatformRepository to the existing composite via addRepository; do the same. Un-ignores CheckPlatformReqsCommandTest::test_failed_platform_requirement. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-26test(command): port ↵nsfisis
show/remove/global/audit/check-platform-reqs/status/self-update/validate tests Faithfully port the remaining stubbed command test bodies from their PHP counterparts (expected values verbatim). Newly passing: remove (6), global (2), check-platform-reqs (1), status (1), audit (1), self-update (1). Tests whose ported bodies reach a genuine unported src path keep faithful bodies but stay #[ignore] with precise reasons. Dominant blockers surfaced: - ShowCommand::configure stub (empty set_definition) blocks all 42 show tests - Composer-handle RefCell re-entrancy in the Installer (composer.rs:500) and Factory::create_composer (composer.rs:446) paths - check_platform_reqs nests InstalledRepository in InstalledRepository - audit's non-locked branch (audit_command.rs:285) and write_error3 re-entrancy Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-26feat(symfony-style): implement is_console_output_interface, apply real table ↵nsfisis
style is_console_output_interface downcasts dyn OutputInterface to the concrete ConsoleOutput (the sole ConsoleOutputInterface implementor) via AsAny, mirroring the existing ConsoleSectionOutput check. create_table now passes the customized TableStyle directly through StyleName::Style instead of discarding it. Un-ignores LicensesCommandTest::test_format_summary. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-26test(base-dependency-command): correct why-not ignore reason to trigger_errornsfisis
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-26refactor(symfony-table): model rows/cells with enums instead of PhpMixednsfisis
The Table helper modeled a row's cells as PhpMixed and recovered the concrete TableCell/TableSeparator types via runtime instance_of, leaving the entire mixed/array bridge (to_row_vec, cell_colspan, row_get, ...) as todo!(). Replace that with proper Row/Cell enums: Row = HeaderDivider | Separator(TableSeparator) | Cells(Vec<Cell>) Cell = Null | Value(String) | Cell(TableCell) | Separator(TableSeparator) The internal header/body boundary that PHP detects by object identity ($divider === $row) becomes the dedicated Row::HeaderDivider variant. Style arguments (PHP string|TableStyle) become a StyleName enum, so Table::new no longer panics in resolve_style's instance_of stub; TableStyle derives Clone so named styles resolve from the registry. PhpMixed-based callers (SymfonyStyle::table, render_table, auditor's sanitize) bridge via From<PhpMixed> for Cell/Row at the boundary. Un-ignores LicensesCommandTest text-format cases (4) and BaseDependencyCommandTest::why; output matches PHP exactly. Removes ~15 impl todo!()s in the Table helper. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-26test(config-command): un-ignore test_config_reads_repos_by_numeric_indexnsfisis
Unblocked by the Config::merge list-form repositories fix. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-26fix(dump-autoload-command): borrow Composer immutably in executensfisis
execute only calls &self getters on the Composer, but borrowed it via composer_full_mut. The held RefMut deadlocked the re-entrant shared borrow taken by EventDispatcher::dispatch -> get_script_listeners -> PartialComposerHandle::borrow_partial, panicking on every invocation. Un-ignores all 12 DumpAutoloadCommandTest cases. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-26fix(repository-command,config): delimited Preg pattern and list-form reposnsfisis
RepositoryCommand's JSON-arg detection used the un-delimited regex r"^\s*\{"; the PHP source is the delimited '{^\s*\{}', which compile_php_pattern requires. Config::merge only extracted repositories from PhpMixed::Array; a JSON array decodes to PhpMixed::List (an array with integer keys in PHP) and was silently dropped. Handle List by mapping to integer string keys. Un-ignores all 10 remaining RepositoryCommandTest cases (16/16 pass). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-26test(command): port command test bodies from Composer PHPUnit suitensfisis
Faithfully port repository, base_dependency, exec, dump_autoload, run_script, licenses command tests from their PHP counterparts (expected values verbatim). Newly passing: repository (6), base_dependency (5), exec (2). Tests whose ported bodies hit a genuine unported path (HTTP/curl, event-dispatch re-entrancy, spl_autoload_register, php_uname, instance_of, un-delimited Preg patterns, Config::merge dropping list repos) keep faithful bodies but stay #[ignore] with precise reasons; no assertions weakened. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-26test(search-command): port testInvalidFormat/testInvalidFlags; ignore ↵nsfisis
testSearch (HTTP layer) Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-26test: un-ignore 14 tests that pass against current implementationsnsfisis
Discovered via a full --include-ignored run: these tests have real (non-stub) bodies and pass now, either because their blocker was since implemented (e.g. config_command's stream_set_blocking via libc) or the ignore was stale. Covers composer, config, forgejo_url, config_command, default_policy, transaction, installed_repository, github_driver, version_bumper. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-26feat(dependency-resolver): wire operation get_package and unblock solver testsnsfisis
Override OperationInterface::get_package for Install/Uninstall/MarkAlias* operations so trait-object dispatch no longer hits the default todo!(), and implement Rule::is_caused_by_lock's locked-repository lookup via Request::get_locked_repository (LockArrayRepository::get_packages is infallible). Change PackageInterface::get_type to return String (matching PHP getType(): string) so AliasPackage can delegate live to its aliasOf handle across the RefCell instead of an impossible &str borrow. Un-ignores 25 SolverTest cases; 2 alias cases stay ignored pending a real solver alias-resolution discrepancy. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-26test: recover binary_installer full-compat port; implement posix_getpwuidnsfisis
The stashed binary_installer port was blocked on posix_getpwuid (reached via Platform::is_virtual_box_guest); implement it via getpwuid(3) extern "C". The 4 install-and-exec tests now pass with the stream I/O and Process cwd fixes. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-26test: port 32 command/repository/downloader testsnsfisis
Add create_installed_json/create_composer_lock test helpers. Port command (8), repository path/forgejo/perforce/vcs (11), and fossil/hg/download_manager (13) tests. Fix production porting bugs: root_package_loader/forgejo_url/version_bumper regex delimiters, repository_manager create_repository_by_class, array_loader isset, licenses_command RefCell borrow; implement disk_free_space and touch2/touch3 via libc. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-26test: un-ignore repository tests unblocked by stream I/Onsfisis
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-26feat(shim): implement stream_select/stream_set_blocking via libcnsfisis
Add fcntl/select extern "C" declarations and a PhpResource::raw_fd seam so the symfony Process pipe loop can read a live child's stdout/stderr. Fix fread on a non-blocking fd (WouldBlock -> "") and the Process null-cwd default. Real subprocess output capture now works; un-ignore the process_executor tests. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-26test: un-ignore advisory pool filter tests unblocked by version_parser fixnsfisis
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-26test: port 24 command/repository/package/util tests; add TlsHelpernsfisis
Port command (9), util gitlab/forgejo/tls (6), package (6), repository (3) tests. Implement TlsHelper. Fix porting bugs: config_command extra merge, RootAliasPackage setters, ValidatingArrayLoader isset, repository_factory name generation, forgejo exception code, version_parser error chaining. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-26test: un-ignore 14 tests unblocked by CurlDownloader and regex fixesnsfisis
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-26feat(http): reimplement CurlDownloader on reqwest; port 15 more testsnsfisis
Replace the libcurl-shim CurlDownloader with a reqwest+tokio implementation per the .ken sketch, resolving the construction panic that blocked command tests (mock path via __new_mock is untouched). Port remote_filesystem (7), hg/svn driver (4), zip_archiver/git_exclude_filter (4) tests. Fix hg/svn/git_exclude regex-delimiter and svn result-propagation porting bugs. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-26test: port 59 autoload/vcs/installer/util/command tests; fix output capturensfisis
Port autoload_generator (24), bitbucket (14), suggested_packages (11), git_driver (6), archive_manager (3), and a bump command test. Fix the ApplicationTester output-capture root cause (php://memory streams must be readable regardless of fopen mode). Implement posix_getuid/geteuid, the PCRE 'A' anchored modifier, php_strip_whitespace, stream_get_wrappers, is_callable scalars; fix preg_quote angle-bracket escaping and class-map parser regexes. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-26test: un-ignore date-dependent vcs/advisory tests now that date_create worksnsfisis
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-26test: port 35 auth/installer/io/zip/bitbucket tests; implement date_creatensfisis
Port auth_helper (14), library_installer (8), console_io (7), zip_downloader (3), git_bitbucket_driver (3) tests. Implement date_create/strtotime for the ISO8601/ RFC3339/relative formats Composer uses (unknown input -> None, no silent guess). Fix production bugs: Question::is_assoc list-vs-assoc, auth_helper gitlab-domains list handling, LibraryInstaller RefCell double-borrow, ZipArchive::extract_to ErrorException propagation. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-26test: port 70 perforce/repository/downloader/installer/dispatcher testsnsfisis
Port perforce (36), locker (10), composer_repository (7), installation_manager (6), file_downloader (5), and event_dispatcher (6) tests via the mock infra. Fix production porting bugs surfaced en route: BufferIO::get_output look-behind regex, ComposerRepository list-form package iteration and initialize dispatch, gethostname and spl_autoload_functions shims; add EventDispatcher get_listeners test seam. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-26test: port 44 vcs/downloader/version tests using mock infransfisis
Port git, version_guesser, gitlab_driver, github_driver, and git_downloader tests using the ProcessExecutor/HttpDownloader mocks and IO/Config stubs. Fix production regex-porting bugs surfaced by the now-reachable paths: Url::sanitize and Response::find_header_value had non-delimited PCRE patterns; implement array_search_mixed non-strict branch and a datetime format mapping. Add HttpDownloader::__new_mock so mocked downloaders skip curl construction. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-26feat(test): add HttpDownloaderMock, IOStub, and Config stub helpersnsfisis
IOStub and ConfigStubBuilder provide getMockBuilder-style configurable stubs. Wired into util/repository/downloader/command test targets. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-26test: un-ignore tests unblocked by zip/spdx/jsonlint/stream implsnsfisis
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-26feat(util): add ProcessExecutorMock test infra; port SymfonyStyle message ↵nsfisis
methods Add an internal mock hook to ProcessExecutor (None in production) so tests can stub command execution without spawning processes, mirroring Composer's ProcessExecutorMock subclass. Add get_process_executor_mock helper and two verification tests. Implement SymfonyStyle's message-handling methods. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-25feat(external-packages,shim): implement impl todos across componentsnsfisis
Port seld/jsonlint JsonParser (+hand-written Lexer), unblocking 10 json_file parse-error tests verified byte-for-byte against PHP. Implement Symfony Finder SplFileInfo, executable finders, String classes (byte/code-point/unicode), ZipArchive shim (via the zip crate), SPDX license validation, and shim date/stream functions. Genuinely-blocked sites (reflection, PHP runtime constants, non-UTF-8 transcoding, recursive PCRE) stay todo!() with reasons. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-25test: un-ignore init/solver tests that now passnsfisis
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-25test: un-ignore tests that now passnsfisis
Remove #[ignore] from 18 tests across array_loader, package_sorter, svn, pool_optimizer, and html_output_formatter that pass now that their implementations are in place. Verified under parallel execution. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-25feat(semver): hand-port constraint AND-split to drop look-around regexnsfisis
The PCRE delimiter `(?<!^|as|[=>< ,]) *(?<!-)[, ](?!-) *(?!,|as|$)` used to split AND-constraints relies on look-around, which the regex crate cannot compile (parse_constraints panicked). Reproduce its semantics in a hand-written `split_and_constraints` scanner shared by VersionParser and RootPackageLoader. Also model `method_exists` for the class-name form (shirabe runs no dumped Composer ClassLoader) and un-ignore the InstalledVersions tests, serialized via `#[serial]` since they share global static state. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-25test: un-ignore repository-conversion JsonManipulator testsnsfisis
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-25fix(json): handle list-form repositories in remove/convert; fix mis-ported ↵nsfisis
test append Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-25test: un-ignore JsonManipulator/JsonConfigSource tests now passingnsfisis
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-25test: un-ignore tests that already passnsfisis
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-25feat(json): validate JSON schema via the jsonschema cratensfisis
Replace the todo!() json_schema::Validator stub with the jsonschema crate. Errors are surfaced as 'property : message'; the message wording follows the jsonschema crate and is *not* justinrainbow-compatible. Port the ComposerSchemaTest and JsonFileTest schema cases to the new wording (noted per test). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-25feat(php-shim): model $_ENV/$_SERVER as OsString snapshotsnsfisis
Rework the environment shim around getenv/putenv on the real environment and $_ENV/$_SERVER as startup snapshots, all over OsString. Migrate every caller off the old server()/server_argv() helpers and force the snapshots in main() before any putenv() runs. Document the porting rules in docs/dev/env-vars-porting.md. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-24feat(process): wire execute output handling to a callback modelnsfisis
Replace the Option<&mut PhpMixed> output plumbing with the IntoExecOutput trait modelling each PHP `$output` case (forward, capture-to-buffer, discard, callback). This lets do_execute pass a real output handler to Process::run, captures output back via get_output, and lets Svn pass its streaming filter handler through execute instead of skipping it.
2026-06-24refactor(process): take cwd as Option<&str> instead of IntoExecCwdnsfisis
Replace the generic cwd parameter backed by the IntoExecCwd trait with a concrete Option<&str> across execute/execute_args/execute_tty/execute_async. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-24refactor(semver): re-export shirabe-semver at crate root, drop ↵nsfisis
composer::semver stubs Flatten shirabe-semver's modules into glob re-exports at the crate root and route all consumers through the short paths. Remove the duplicate composer::semver stubs from shirabe-external-packages in favor of the shirabe-semver types. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-24test(io): add IOMock test helper porting Composer's IOMocknsfisis
Port composer/tests/Composer/Test/Mock/IOMock.php as a BufferIO-backed mock with expects()/assert_complete(), authentication logging, and a Drop guard mirroring TestCase::getIOMock + tearDown. This is the infrastructure many IO-consuming tests need; wiring existing #[ignore] tests onto it is a follow-up, gated on making BufferIO::get_output's look-behind regex regex-crate compatible. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-24feat(io): implement BufferIO new/get_output/set_user_inputsnsfisis
Wire StreamOutput into BufferIO::new, retrieve the stream in get_output via downcast, and set the user input stream in set_user_inputs. Add as_streamable_mut to InputInterface (and ArgvInput) for mutable streamable access, and make StringInput implement StreamableInputInterface to match PHP, where StringInput is streamable via its Input ancestor. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-24test: port more unimplemented testsnsfisis
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-23test(command): port InitCommandTestnsfisis
Port the pure-method cases (parse/namespace/formatAuthors/git/vendor-ignore) and build the ApplicationTester / initTempComposer harness the run cases need. Supporting production changes: - carry the streamable input stream as PhpResource (not PhpMixed) and add InputInterface::as_streamable so QuestionHelper reads the injected stream - add StreamOutput/ConsoleOutput __set_stream test helpers and ApplicationHandle::set_catch_exceptions for the tester - implement the interact() author validator via parse_author_string Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-23refactor(io): hold QuestionHelper directly in ConsoleIO instead of HelperSetnsfisis
Every ConsoleIO construction site only ever registers a single QuestionHelper (production) or none (tests), and routing asks through HelperSet::get('question') loses the concrete type, forcing a downcast back to QuestionHelper. Receive the QuestionHelper in the constructor and hold it directly (in a RefCell, since QuestionHelper::ask takes &mut self while the IOInterfaceImmutable ask methods are &self), dropping the HelperSet field and the throwaway HelperSet built at each call site. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>