Skip to content

Commit 109f247

Browse files
committed
Add octane tests to laravel 12 (#554)
* Update and add scaffolding for octane tests in different laravel fixtures * Update test scenarios to use new step * Add Octane - Laravel 12 tests to e2e CI * Update comments on environment variables in docker-compose file
1 parent a2fd1ef commit 109f247

16 files changed

+126
-54
lines changed

.github/workflows/maze-runner-tests.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,8 @@ jobs:
6767
include:
6868
- php-version: '8.4'
6969
laravel-fixture: laravel11
70+
- php-version: '8.4'
71+
laravel-fixture: laravel12
7072

7173
steps:
7274
- uses: actions/checkout@v2

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
/.idea
66
Gemfile.lock
77
maze_output
8+
maze-runner.log
89
.phpunit.result.cache
910
/features/fixtures/*/bugsnag-laravel
1011
/features/fixtures/laravel-latest/*

features/fixtures/docker-compose.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ services:
163163

164164
laravelrr:
165165
build:
166-
context: laravel11
166+
context: ${LARAVEL_FIXTURE} # Set to the base test fixture e.g. laravel11
167167
dockerfile: Dockerfile-roadrunner
168168
args:
169169
- PHP_VERSION
@@ -180,11 +180,11 @@ services:
180180
restart: "no"
181181
ports:
182182
- target: 8000
183-
published: 61311 # must be the same as laravel11
183+
published: ${LARAVEL_FIXTURE_PORT} # Set to the published port of the base test fixture
184184

185185
laravelfp:
186186
build:
187-
context: laravel11
187+
context: ${LARAVEL_FIXTURE} # Set to the base test fixture e.g. laravel11
188188
dockerfile: Dockerfile-frankenphp
189189
args:
190190
- PHP_VERSION
@@ -201,11 +201,11 @@ services:
201201
restart: "no"
202202
ports:
203203
- target: 8000
204-
published: 61311 # must be the same as laravel11
204+
published: ${LARAVEL_FIXTURE_PORT} # Set to the published port of the base test fixture
205205

206206
laravelsw:
207207
build:
208-
context: laravel11
208+
context: ${LARAVEL_FIXTURE} # Set to the base test fixture e.g. laravel11
209209
dockerfile: Dockerfile-swoole
210210
args:
211211
- PHP_VERSION
@@ -222,7 +222,7 @@ services:
222222
restart: "no"
223223
ports:
224224
- target: 8000
225-
published: 61311 # must be the same as laravel11
225+
published: ${LARAVEL_FIXTURE_PORT} # Set to the published port of the base test fixture
226226

227227
laravel12:
228228
build:
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
ARG PHP_VERSION
2+
FROM php:$PHP_VERSION
3+
4+
RUN apt-get update && \
5+
apt-get install -y --no-install-recommends \
6+
git \
7+
unzip \
8+
wget \
9+
zip
10+
11+
WORKDIR /app
12+
13+
COPY . .
14+
COPY --from=composer /usr/bin/composer /usr/local/bin/composer
15+
16+
RUN curl https://frankenphp.dev/install.sh | sh
17+
RUN mv frankenphp /usr/local/bin/
18+
19+
RUN cp .env.example .env
20+
RUN docker-php-ext-install sockets pcntl posix
21+
RUN composer install --no-dev
22+
RUN composer require laravel/octane
23+
RUN php artisan key:generate
24+
RUN php artisan octane:install --server=frankenphp
25+
26+
# create database & apply migrations
27+
RUN touch database/database.sqlite && php artisan migrate --no-interaction
28+
29+
CMD php -d variables_order=EGPCS artisan octane:start --server=frankenphp --host=0.0.0.0 --admin-port=2019 --port=8000
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
ARG PHP_VERSION
2+
FROM php:$PHP_VERSION
3+
4+
RUN apt-get update && \
5+
apt-get install -y --no-install-recommends \
6+
git \
7+
unzip \
8+
wget \
9+
zip
10+
11+
WORKDIR /app
12+
13+
COPY . .
14+
COPY --from=composer /usr/bin/composer /usr/local/bin/composer
15+
16+
RUN cp .env.example .env
17+
RUN docker-php-ext-install sockets pcntl posix
18+
RUN composer install --no-dev
19+
RUN composer require laravel/octane spiral/roadrunner-cli
20+
RUN ./vendor/bin/rr get-binary
21+
RUN php artisan key:generate
22+
RUN php artisan octane:install --server=roadrunner
23+
24+
# create database & apply migrations
25+
RUN touch database/database.sqlite && php artisan migrate --no-interaction
26+
27+
CMD php -d variables_order=EGPCS artisan octane:start --server=roadrunner --host=0.0.0.0 --rpc-port=6001 --port=8000
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
ARG PHP_VERSION
2+
FROM php:$PHP_VERSION
3+
4+
RUN apt-get update && \
5+
apt-get install -y --no-install-recommends \
6+
git \
7+
unzip \
8+
wget \
9+
zip \
10+
libbrotli-dev
11+
12+
WORKDIR /app
13+
14+
COPY . .
15+
COPY --from=composer /usr/bin/composer /usr/local/bin/composer
16+
17+
RUN cp .env.example .env
18+
RUN docker-php-ext-install sockets pcntl posix
19+
RUN composer install --no-dev
20+
RUN composer require laravel/octane
21+
RUN pecl install swoole
22+
RUN docker-php-ext-enable swoole
23+
RUN php artisan key:generate
24+
RUN php artisan octane:install --server=swoole
25+
26+
# create database & apply migrations
27+
RUN touch database/database.sqlite && php artisan migrate --no-interaction
28+
29+
CMD php -d variables_order=EGPCS artisan octane:start --server=swoole --host=0.0.0.0 --rpc-port=6001 --port=8000

features/octane/handled_controller.feature

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
Feature: Handled exceptions in controllers support
22

33
Scenario Outline: Handled exceptions are delivered from controllers
4-
When I start the service <octanesrv>
5-
And I wait for the host "localhost" to open port "61311"
4+
Given I start the laravel octane fixture <octanesrv>
65
When I navigate to the route "/handled_controller_exception"
76
Then I wait to receive an error
87
And the error is valid for the error reporting API version "4.0" for the "Bugsnag Laravel" notifier
@@ -24,8 +23,7 @@ Scenario Outline: Handled exceptions are delivered from controllers
2423

2524
Scenario Outline: Handled errors are delivered from controllers
2625
Given I set environment variable "BUGSNAG_OCTANE_BREADCRUMBS" to "false"
27-
When I start the service <octanesrv>
28-
And I wait for the host "localhost" to open port "61311"
26+
And I start the laravel octane fixture <octanesrv>
2927
When I navigate to the route "/handled_controller_error"
3028
Then I wait to receive an error
3129
And the error is valid for the error reporting API version "4.0" for the "Bugsnag Laravel" notifier
@@ -48,8 +46,7 @@ Scenario Outline: Handled errors are delivered from controllers
4846
@requires-sessions
4947
Scenario Outline: Sessions are correct in handled exceptions from controllers
5048
Given I enable session tracking
51-
When I start the service <octanesrv>
52-
And I wait for the host "localhost" to open port "61311"
49+
And I start the laravel octane fixture <octanesrv>
5350
When I navigate to the route "/handled_controller_exception"
5451
And I wait to receive a session
5552
Then the session is valid for the session reporting API version "1.0" for the "Bugsnag Laravel" notifier

features/octane/handled_middleware.feature

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
Feature: Handled exceptions for middleware support
22

33
Scenario Outline: Handled exceptions are delivered from middleware
4-
When I start the service <octanesrv>
5-
And I wait for the host "localhost" to open port "61311"
4+
Given I start the laravel octane fixture <octanesrv>
65
When I navigate to the route "/handled_middleware_exception"
76
Then I wait to receive an error
87
And the error is valid for the error reporting API version "4.0" for the "Bugsnag Laravel" notifier
@@ -22,8 +21,7 @@ Scenario Outline: Handled exceptions are delivered from middleware
2221
| "laravelsw" |
2322

2423
Scenario Outline: Handled errors are delivered from middleware
25-
When I start the service <octanesrv>
26-
And I wait for the host "localhost" to open port "61311"
24+
Given I start the laravel octane fixture <octanesrv>
2725
When I navigate to the route "/handled_middleware_error"
2826
Then I wait to receive an error
2927
And the error is valid for the error reporting API version "4.0" for the "Bugsnag Laravel" notifier
@@ -45,8 +43,7 @@ Scenario Outline: Handled errors are delivered from middleware
4543
@requires-sessions
4644
Scenario Outline: Sessions are correct in handled exceptions from middleware
4745
Given I enable session tracking
48-
When I start the service <octanesrv>
49-
And I wait for the host "localhost" to open port "61311"
46+
And I start the laravel octane fixture <octanesrv>
5047
When I navigate to the route "/handled_middleware_exception"
5148
And I wait to receive a session
5249
Then the session is valid for the session reporting API version "1.0" for the "Bugsnag Laravel" notifier

features/octane/handled_routing.feature

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
Feature: Handled exceptions from routing support
22

33
Scenario Outline: Handled exceptions are delivered from routing
4-
When I start the service <octanesrv>
5-
And I wait for the host "localhost" to open port "61311"
4+
Given I start the laravel octane fixture <octanesrv>
65
When I navigate to the route "/handled_exception"
76
Then I wait to receive an error
87
And the error is valid for the error reporting API version "4.0" for the "Bugsnag Laravel" notifier
@@ -22,8 +21,7 @@ Scenario Outline: Handled exceptions are delivered from routing
2221
| "laravelsw" |
2322

2423
Scenario Outline: Handled errors are delivered from routing
25-
When I start the service <octanesrv>
26-
And I wait for the host "localhost" to open port "61311"
24+
Given I start the laravel octane fixture <octanesrv>
2725
When I navigate to the route "/handled_error"
2826
Then I wait to receive an error
2927
And the error is valid for the error reporting API version "4.0" for the "Bugsnag Laravel" notifier
@@ -45,8 +43,7 @@ Scenario Outline: Handled errors are delivered from routing
4543
@requires-sessions
4644
Scenario Outline: Sessions are correct in handled exceptions from routing
4745
Given I enable session tracking
48-
When I start the service <octanesrv>
49-
And I wait for the host "localhost" to open port "61311"
46+
And I start the laravel octane fixture <octanesrv>
5047
When I navigate to the route "/handled_exception"
5148
And I wait to receive a session
5249
Then the session is valid for the session reporting API version "1.0" for the "Bugsnag Laravel" notifier

features/octane/handled_view.feature

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
Feature: Handled exceptions for views support
22

33
Scenario Outline: Handled exceptions are delivered from views
4-
When I start the service <octanesrv>
5-
And I wait for the host "localhost" to open port "61311"
4+
Given I start the laravel octane fixture <octanesrv>
65
When I navigate to the route "/handled_view_exception"
76
Then I wait to receive an error
87
And the error is valid for the error reporting API version "4.0" for the "Bugsnag Laravel" notifier
@@ -22,8 +21,7 @@ Scenario Outline: Handled exceptions are delivered from views
2221
| "laravelsw" |
2322

2423
Scenario Outline: Handled errors are delivered from views
25-
When I start the service <octanesrv>
26-
And I wait for the host "localhost" to open port "61311"
24+
Given I start the laravel octane fixture <octanesrv>
2725
When I navigate to the route "/handled_view_error"
2826
Then I wait to receive an error
2927
And the error is valid for the error reporting API version "4.0" for the "Bugsnag Laravel" notifier
@@ -45,8 +43,7 @@ Scenario Outline: Handled errors are delivered from views
4543
@requires-sessions
4644
Scenario Outline: Sessions are correct in Handled exceptions from views
4745
Given I enable session tracking
48-
When I start the service <octanesrv>
49-
And I wait for the host "localhost" to open port "61311"
46+
And I start the laravel octane fixture <octanesrv>
5047
When I navigate to the route "/handled_view_exception"
5148
And I wait to receive a session
5249
Then the session is valid for the session reporting API version "1.0" for the "Bugsnag Laravel" notifier

0 commit comments

Comments
 (0)