Skip to content

Commit

Permalink
[FIX] non-existent references to BrowserContext in symfony behat bund…
Browse files Browse the repository at this point in the history
…le @1.5
  • Loading branch information
Ronny Gericke committed Nov 21, 2023
1 parent 10b5b17 commit bc9a1d1
Show file tree
Hide file tree
Showing 15 changed files with 118 additions and 34 deletions.
16 changes: 8 additions & 8 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ orbs:
jobs:
build:
docker:
- image: 'hgiesenow/php:7.4'
- image: 'ghcr.io/elbformat/sulu-behat-bundle/php'
steps:
- checkout
- run: 'composer install --dev'
Expand All @@ -19,9 +19,9 @@ jobs:
paths: 'vendor'
behat:
docker:
- image: 'hgiesenow/php:7.4'
- image: 'ghcr.io/elbformat/sulu-behat-bundle/php'
environment:
DATABASE_URL: 'mysql://test:[email protected]:3306/test'
DATABASE_URL: 'mysql://test:[email protected]:3306/test?serverVersion=mariadb-10.6.15'
ELASTICSEARCH_HOST: '127.0.0.1:9200'
- image: 'mariadb:10.6'
environment:
Expand All @@ -46,9 +46,9 @@ jobs:
file: 'build/coverage.xml'
behat-admin:
docker:
- image: 'hgiesenow/php:7.4'
- image: 'ghcr.io/elbformat/sulu-behat-bundle/php'
environment:
DATABASE_URL: 'mysql://test:[email protected]:3306/test'
DATABASE_URL: 'mysql://test:[email protected]:3306/test?serverVersion=mariadb-10.6.15'
ELASTICSEARCH_HOST: '127.0.0.1:9200'
- image: 'mariadb:10.6'
environment:
Expand All @@ -74,7 +74,7 @@ jobs:
# Unittests are incomplete by now
# phpunit:
# docker:
# - image: 'hgiesenow/php:7.4'
# - image: 'hgiesenow/php:8.1'
# steps:
# - checkout
# - attach_workspace:
Expand All @@ -86,7 +86,7 @@ jobs:
# file: 'build/clover.xml'
php-cs-fixer:
docker:
- image: 'hgiesenow/php:7.4'
- image: 'ghcr.io/elbformat/sulu-behat-bundle/php'
steps:
- checkout
- attach_workspace:
Expand All @@ -95,7 +95,7 @@ jobs:
- run: 'vendor/bin/php-cs-fixer fix --diff --dry-run tests'
psalm:
docker:
- image: 'hgiesenow/php:7.4'
- image: 'ghcr.io/elbformat/sulu-behat-bundle/php'
steps:
- checkout
- attach_workspace:
Expand Down
46 changes: 46 additions & 0 deletions .github/workflows/docker-image.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Create and publish a Docker image

on:
schedule:
- cron: '0 9 1 * *'
push:
branches:
- fix_non_existent_references
- main

env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}/php

jobs:
build-and-push-image:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write

steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Log in to the Container registry
uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}

- name: Build and push Docker image
uses: docker/build-push-action@f2a1d5e99d037542a71f64918e516c093c6f3fc4
with:
context: docker
push: true
#tags: ${{ steps.meta.outputs.tags }}
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest
labels: ${{ steps.meta.outputs.labels }}
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,8 @@ bin/console -e test sulu:build prod

You can then run the tests in default oder admin profile.
```shell
venbdor/bin/behat
venbdor/bin/behat --profile admin
vendor/bin/behat
vendor/bin/behat --profile admin
```

## Examples
Expand Down
2 changes: 2 additions & 0 deletions behat.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ default:
contexts:
- Elbformat\SymfonyBehatBundle\Context\CommandContext:
- Elbformat\SymfonyBehatBundle\Context\LoggingContext:
- Elbformat\SymfonyBehatBundle\Context\HtmlContext:
- Elbformat\SymfonyBehatBundle\Context\FormContext:
- Elbformat\SuluBehatBundle\Context\BrowserContext:
- Elbformat\SuluBehatBundle\Context\DateContext:
- Elbformat\SuluBehatBundle\Context\SuluPageContext:
Expand Down
9 changes: 6 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,14 @@
}
},
"require": {
"php": ">=7.4",
"php": ">=8.1",
"ext-dom": "*",
"ext-json": "*",
"behat/behat": "^3.8",
"elbformat/symfony-behat-bundle": "^1.5",
"friends-of-behat/symfony-extension": "^2.2",
"sulu/sulu": "^2.4",
"elbformat/symfony-behat-bundle": "^1.0"
"symfony/event-dispatcher": "5.4.*"
},
"require-dev": {
"dvdoug/behat-code-coverage": "^5.2",
Expand All @@ -37,8 +38,10 @@
"phpunit/phpunit": "^9.5",
"sulu/article-bundle": "^2.3",
"sulu/sulu-form-bundle": "^2.4",
"symfony/mailer": "5.4.*",
"symfony/monolog-bridge": "5.4.*",
"symfony/monolog-bundle": "^3.8",
"symfony/runtime": "^5.4",
"symfony/runtime": "5.4.*",
"vimeo/psalm": "^4.13"
},
"config": {
Expand Down
1 change: 0 additions & 1 deletion config/bundles.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
Symfony\Bundle\FrameworkBundle\FrameworkBundle::class => ['all' => true],
Symfony\Bundle\TwigBundle\TwigBundle::class => ['all' => true],
Symfony\Bundle\MonologBundle\MonologBundle::class => ['all' => true],
Symfony\Bundle\SwiftmailerBundle\SwiftmailerBundle::class => ['all' => true],
Sulu\Bundle\CoreBundle\SuluCoreBundle::class => ['all' => true],
Doctrine\Bundle\DoctrineBundle\DoctrineBundle::class => ['all' => true],
Doctrine\Bundle\FixturesBundle\DoctrineFixturesBundle::class => ['dev' => true, 'test' => true],
Expand Down
8 changes: 1 addition & 7 deletions config/packages/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ sulu_document_manager:
workspace: "workspace_live"

security:
encoders:
password_hashers:
Sulu\Bundle\SecurityBundle\Entity\User: bcrypt
providers:
sulu:
Expand All @@ -56,17 +56,14 @@ security:
firewalls:
admin:
pattern: ^/admin(\/|$)
anonymous: true
lazy: true
provider: sulu
entry_point: sulu_security.authentication_entry_point
json_login:
check_path: sulu_admin.login_check
success_handler: sulu_security.authentication_handler
failure_handler: sulu_security.authentication_handler
logout:
path: sulu_admin.logout
success_handler: sulu_security.logout_success_handler
sulu_security:
checker:
enabled: true
Expand All @@ -85,6 +82,3 @@ monolog:
path: "php://stderr"
level: warning
channels: ["!event","!console"]

swiftmailer:
disable_delivery: true
2 changes: 1 addition & 1 deletion doc/development.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
For local development you can use docker-compose.
```bash
docker-compose up -d
docker-compose exec php bash
docker-compose run php sh
composer install
bin/console sulu:build dev -n
bin/console sulu:document:init
Expand Down
4 changes: 2 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ services:
ES_JAVA_OPTS: "-Xms1g -Xmx1g"

php:
image: hgiesenow/php:7.4
image: ghcr.io/elbformat/sulu-behat-bundle/php
environment:
DATABASE_URL: 'mysql://test:test@mysql:3306/test'
DATABASE_URL: 'mysql://test:test@mysql:3306/test?serverVersion=mariadb-10.6.15'
ELASTICSEARCH_HOST: 'elasticsearch:9200'

depends_on:
Expand Down
43 changes: 43 additions & 0 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
FROM hgiesenow/php:8.1
LABEL org.opencontainers.image.source="https://github.com/elbformat/sulu-behat-bundle"

# For debugging
RUN apk add --no-cache --virtual .build-deps autoconf g++ make linux-headers &&\
pecl install xdebug-3.2.0 && \
apk del .build-deps && \
rm -rf /tmp/*

# ext-intl
RUN apk add --no-cache icu icu-data-full && \
apk add --no-cache --virtual .build-deps icu-dev && \
docker-php-ext-install intl && \
apk del .build-deps && \
rm -rf /tmp/*

# ext-gd
RUN apk add --no-cache libpng libjpeg-turbo freetype && \
apk add --no-cache --virtual .build-deps libpng-dev libjpeg-turbo-dev freetype-dev && \
docker-php-ext-configure gd && \
docker-php-ext-install gd && \
apk del .build-deps && \
rm -rf /tmp/*

# xdebug
RUN apk add --no-cache --virtual .build-deps autoconf g++ make linux-headers && \
pecl install xdebug-3.2.1 && \
docker-php-ext-enable xdebug && \
apk del .build-deps && \
rm -rf /tmp/*

# Database connection (for integration tests)
RUN docker-php-ext-install pdo pdo_mysql

# For codecov upload inside circleci
RUN apk add gpg gpg-agent gpgv

COPY --from=composer:2 /usr/bin/composer /usr/local/bin/composer
ENV COMPOSER_MEMORY_LIMIT=-1

COPY php.ini /usr/local/etc/php/conf.d/

WORKDIR /var/www
3 changes: 3 additions & 0 deletions docker/php.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
memory_limit = -1
error_reporting = E_COMPILE_ERROR|E_RECOVERABLE_ERROR|E_ERROR|E_CORE_ERROR
display_errors = Off
6 changes: 0 additions & 6 deletions features/logging.feature

This file was deleted.

4 changes: 2 additions & 2 deletions src/Context/BrowserContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@

namespace Elbformat\SuluBehatBundle\Context;

use Elbformat\SymfonyBehatBundle\Context\BrowserContext as SymfonyBrowserContext;
use Elbformat\SymfonyBehatBundle\Context\HttpContext;
use Symfony\Component\HttpFoundation\Request;

/**
* @author Hannes Giesenow <[email protected]>
*/
class BrowserContext extends SymfonyBrowserContext
class BrowserContext extends HttpContext
{
/**
* @Given I am logged in as admin
Expand Down
2 changes: 1 addition & 1 deletion src/Resources/config/services.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ services:
- '../../Context/SuluFormContext.php'

Elbformat\SuluBehatBundle\Context\BrowserContext:
parent: Elbformat\SymfonyBehatBundle\Context\BrowserContext
parent: Elbformat\SymfonyBehatBundle\Context\HttpContext

Elbformat\SuluBehatBundle\Context\SuluMediaContext:
arguments:
Expand Down
2 changes: 1 addition & 1 deletion tests/BundleTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public function testBuild(): void
{
$bundle = new ElbformatSuluBehatBundle();
$container = $this->createMock(ContainerBuilder::class);
// $container->expects($this->once())->method('addCompilerPass')->with($this->isInstanceOf(DynamicServicesPass::class))->willReturn(null);
// $container->expects($this->once())->method('addCompilerPass')->with($this->isInstanceOf(DynamicServicesPass::class))->willReturn(null);
$bundle->build($container);
}
}

0 comments on commit bc9a1d1

Please sign in to comment.