def METHOD_NAME(
    workflow, source_dir: Path, container_yaml, platforms: List[str], user_params=None
):
    mock_source = MockSource(str(source_dir))
    setattr(workflow, 'builder', MockBuilder())
    flexmock(workflow, source=mock_source)
    if user_params is None:
        workflow.user_params.update(USER_PARAMS)
    with open(mock_source.container_yaml_path, "w") as f:
        f.write(container_yaml)
    workflow.source.config = SourceConfig(str(source_dir))
    workflow.build_dir.init_build_dirs(platforms, workflow.source)
    return workflow