diff options
Diffstat (limited to 'crates/shirabe/tests')
10 files changed, 32 insertions, 18 deletions
diff --git a/crates/shirabe/tests/application_test.rs b/crates/shirabe/tests/application_test.rs index 1c93b790..23bc909a 100644 --- a/crates/shirabe/tests/application_test.rs +++ b/crates/shirabe/tests/application_test.rs @@ -40,7 +40,7 @@ fn test_dev_warning() { let _tear_down = TearDown; set_up(); - let application = ApplicationHandle::new("Composer".to_string(), "".to_string()).unwrap(); + let application = ApplicationHandle::new("Shirabe".to_string(), "".to_string()).unwrap(); application.__set_dev_warning_time(Some(time() - 1)); @@ -59,7 +59,7 @@ fn test_dev_warning() { application.do_run(input, output_trait).unwrap(); let expected_output = format!( - "<warning>Warning: This development build of Composer is over 60 days old. It is recommended to update it by running \"{} self-update\" to get the latest version.</warning>{}", + "<warning>Warning: This development build of Shirabe is over 60 days old. It is recommended to update it by running \"{} self-update\" to get the latest version.</warning>{}", PHP_SERVER .lock() .unwrap() @@ -82,7 +82,7 @@ fn test_dev_warning_suppressed_for_self_update() { return; } - let application = ApplicationHandle::new("Composer".to_string(), "".to_string()).unwrap(); + let application = ApplicationHandle::new("Shirabe".to_string(), "".to_string()).unwrap(); let command: std::rc::Rc<std::cell::RefCell<dyn Command>> = std::rc::Rc::new(std::cell::RefCell::new(SelfUpdateCommand::new())); application.add(command).unwrap(); @@ -113,7 +113,7 @@ fn test_process_isolation_works_multiple_times() { let _tear_down = TearDown; set_up(); - let application = ApplicationHandle::new("Composer".to_string(), "".to_string()).unwrap(); + let application = ApplicationHandle::new("Shirabe".to_string(), "".to_string()).unwrap(); let command: std::rc::Rc<std::cell::RefCell<dyn Command>> = std::rc::Rc::new(std::cell::RefCell::new(AboutCommand::new())); application.add(command).unwrap(); @@ -166,7 +166,7 @@ fn test_no_plugins_disables_plugins_when_script_commands_exist() { true, ); - let application = ApplicationHandle::new("Composer".to_string(), "".to_string()).unwrap(); + let application = ApplicationHandle::new("Shirabe".to_string(), "".to_string()).unwrap(); application.set_catch_exceptions(false); // Run list command with --no-plugins, this triggers script command registration which previously @@ -231,7 +231,7 @@ fn test_script_command_takes_priority_over_abbreviated_builtin_command() { true, ); - let application = ApplicationHandle::new("Composer".to_string(), "".to_string()).unwrap(); + let application = ApplicationHandle::new("Shirabe".to_string(), "".to_string()).unwrap(); application.set_catch_exceptions(false); let app_output = std::rc::Rc::new(std::cell::RefCell::new(BufferedOutput::new( diff --git a/crates/shirabe/tests/command/about_command_test.rs b/crates/shirabe/tests/command/about_command_test.rs index bb726cf8..52e42a1d 100644 --- a/crates/shirabe/tests/command/about_command_test.rs +++ b/crates/shirabe/tests/command/about_command_test.rs @@ -8,7 +8,8 @@ use shirabe_php_shim::PhpMixed; #[test] #[serial] fn test_about() { - let composer_version = composer::get_version(); + let shirabe_version = composer::SHIRABE_VERSION; + let composer_version = composer::VERSION; let mut app_tester = get_application_tester(); let status_code = app_tester .run( @@ -19,11 +20,11 @@ fn test_about() { assert_eq!(0, status_code); assert!(app_tester.get_display().contains(&format!( - "Composer - Dependency Manager for PHP - version {composer_version}" + "Shirabe - Dependency Manager for PHP - version {shirabe_version} (based on Composer {composer_version})" ))); assert!(app_tester.get_display().contains( - "Composer is a dependency manager tracking local dependencies of your projects and libraries." + "Shirabe is a dependency manager tracking local dependencies of your projects and libraries." )); assert!( app_tester diff --git a/crates/shirabe/tests/command/validate_command_test.rs b/crates/shirabe/tests/command/validate_command_test.rs index 8e78dfe7..67370df0 100644 --- a/crates/shirabe/tests/command/validate_command_test.rs +++ b/crates/shirabe/tests/command/validate_command_test.rs @@ -69,7 +69,7 @@ fn provide_validate_tests() -> Vec<ValidateCase> { name: "validation passing", composer_json: minimal_valid_configuration(), command: vec![], - expected: "<warning>Composer could not detect the root package (test/suite) version, defaulting to '1.0.0'. See https://getcomposer.org/root-version</warning>\n<warning>Composer could not detect the root package (test/suite) version, defaulting to '1.0.0'. See https://getcomposer.org/root-version</warning>\n./composer.json is valid", + expected: "<warning>Shirabe could not detect the root package (test/suite) version, defaulting to '1.0.0'. See https://getcomposer.org/root-version</warning>\n<warning>Shirabe could not detect the root package (test/suite) version, defaulting to '1.0.0'. See https://getcomposer.org/root-version</warning>\n./composer.json is valid", }, ValidateCase { // WORDING NOTE: upstream asserts justinrainbow's property-prefixed strings @@ -142,7 +142,7 @@ fn test_with_composer_lock() { .run(validate_input(vec![]), RunOptions::default()) .unwrap(); - let expected = "<warning>Composer could not detect the root package (test/suite) version, defaulting to '1.0.0'. See https://getcomposer.org/root-version</warning>\n<warning>Composer could not detect the root package (test/suite) version, defaulting to '1.0.0'. See https://getcomposer.org/root-version</warning>\n./composer.json is valid but your composer.lock has some errors\n# Lock file errors\n- Required package \"root/req\" is not present in the lock file.\nThis usually happens when composer files are incorrectly merged or the composer.json file is manually edited.\nRead more about correctly resolving merge conflicts https://getcomposer.org/doc/articles/resolving-merge-conflicts.md\nand prefer using the \"require\" command over editing the composer.json file directly https://getcomposer.org/doc/03-cli.md#require-r"; + let expected = "<warning>Shirabe could not detect the root package (test/suite) version, defaulting to '1.0.0'. See https://getcomposer.org/root-version</warning>\n<warning>Shirabe could not detect the root package (test/suite) version, defaulting to '1.0.0'. See https://getcomposer.org/root-version</warning>\n./composer.json is valid but your composer.lock has some errors\n# Lock file errors\n- Required package \"root/req\" is not present in the lock file.\nThis usually happens when composer files are incorrectly merged or the composer.json file is manually edited.\nRead more about correctly resolving merge conflicts https://getcomposer.org/doc/articles/resolving-merge-conflicts.md\nand prefer using the \"require\" command over editing the composer.json file directly https://getcomposer.org/doc/03-cli.md#require-r"; assert_eq!(expected.trim(), app_tester.get_display().trim()); diff --git a/crates/shirabe/tests/common/test_case.rs b/crates/shirabe/tests/common/test_case.rs index 9de7d905..3be2df24 100644 --- a/crates/shirabe/tests/common/test_case.rs +++ b/crates/shirabe/tests/common/test_case.rs @@ -302,7 +302,7 @@ pub fn create_composer_lock( pub fn get_application_tester() -> ApplicationTester { crate::bootstrap::bootstrap(); - let application = ApplicationHandle::new("Composer".to_string(), "".to_string()).unwrap(); + let application = ApplicationHandle::new("Shirabe".to_string(), "".to_string()).unwrap(); application.set_catch_exceptions(false); ApplicationTester::new(application) } diff --git a/crates/shirabe/tests/completion_functional_test.rs b/crates/shirabe/tests/completion_functional_test.rs index 6bbe955a..1193b5d1 100644 --- a/crates/shirabe/tests/completion_functional_test.rs +++ b/crates/shirabe/tests/completion_functional_test.rs @@ -44,7 +44,7 @@ fn assert_complete(input: &str, expected_suggestions: Option<&[&str]>) { let mut input: Vec<&str> = input.split(' ').collect(); let command_name = input.remove(0); // PHP: $this->getApplication()->get($commandName) - let application = ApplicationHandle::new("Composer".to_string(), "".to_string()).unwrap(); + let application = ApplicationHandle::new("Shirabe".to_string(), "".to_string()).unwrap(); let base = application.__base_application(); let command = { let mut app_ref = base.borrow_mut(); diff --git a/crates/shirabe/tests/documentation_test.rs b/crates/shirabe/tests/documentation_test.rs index 33e5ec3f..a8da3d08 100644 --- a/crates/shirabe/tests/documentation_test.rs +++ b/crates/shirabe/tests/documentation_test.rs @@ -14,7 +14,7 @@ fn get_command_name(command: &std::rc::Rc<std::cell::RefCell<dyn Command>>) -> S } fn provide_command_cases() -> Vec<std::rc::Rc<std::cell::RefCell<dyn Command>>> { - let application = ApplicationHandle::new("Composer".to_string(), "".to_string()).unwrap(); + let application = ApplicationHandle::new("Shirabe".to_string(), "".to_string()).unwrap(); application.set_catch_exceptions(false); let mut description = diff --git a/crates/shirabe/tests/factory_test.rs b/crates/shirabe/tests/factory_test.rs index 3e70a7d9..4a446f43 100644 --- a/crates/shirabe/tests/factory_test.rs +++ b/crates/shirabe/tests/factory_test.rs @@ -38,7 +38,7 @@ fn test_default_values_are_as_expected() { .borrow_mut() .expects( vec![Expectation::text( - "<warning>You are running Composer with SSL/TLS protection disabled.</warning>", + "<warning>You are running Shirabe with SSL/TLS protection disabled.</warning>", )], false, ) diff --git a/crates/shirabe/tests/filter/platform_requirement_filter/platform_requirement_filter_factory_test.rs b/crates/shirabe/tests/filter/platform_requirement_filter/platform_requirement_filter_factory_test.rs index 10012e78..4c69068f 100644 --- a/crates/shirabe/tests/filter/platform_requirement_filter/platform_requirement_filter_factory_test.rs +++ b/crates/shirabe/tests/filter/platform_requirement_filter/platform_requirement_filter_factory_test.rs @@ -46,7 +46,7 @@ fn test_from_bool_throws_exception_if_type_is_unknown() { let result = PlatformRequirementFilterFactory::from_bool_or_list(PhpMixed::Null); let err = result.unwrap_err(); assert_eq!( - "PlatformRequirementFilter: Unknown $boolOrList parameter null. Please report at https://github.com/composer/composer/issues/new.", + "PlatformRequirementFilter: Unknown $boolOrList parameter null. Please report at https://github.com/nsfisis/php-shirabe/issues/new.", err.to_string() ); } diff --git a/crates/shirabe/tests/installer_test.rs b/crates/shirabe/tests/installer_test.rs index 5c835aff..a4c04c00 100644 --- a/crates/shirabe/tests/installer_test.rs +++ b/crates/shirabe/tests/installer_test.rs @@ -960,7 +960,7 @@ fn do_test_integration(case: &IntegrationCase, expect_output: Option<&str>) { ))); // Application with inline install/update commands (setCode closures). - let application = ApplicationHandle::new("Composer".to_string(), "".to_string()).unwrap(); + let application = ApplicationHandle::new("Shirabe".to_string(), "".to_string()).unwrap(); application.set_catch_exceptions(false); let run_result: std::rc::Rc<std::cell::RefCell<Option<anyhow::Result<i64>>>> = diff --git a/crates/shirabe/tests/plugin/e2e_script_command_test.rs b/crates/shirabe/tests/plugin/e2e_script_command_test.rs index 019c830d..d730fbff 100644 --- a/crates/shirabe/tests/plugin/e2e_script_command_test.rs +++ b/crates/shirabe/tests/plugin/e2e_script_command_test.rs @@ -42,6 +42,15 @@ fn run_command(work: &Path, program: &str, prefix_args: &[&str], args: &[&str]) } } +/// `list` opens with the application banner (logo and version line), which Shirabe owns and +/// upstream Composer cannot match. Everything from the `Usage:` section down still has to. +fn list_body(text: &str) -> &str { + let usage = text + .find("\nUsage:") + .expect("list output has a Usage section"); + &text[usage + 1..] +} + fn lines_starting_with<'a>(text: &'a str, prefix: &str) -> Vec<&'a str> { text.lines() .map(str::trim_end) @@ -149,7 +158,11 @@ fn test_script_command_class_import_matches_upstream_composer() { // them, next to the plain shell script that stays a ScriptAliasCommand. assert_eq!(0, u_list.exit_code); assert_eq!(u_list.exit_code, s_list.exit_code); - assert_eq!(u_list.stdout, s_list.stdout, "list output differs"); + assert_eq!( + list_body(&u_list.stdout), + list_body(&s_list.stdout), + "list output differs" + ); assert_eq!( vec![" greet Greets someone from a script-provided command."], lines_starting_with(&s_list.stdout, "greet") |
