Skip to content

Instantly share code, notes, and snippets.

@Khant-Nyar
Last active September 17, 2024 15:47
Show Gist options
  • Save Khant-Nyar/bd717617a32d94dcec57229e6fcf7030 to your computer and use it in GitHub Desktop.
Save Khant-Nyar/bd717617a32d94dcec57229e6fcf7030 to your computer and use it in GitHub Desktop.
pre-commit to run pint for laravel. bash cmd for auto run pint on git commit
git config --local core.hooksPath .git/hooks && echo '#!/bin/sh
./vendor/bin/pint' > .git/hooks/pre-commit && chmod +x .git/hooks/pre-commit
#!/usr/bin/env bash
# Run Pint for code formatting
./vendor/bin/pint
# Ask if user wants to run tests
read -p "Do you want to run unit tests? (y/n): " run_tests
if [[ $run_tests == "y" ]]; then
# Ask which test framework to use
read -p "Choose test framework (1 for PHPUnit, 2 for Pest): " test_framework
case $test_framework in
1)
./vendor/bin/phpunit
;;
2)
./vendor/bin/pest
;;
*)
echo "Invalid choice. Skipping tests."
;;
esac
else
echo "Skipping tests."
fi
#!/usr/bin/env bash
# Run Pint for code formatting
./vendor/bin/pint
# Ask if user wants to run tests
read -p "Do you want to run unit tests? (y/n): " run_tests
if [[ $run_tests == "y" ]]; then
# Ask which test framework to use
read -p "Choose test framework (1 for PHPUnit, 2 for Pest): " test_framework
case $test_framework in
1)
./vendor/bin/phpunit
;;
2)
./vendor/bin/pest
;;
*)
echo "Invalid choice. Skipping tests."
;;
esac
else
echo "Skipping tests."
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment