#!/usr/bin/env python3

# run phpunit with defaults

import os
import subprocess
import sys


def main() -> int:
    project_root = os.path.dirname(os.path.abspath(__file__))+ "/../.."

    phpunit = os.path.join(project_root, "vendor", "phpunit", "phpunit", "phpunit")
    if not os.path.exists(phpunit):
        print('Vendors are not installed, run: composer install --dev\n')
        exit(1)

    command = [
        phpunit,
        "--stop-on-failure",
        "--colors=always",
        "--verbose",
    ]

    return subprocess.call(command, cwd=project_root)


if __name__ == "__main__":
    sys.exit(main())
