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

Fix tests #350

Merged
merged 1 commit into from
Jan 30, 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
186 changes: 93 additions & 93 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,109 +1,109 @@
name: CI
on: [push, pull_request]
on: [ push, pull_request ]

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

jobs:
phpstan:
name: PHPStan
runs-on: ubuntu-latest
env:
php-version: 8.2
steps:
- name: "Setup PHP"
uses: shivammathur/setup-php@v2
with:
php-version: ${{ env.php-version }}
tools: flex
phpstan:
name: PHPStan
runs-on: ubuntu-latest
env:
php-version: 8.2
steps:
- name: "Setup PHP"
uses: shivammathur/setup-php@v2
with:
php-version: ${{ env.php-version }}
tools: flex

- name: "Checkout code"
uses: actions/checkout@v4
- name: "Checkout code"
uses: actions/checkout@v4

- name: "Install Composer dependencies"
uses: "ramsey/composer-install@v2"
with:
composer-options: "--optimize-autoloader"
- name: "Install Composer dependencies"
uses: "ramsey/composer-install@v2"
with:
composer-options: "--optimize-autoloader"

- name: "Run PHPStan"
run: |
vendor/bin/simple-phpunit --version
vendor/bin/phpstan analyse --no-progress
- name: "Run PHPStan"
run: |
vendor/bin/simple-phpunit --version
vendor/bin/phpstan analyse --no-progress

php-cs-fixer:
name: PHP-CS-Fixer
runs-on: ubuntu-latest
env:
php-version: 8.2
steps:
- name: "Setup PHP"
uses: shivammathur/setup-php@v2
with:
php-version: ${{ env.php-version }}
tools: flex, cs2pr
php-cs-fixer:
name: PHP-CS-Fixer
runs-on: ubuntu-latest
env:
php-version: 8.2
steps:
- name: "Setup PHP"
uses: shivammathur/setup-php@v2
with:
php-version: ${{ env.php-version }}
tools: flex, cs2pr

- name: "Checkout code"
uses: actions/checkout@v4
- name: "Checkout code"
uses: actions/checkout@v4

- name: "Install Composer dependencies"
uses: "ramsey/composer-install@v2"
with:
composer-options: "--optimize-autoloader"
- name: "Install Composer dependencies"
uses: "ramsey/composer-install@v2"
with:
composer-options: "--optimize-autoloader"

- name: "Run PHP-CS-Fixer"
run: vendor/bin/php-cs-fixer fix -v --dry-run --using-cache=no --format=checkstyle | cs2pr
- name: "Run PHP-CS-Fixer"
run: vendor/bin/php-cs-fixer fix -v --dry-run --using-cache=no --format=checkstyle | cs2pr

phpunit:
name: PHPUnit (PHP ${{ matrix.php }}) (Symfony ${{ matrix.sf_version }}) (${{ matrix.dependencies }})
runs-on: ubuntu-latest
strategy:
max-parallel: 10
fail-fast: true
matrix:
dependencies: ['highest']
php: ['7.4', '8.0', '8.1', '8.2']
include:
- php: '7.4'
sf_version: '4.4.*'
dependencies: 'lowest'
- php: '7.4'
sf_version: '4.4.*'
- php: '7.4'
sf_version: '5.4.*'
dependencies: 'lowest'
- php: '8.0'
sf_version: '5.4.*'
- php: '8.1'
sf_version: '5.4.*'
- php: '8.0'
sf_version: '6.0.*'
- php: '8.1'
sf_version: '6.0.*'
- php: '8.2'
sf_version: '6.2.*'
- php: '8.2'
sf_version: '6.4.*'
- php: '8.2'
sf_version: '7.0.*'
steps:
- name: "Setup PHP"
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
tools: flex
coverage: none
phpunit:
name: PHPUnit (PHP ${{ matrix.php }}) (Symfony ${{ matrix.sf_version }}) (${{ matrix.dependencies }})
runs-on: ubuntu-latest
strategy:
max-parallel: 10
fail-fast: false
matrix:
dependencies: ['highest']
php: [ '7.4', '8.0', '8.1', '8.2' ]
sf_version: [ '4.4.*', '5.4.*', '6.4.*', '7.0.*' ]
include:
- php: '7.4'
sf_version: '4.4.*'
dependencies: 'lowest'
- php: '7.4'
sf_version: '5.4.*'
dependencies: 'lowest'
exclude:
- php: '7.4'
sf_version: '4.4.*'
- php: '7.4'
sf_version: '6.4.*'
- php: '8.0'
sf_version: '6.4.*'
- php: '7.4'
sf_version: '7.0.*'
- php: '8.0'
sf_version: '7.0.*'
- php: '8.1'
sf_version: '7.0.*'
steps:
- name: "Checkout code"
uses: actions/checkout@v4

- name: "Checkout code"
uses: actions/checkout@v4
- name: "Setup PHP"
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
tools: flex
coverage: none

- name: "Install Composer dependencies"
uses: "ramsey/composer-install@v2"
with:
composer-options: "--optimize-autoloader"
dependency-versions: "${{ matrix.dependencies }}"
- name: "Install Composer dependencies"
env:
SYMFONY_REQUIRE: ${{ matrix.sf_version }}
uses: "ramsey/composer-install@v2"
with:
composer-options: "--optimize-autoloader"
dependency-versions: "${{ matrix.dependencies }}"

- name: "Run tests"
env:
SYMFONY_DEPRECATIONS_HELPER: 'max[self]=3&max[indirect]=1'
run: ./vendor/bin/simple-phpunit -v
- name: "Run tests"
env:
SYMFONY_DEPRECATIONS_HELPER: 'baselineFile=./tests/allowed.json'
run: ./vendor/bin/simple-phpunit -v
21 changes: 13 additions & 8 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
{
"name": "willdurand/geocoder-bundle",
"description": "Integration of Geocoder into Symfony",
"keywords": ["geocoding", "geocoder"],
"keywords": [
"geocoding",
"geocoder"
],
"type": "symfony-bundle",
"license": "MIT",
"authors": [
Expand All @@ -15,17 +18,17 @@
"geocoder-php/plugin": "^1.5",
"php-http/curl-client": "^2.3",
"php-http/discovery": "^1.14",
"symfony/console": "^4.4 || ^5.0 || ^6.0 || ^7.0",
"symfony/framework-bundle": "^4.4 || ^5.0 || ^6.0 || ^7.0",
"symfony/options-resolver": "^4.4 || ^5.0 || ^6.0 || ^7.0",
"symfony/console": "^4.4 || ^5.4 || ^6.4 || ^7.0",
"symfony/framework-bundle": "^4.4 || ^5.4 || ^6.4 || ^7.0",
"symfony/options-resolver": "^4.4 || ^5.4 || ^6.4 || ^7.0",
"willdurand/geocoder": "^4.6"
},
"require-dev": {
"doctrine/annotations": "^1.11.1 || ^2.0",
"doctrine/doctrine-bundle": "^2.3",
"doctrine/orm": "~2.8",
"doctrine/orm": "^2.8",
"fakerphp/faker": "^1.20",
"friendsofphp/php-cs-fixer": "^3.13",
"friendsofphp/php-cs-fixer": "^3.0",
"geocoder-php/algolia-places-provider": "^0.4",
"geocoder-php/arcgis-online-provider": "^4.4",
"geocoder-php/bing-maps-provider": "^4.3",
Expand Down Expand Up @@ -58,15 +61,17 @@
"geoip/geoip": "~1.17",
"nyholm/nsa": "^1.3",
"nyholm/psr7": "^1.5",
"nyholm/symfony-bundle-test": "dev-master",
"php-http/mock-client": "^1.6",
"nyholm/symfony-bundle-test": "^2.0 || ^3.0",
"php-http/message": "^1.13",
"php-http/mock-client": "^1.6",
"phpstan/phpstan": "^1.9.2",
"psr/http-client": "^1.0",
"psr/simple-cache": "^1.0 || ^2.0",
"symfony/cache": "^4.4 || ^5.0 || ^6.0 || ^7.0",
"symfony/config": "^4.4 || ^5.0 || ^6.0 || ^7.0",
"symfony/phpunit-bridge": "^5.2 || ^6.0 || ^7.0",
"symfony/validator": "^4.4 || ^5.0 || ^6.0 || ^7.0",
"symfony/var-exporter": "^5.0 || ^6.0 || ^7.0",
"symfony/yaml": "^4.4 || ^5.0 || ^6.0 || ^7.0"
},
"conflict": {
Expand Down
14 changes: 2 additions & 12 deletions phpstan-baseline.neon
Original file line number Diff line number Diff line change
Expand Up @@ -121,12 +121,12 @@ parameters:
path: src/DependencyInjection/BazingaGeocoderExtension.php

-
message: "#^Cannot call method end\\(\\) on Symfony\\\\Component\\\\Config\\\\Definition\\\\Builder\\\\NodeParentInterface\\|null\\.$#"
message: "#^Call to an undefined method Symfony\\\\Component\\\\Config\\\\Definition\\\\Builder\\\\NodeParentInterface\\:\\:end\\(\\)\\.$#"
count: 2
path: src/DependencyInjection/Configuration.php

-
message: "#^Cannot call method variableNode\\(\\) on Symfony\\\\Component\\\\Config\\\\Definition\\\\Builder\\\\NodeParentInterface\\|null\\.$#"
message: "#^Call to an undefined method Symfony\\\\Component\\\\Config\\\\Definition\\\\Builder\\\\NodeParentInterface\\:\\:variableNode\\(\\)\\.$#"
count: 1
path: src/DependencyInjection/Configuration.php

Expand All @@ -140,11 +140,6 @@ parameters:
count: 1
path: src/Doctrine/ORM/GeocoderListener.php

-
message: "#^Method Bazinga\\\\GeocoderBundle\\\\Plugin\\\\FakeIpPlugin\\:\\:handleQuery\\(\\) return type with generic interface Http\\\\Promise\\\\Promise does not specify its types\\: T$#"
count: 1
path: src/Plugin/FakeIpPlugin.php

-
message: "#^Parameter \\#1 \\$text of method Geocoder\\\\Query\\\\GeocodeQuery\\:\\:withText\\(\\) expects string, string\\|null given\\.$#"
count: 1
Expand All @@ -155,11 +150,6 @@ parameters:
count: 1
path: src/Plugin/FakeIpPlugin.php

-
message: "#^Method Bazinga\\\\GeocoderBundle\\\\Plugin\\\\ProfilingPlugin\\:\\:handleQuery\\(\\) return type with generic interface Http\\\\Promise\\\\Promise does not specify its types\\: T$#"
count: 1
path: src/Plugin/ProfilingPlugin.php

-
message: "#^Parameter \\#1 \\$accountId of class GeoIp2\\\\WebService\\\\Client constructor expects int, int\\|null given\\.$#"
count: 1
Expand Down
35 changes: 19 additions & 16 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,28 +1,31 @@
<?xml version="1.0" encoding="UTF-8"?>

<phpunit backupGlobals="false"
backupStaticAttributes="false"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false"
bootstrap="tests/bootstrap.php"
<phpunit
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
backupGlobals="false"
backupStaticAttributes="false"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false"
bootstrap="tests/bootstrap.php"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.6/phpunit.xsd"
>
<coverage>
<include>
<directory>src</directory>
</include>
</coverage>

<testsuites>
<testsuite name="main">
<directory>./tests</directory>
</testsuite>
</testsuites>

<filter>
<whitelist>
<directory>src</directory>
</whitelist>
</filter>

<listeners>
<listener class="Symfony\Bridge\PhpUnit\SymfonyTestsListener" />
<listener class="Symfony\Bridge\PhpUnit\SymfonyTestsListener"/>
</listeners>
</phpunit>
1 change: 0 additions & 1 deletion src/Validator/Constraint/Address.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@

/**
* @Annotation
*
* @Target({"PROPERTY", "METHOD", "ANNOTATION"})
*
* @author Tomas Norkūnas <[email protected]>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ protected function tearDown(): void
$reflection = new \ReflectionObject($this->compilerPass);
$prop = $reflection->getProperty('factoryServiceIds');
$prop->setAccessible(true);
$prop->setValue([]);
$prop->setValue(null, []);
}

public function testProcessThrows(): void
Expand Down
Loading
Loading