def METHOD_NAME(client, formulas_dir, minion_config, formula):
    # Build package
    client.run(["build", formulas_dir])
    pkgpath = client.ui._status[-1].split()[-1]
    assert os.path.exists(pkgpath)
    # Install package
    client.run(["local", "install", pkgpath])
    # Check filesystem
    for path, contents in formula.contents:
        path = os.path.join(
            minion_config["file_roots"]["base"][0],
            formula.definition["name"],
            path,
        )
        assert os.path.exists(path)
        with salt.utils.files.fopen(path, "r") as rfh:
            assert rfh.read().replace("\r\n", "\n") == contents
    # Check database
    client.run(["info", formula.definition["name"]])
    lines = client.ui._status[-1].replace("\r\n", "\n").split("\n")
    for key, line in (
        ("name", "Name: {}"),
        ("version", "Version: {}"),
        ("release", "Release: {}"),
        ("summary", "Summary: {}"),
    ):
        assert line.format(formula.definition[key]) in lines
    # Reinstall with force=False, should fail
    client.ui._error = []
    client.run(["local", "install", pkgpath])
    assert len(client.ui._error) > 0
    # Reinstall with force=True, should succeed
    with patch.dict(minion_config, {"force": True}):
        client.ui._error = []
        client.run(["local", "install", pkgpath])
        assert len(client.ui._error) == 0