Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added support for Symfony 7.x #19

Merged
merged 1 commit into from
Jul 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
ARG PHP_VERSION

FROM php:${PHP_VERSION}-cli-alpine AS php

WORKDIR /app

RUN set -eux; \
apk add --no-cache --virtual .build-deps \
$PHPIZE_DEPS \
linux-headers \
; \
\
pecl install xdebug; \
docker-php-ext-enable xdebug; \
pecl clear-cache; \
runDeps="$( \
scanelf --needed --nobanner --format '%n#p' --recursive /usr/local/lib/php/extensions \
| tr ',' '\n' \
| sort -u \
| awk 'system("[ -e /usr/local/lib/" $1 " ]") == 0 { next } { print "so:" $1 }' \
)"; \
apk add --no-cache --virtual .app-phpexts-rundeps $runDeps; \
\
apk del .build-deps


# https://getcomposer.org/doc/03-cli.md#composer-allow-superuser
ENV COMPOSER_ALLOW_SUPERUSER=1
ENV PATH="${PATH}:/root/.composer/vendor/bin"

COPY --from=composer/composer:2-bin --link /composer /usr/bin/composer
36 changes: 36 additions & 0 deletions compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
x-params:
- &common
environment:
XDEBUG_MODE: coverage
volumes:
- ./:/app
command:
- sh
- -c
- 'rm -f composer.lock && rm -rf tests/Bundle/App/var/cache && composer install && vendor/bin/simple-phpunit --coverage-text'

# To run test just exec e.g. 'docker compose run --rm php8.1'
services:
php8.1:
build:
context: .
target: php
args:
PHP_VERSION: 8.1
<<: *common

php8.2:
build:
context: .
target: php
args:
PHP_VERSION: 8.2
<<: *common

php8.3:
build:
context: .
target: php
args:
PHP_VERSION: 8.3
<<: *common
10 changes: 5 additions & 5 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@
],
"require": {
"php": ">=7.4",
"symfony/dependency-injection": "^4.4|^5.0|^6.0"
"symfony/dependency-injection": "^4.4|^5.0|^6.0|^7.0"
},
"require-dev": {
"symfony/framework-bundle": "^4.4|^5.0|^6.0",
"symfony/phpunit-bridge": "^4.4|^5.0|^6.0",
"symfony/browser-kit": "^4.4|^5.0|^6.0",
"symfony/yaml": "^4.4|^5.0|^6.0"
"symfony/framework-bundle": "^4.4|^5.0|^6.0|^7.0",
"symfony/phpunit-bridge": "^4.4|^5.0|^6.0|^7.0",
"symfony/browser-kit": "^4.4|^5.0|^6.0|^7.0",
"symfony/yaml": "^4.4|^5.0|^6.0|^7.0"
},
"autoload": {
"psr-4": { "PrismaMedia\\Metrics\\": "src/" }
Expand Down
2 changes: 1 addition & 1 deletion tests/MetricAggregatorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,6 @@ public function getMetrics(): iterable
$metrics = $aggregator->getMetrics();

$this->assertInstanceOf(\Generator::class, $metrics);
$this->assertCount(3, $metrics);
$this->assertEquals(3, iterator_count($metrics));
}
}
2 changes: 1 addition & 1 deletion tests/MetricLabellerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public function getMetrics(): \Traversable
$labeller = new MetricLabeller($metrics, ['env' => 'staging']);

$this->assertInstanceOf(\Generator::class, $labeller->getMetrics());
$this->assertCount(3, $labeller->getMetrics());
$this->assertEquals(3, iterator_count($labeller->getMetrics()));
$metrics = iterator_to_array($labeller->getMetrics());

$this->assertSame('article_total', $metrics[0]->getName());
Expand Down
17 changes: 16 additions & 1 deletion tests/allowed.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,20 @@
"location": "PrismaMedia\\Metrics\\Tests\\Bundle\\FunctionalTest::testEndpointMetrics",
"message": "Since symfony/framework-bundle 5.1: Not setting the \"framework.router.utf8\" configuration option is deprecated, it will default to \"true\" in version 6.0.",
"count": 1
},
{
"location": "PrismaMedia\\Metrics\\Tests\\Bundle\\FunctionalTest::testEndpointMetrics",
"message": "Since symfony/framework-bundle 6.1: Not setting the \"framework.http_method_override\" config option is deprecated. It will default to \"false\" in 7.0.",
"count": 2
},
{
"location": "PrismaMedia\\Metrics\\Tests\\Bundle\\FunctionalTest::testEndpointMetrics",
"message": "Since symfony/framework-bundle 6.4: Not setting the \"framework.handle_all_throwables\" config option is deprecated. It will default to \"true\" in 7.0.",
"count": 2
},
{
"location": "PrismaMedia\\Metrics\\Tests\\Bundle\\FunctionalTest::testEndpointMetrics",
"message": "Since symfony/framework-bundle 6.4: Not setting the \"framework.php_errors.log\" config option is deprecated. It will default to \"true\" in 7.0.",
"count": 2
}
]
]
Loading