1
+ #! /bin/bash
2
+
3
+ # Integration test script that runs tests against multiple PHP versions using Laravel Herd
4
+
5
+ # Array of PHP versions matching our GitHub Actions matrix
6
+ PHP_VERSIONS=(" 7.4" " 8.0" " 8.1" " 8.2" " 8.3" " 8.4" )
7
+
8
+ # Colors for output
9
+ GREEN=' \033[0;32m'
10
+ RED=' \033[0;31m'
11
+ YELLOW=' \033[1;33m'
12
+ NC=' \033[0m' # No Color
13
+
14
+ echo " Starting integration tests across PHP versions..."
15
+ echo " =============================================="
16
+
17
+ # Track overall success
18
+ OVERALL_SUCCESS=true
19
+
20
+ # Iterate through each PHP version
21
+ for VERSION in " ${PHP_VERSIONS[@]} " ; do
22
+ echo " "
23
+ echo -e " ${YELLOW} Testing PHP $VERSION ${NC} "
24
+ echo " ------------------------------"
25
+
26
+ # Switch PHP version using Herd
27
+ echo " Switching to PHP $VERSION ..."
28
+ herd use php@$VERSION
29
+
30
+ if [ $? -ne 0 ]; then
31
+ echo -e " ${RED} Failed to switch to PHP $VERSION ${NC} "
32
+ OVERALL_SUCCESS=false
33
+ continue
34
+ fi
35
+
36
+ # Verify PHP version
37
+ CURRENT_VERSION=$( php -v | head -n 1)
38
+ echo " Current PHP: $CURRENT_VERSION "
39
+
40
+ # Update composer dependencies for this PHP version
41
+ echo " Updating composer dependencies..."
42
+ composer update --quiet
43
+
44
+ if [ $? -ne 0 ]; then
45
+ echo -e " ${RED} Failed to update dependencies for PHP $VERSION ${NC} "
46
+ OVERALL_SUCCESS=false
47
+ continue
48
+ fi
49
+
50
+ # Run tests
51
+ echo " Running tests..."
52
+ composer test
53
+
54
+ if [ $? -eq 0 ]; then
55
+ echo -e " ${GREEN} ✓ Tests passed for PHP $VERSION ${NC} "
56
+ else
57
+ echo -e " ${RED} ✗ Tests failed for PHP $VERSION ${NC} "
58
+ OVERALL_SUCCESS=false
59
+ fi
60
+ done
61
+
62
+ echo " "
63
+ echo " =============================================="
64
+ if [ " $OVERALL_SUCCESS " = true ]; then
65
+ echo -e " ${GREEN} All integration tests passed!${NC} "
66
+ exit 0
67
+ else
68
+ echo -e " ${RED} Some integration tests failed!${NC} "
69
+ exit 1
70
+ fi
0 commit comments