aboutsummaryrefslogtreecommitdiffhomepage
path: root/crates/shirabe/tests/repository
AgeCommit message (Collapse)Author
2026-07-04fix(event-dispatcher): avoid reentrant RefCell panicsnsfisis
Two related "already borrowed" panics reachable from AutoloadGenerator::dump() (which holds the local-repository, installation-manager, and config RefCells for the duration of its own statement, per the temporary-lifetime-extension pattern fixed separately in create_project_command.rs): - ensure_bin_dir_is_in_path called config.borrow_mut() to read "bin-dir", but Config::get only needs &self; use borrow() so it can coexist with an outer borrow instead of conflicting with it. - make_autoloader's real body needed composer_handle.borrow_mut() plus the same local-repository/installation-manager RefCells the caller already holds mutably, which cannot be made reentrant-safe without a larger restructuring. Since all 3 call sites already discard its return value, and its only effect (registering a Composer-generated ClassLoader for autoloading during event-listener PHP execution) is unobservable in this port — there's no embedded PHP interpreter to register it into, and class_exists for user-defined classes is a hardcoded-false shim so the caller's very next check always treats the class as unavailable regardless — make it a genuine no-op. This unblocks the post-autoload-dump event for any script listener naming a PHP class (e.g. Illuminate\Foundation\ComposerScripts), which every create-project/install run reaches once real packages get installed. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-07-02chore(lint): ban std::io::Read/Write, Any, Command use importsnsfisis
Extends no_banned_use to cover std::any::Any, std::io::Read/Write, and std::process::Command, and teaches the linter to allow `as _` imports so trait methods can still be brought into scope without binding the banned name. Fully qualifies all existing usages across the codebase.
2026-07-01test(repository-manager): port testFilterRepoWrappingnsfisis
PathRepository already implements RepositoryInterface and create_repository already handles the "path" class, so the prior ignore reason no longer applies; verify the FilterRepository/PathRepository wrapping via RepositoryInterfaceHandle::is/downcast_rc.
2026-06-28refactor: add linternsfisis
2026-06-28test(tests): use mockall for hand-written interface mocksnsfisis
Replace hand-written mock/stub structs that re-implemented PHPUnit mock-builder behavior (record-and-verify, manual call counters, unreachable!() guards) with mockall::mock! locals across: - package/loader: MockLoader, VersionGuesserMock - command: ArchiveManager/RepositoryManager/EventDispatcher mocks - util: ConfigSource/AuthJson mocks (auth_helper, bitbucket, github, forgejo, gitlab) - repository/vcs: github_driver NullConfigSource - installer: CountingInstaller, RecordingBinaryInstaller, and the DownloadManager mock (formerly common/downloader_stub.rs, now deleted) - downloader: download_manager create_downloader_mock Verification (counts/args) now lives in mockall expectations checked on drop. installation_manager BinaryInstaller is left hand-written because its as_binary_presence_interface seam returns Some(&mut self), which mockall cannot express; io_stub and io_mock are left as-is. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-28test(repository): port testRepositoryWritesInstalledPhpnsfisis
Implement the previously-ignored test, which dumps installed.php via FilesystemRepository::write and byte-matches the Composer fixture. The package link setters needed by configureLinks are now reachable through the __set_provides/__set_replaces test hatches, so the PHP getPackage + configureLinks shape can be reproduced faithfully. Also switch both InstallationManager stubs in this file to a single mockall mock, replacing the hand-rolled impls and call counter. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-27test: port Composer tests unblocked by mockall, add seamsnsfisis
Port 11 categories of previously-ignored Composer tests now reachable with the mockall crate: DownloadManager, VCS/Perforce/File downloaders, VersionSelector, PlatformRepository, Auditor, installer/FilesystemRepository, RootPackageLoader, util auth/http, commands, and Cache. Extract test seams additively on concrete structs as *Interface traits (Runtime, HhvmDetector, VersionGuesser, RepositorySet, Perforce, BinaryInstaller) plus mock-field seams (Cache, Filesystem); consumers take trait objects. Mocks are defined locally in the test crates via mockall::mock!, since automock-generated mocks are cfg(test)-gated and invisible across the integration-test boundary. dataProviders are ported in full; tests blocked by unported shims stay #[ignore] with documented reasons rather than reduced or weakened. Fix product bugs surfaced by the ports: - util/github: use the exception code, not the HTTP status, for 401/403 - advisory: serialize empty audit maps as [] to match PHP json_encode - repository/filesystem and downloader/file: fix RefCell double-borrow panics Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-27refactor: fix compiler warnings and clippy warningsnsfisis
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-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-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-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-25test: un-ignore tests that already passnsfisis
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-22test: port previously-ignored Composer tests via __ test hatchesnsfisis
Re-evaluate the reason'd #[ignore] tests under the Phase D criterion: a test is unportable ONLY if the APIs/types needed to WRITE it do not exist. A test that compiles but panics at runtime (todo!() body, a regex the regex crate cannot compile) or fails at runtime (incomplete or incorrect impl behavior) is portable -- it is written in full and marked with a reason-less #[ignore]. About 120 test functions move from reason'd #[ignore] to reason-less #[ignore] (the ported-but-not-yet-passing signal). Impl crates gain only additive __ test hatches (init_command, pool, file_downloader, package handle link setters, artifact/path repository, repository manager, svn); no existing logic changes. Tests whose required APIs genuinely do not exist (mock/reflection harness, ApplicationTester, solve() discarding SolverProblemsException, a script::Event that cannot be passed as an originating event) keep their reason'd #[ignore]. cargo check -p shirabe --tests passes. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-22test: un-ignore tests that now passnsfisis
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-22test: port more test casesnsfisis
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-22test(php-shim): un-ignore tests now unblocked by implemented shimsnsfisis
Remove #[ignore] from tests gated solely on a shim function that is now implemented, where the test passes: - metapackage_installer::test_update (version_compare) - platform_requirement_filter_factory::test_from_bool_throws... (get_debug_type) - runtime::test_parse_extension_info (html_entity_decode/strip_tags) - package_sorter::test_sorting_does_nothing... (strnatcasecmp) - no_proxy_pattern::test_host_name/test_port (unpack/substr_count) - version_parser::test_is_upgrade (version_compare) - pool::test_what_provides_package_with_constraint - proxy_item::test_throws_on_malformed_url Update the ignore reason where the cited shim is now implemented but the test still cannot pass for a different reason: - no_proxy_pattern::test_ip_address/test_ip_range (IPv4-mapped IPv6 gap) - package_sorter::test_sorting_orders... (look-around regex) - proxy_item::test_url_formatting (parse_url host discrepancy) - json_manipulator/json_config_source/filesystem_repository stubs (test bodies are still todo!(), not yet ported) Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-21test(tests): expand stub macros into plain test functionsnsfisis
The per-file stub!/encode_stub!/etc. macros generated #[ignore]d test functions but obscured the individual test bodies. Expanding them inline removes the macro indirection so future ports can fill in each function directly. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-21test(tests): port setUp/tearDown as set_up/tear_down with TearDownnsfisis
Port PHP setUp/tearDown across the ported integration tests using same-named set_up()/tear_down() functions and a TearDown struct whose Drop runs tear_down(). Fixture-init setUp returns its fixtures; tmpdir-style setUp/tearDown carry state in TearDown fields. Parts that depend on unported infrastructure (PHPUnit mocks, Config::merge, the PHP error handler) stay todo!() and are only wired into ignored stubs to avoid breaking live tests. Also fix shirabe-php-shim putenv to handle the no-'=' form (PHP unsets the variable), which Platform::clear_env relies on for the env-clearing tearDowns. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-21test: port remaining repository and util tests as stubsnsfisis
All ignored: Composer/Filesystem/Platform/Vcs repositories and the AuthHelper/Bitbucket/Git/Perforce/RemoteFilesystem/Svn utils mock IO/Config/HttpDownloader(curl)/ProcessExecutor or use reflection; Filesystem/ProcessExecutor/StreamContextFactory/ProxyManager need on-disk fixtures or proxy env. setUp/tearDown not ported. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-21test(repository): port VCS driver tests ↵nsfisis
(Git/GitHub/GitLab/Bitbucket/Svn/Perforce/Forgejo) Svn/GitBitbucket/Perforce supports pass. GitHub::supports reaches non-strict in_array (todo!()) and Forgejo::supports uses a regex the regex crate cannot compile, so those are ignored. All API-driven cases mock the HttpDownloader (curl) / ProcessExecutor and are stubbed. setUp/tearDown not ported. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-21test(repository): port PathRepositoryTest as stubsnsfisis
PathRepository does not implement RepositoryInterface and exposes no public getPackages/count/hasPackage (delegation to its inner ArrayRepository is not ported), so the cases cannot be driven; the unversioned ones also need the VersionGuesser. All stubbed. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-21test: port SecurityAdvisoryPoolFilter, downloader/command/app stubsnsfisis
All ignored/todo!(): the advisory filter parses affectedVersions via a look-around regex; the Hg/Fossil/Perforce/Archive downloaders and RepositoryManager need mocked process/HttpDownloader (curl); the Validate/ Archive commands, ApplicationTest and CompletionFunctionalTest need the ApplicationTester/console harness. setUp/tearDown not ported. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-21test: port ArtifactRepositoryTest and BinaryInstallerTest as stubsnsfisis
ArtifactRepository reads archives via ZipArchive/PharData (todo!()); BinaryInstaller installs and executes a real PHP binary and mocks a Package. Both stubbed. setUp/tearDown not ported. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-21test: port HgDriverTest and RootAliasPackageTestnsfisis
HgDriver::supports and RootAliasPackage setRequires pass. The other Hg cases need an HgDriver instance (HttpDownloader/curl, mocked process); the other RootAliasPackage setters only update alias_of, not the alias's own copy, so those getters stay empty. All such cases ignored. setUp/tearDown not ported. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-21test(repository): port FilterRepositoryTestnsfisis
All cases pass: only/exclude matching, both-filters guard, disabled child advisories, and canonical vs non-canonical loadPackages. setUp's repository fixture is inlined; teardown not ported. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-21test: port IniHelperTest and RepositoryUtilsTestnsfisis
IniHelper cases reach XdebugHandler::get_all_ini_files (todo!()); RepositoryUtils filterRequiredPackages is fully modeled but building linked packages via ArrayLoader parses constraints with a look-around regex the regex crate cannot compile. Both ignored. setUp/tearDown not ported. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-21test(repository): port RepositoryFactoryTestnsfisis
generateRepositoryName ported (ignored: integer index is not stringified). The manager case mocks IO/Config/HttpDownloader and uses reflection, so it is stubbed. setUp/tearDown not ported. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-21test(repository): port FossilDriverTestnsfisis
Wires up the repository/vcs submodule. setUp/tearDown not ported. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-21test(repository): port InstalledRepositoryTestnsfisis
testAddRepository maps the expected LogicException to #[should_panic] since InstalledRepository::add_repository guards with assert!. testFindPackagesWithReplacersAndProviders is #[ignore] because that assert omits InstalledRepositoryInterface, so adding an InstalledArrayRepository panics before the lookup runs. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-21test(repository): port ArrayRepositoryTestnsfisis
Seven cases pass against ArrayRepository. testAutomaticallyAddAliased... is #[ignore] because AliasPackage::get_unique_name returns the aliased package's unique name rather than the alias's own version, so has_package cannot find the alias version. Adds a shared get_alias_package helper to the test TestCase, building the alias via from_rc_unchecked since the public handle API exposes link/alias construction only indirectly. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-21test(repository): port CompositeRepositoryTestnsfisis
Six cases pass against ArrayRepository/CompositeRepository. testFindPackage is #[ignore] because constraint string parsing relies on a look-around regex that the regex crate does not support. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-21test: add empty test filesnsfisis