Skip to content

Commit 3180c7b

Browse files
authored
Move providers to new namespace (geocoder-php#604)
* Started to move providers to new namespace * Moved all providers and tests to a new folder * Updated composer json * Moved around the GeoIP2Adapter * Added changelog * Added more composer.json files * minor fixes * Namespace local (geocoder-php#1) * fix * bugfix * Make sure we run tests for common * tests * debug * Added some config * Updated path to phpunit * debug * debub * added phpunit file * minor * Fixed to get phpunit-bridge to work * Do not use simple-phpunit * Fixed broken tests * Fixed broken tests * Use curl-client and guzzlehttp/psr7: ^1.4 * Remove Guzzle * Require latest version of CurlClient * Updated style config * Style fix * Namespace patch 1 (geocoder-php#2) * Make sure tests run * Use Curl * Renamed cached files
1 parent a85f3e8 commit 3180c7b

354 files changed

Lines changed: 1698 additions & 3773 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.styleci.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,4 @@ enabled:
1010

1111
disabled:
1212
- phpdoc_annotation_without_dot # This is still buggy: https://github.com/symfony/symfony/pull/19198
13+
- phpdoc_summary # Currenly some issues 2017-05-13

.travis.yml

Lines changed: 73 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,89 @@
1+
language: php
12
sudo: false
23

34
addons:
4-
apt:
5-
packages:
6-
- libgeoip-dev
7-
8-
language: php
5+
apt_packages:
6+
- parallel
7+
- libgeoip-dev
98

109
env:
1110
global:
12-
- deps=""
13-
14-
php:
15-
- 5.5
16-
- 5.6
17-
- 7.0
18-
- 7.1
19-
- hhvm
11+
- MIN_PHP=5.5.9
2012

2113
matrix:
2214
fast_finish: true
2315
include:
2416
- php: 5.5
2517
env: deps="low"
18+
- php: 5.5
19+
- php: 5.6
20+
- php: 7.0
21+
- php: 7.1
22+
- php: hhvm
2623

27-
before_script:
24+
before_install:
2825
- if [ "$TRAVIS_PHP_VERSION" != "hhvm" && "$TRAVIS_PHP_VERSION" != "7.0" ]; then pecl install geoip; fi
29-
- composer self-update
30-
- if [ "$deps" = "low" ]; then composer update --prefer-dist --prefer-lowest; fi
31-
- if [ "$deps" = "" ]; then composer install --prefer-dist --no-interaction; fi
3226
- if [ "$TRAVIS_PHP_VERSION" == "7.0" ]; then composer require "geoip/geoip"; fi
27+
- |
28+
# General configuration
29+
stty cols 120
30+
PHP=$TRAVIS_PHP_VERSION
31+
[ -d ~/.composer ] || mkdir ~/.composer
32+
export PHPUNIT=$(readlink -f ./phpunit)
33+
export PHPUNIT_X="$PHPUNIT --exclude-group benchmark"
34+
export COMPOSER_UP='composer update --no-progress --no-suggest --ansi'
35+
36+
# tfold is a helper to create folded reports
37+
tfold () {
38+
title=$1
39+
fold=$(echo $title | sed -r 's/[^-_A-Za-z\d]+/./g')
40+
shift
41+
echo -e "travis_fold:start:$fold\\n\\e[1;34m$title\\e[0m"
42+
bash -xc "$*" 2>&1 &&
43+
echo -e "\\e[32mOK\\e[0m $title\\n\\ntravis_fold:end:$fold" ||
44+
( echo -e "\\e[41mKO\\e[0m $title\\n" && exit 1 )
45+
}
46+
export -f tfold
47+
48+
# Matrix lines for intermediate PHP versions are skipped for pull requests
49+
if [[ ! $deps && ! $PHP = ${MIN_PHP%.*} && ! $PHP = hhvm* && $TRAVIS_PULL_REQUEST != false ]]; then
50+
deps=skip
51+
skip=1
52+
else
53+
COMPONENTS=$(find src -mindepth 2 -type f -name phpunit.xml.dist -printf '%h\n')
54+
fi
55+
56+
# php.ini configuration
57+
if [[ $PHP = hhvm* ]]; then
58+
INI=/etc/hhvm/php.ini
59+
else
60+
INI=~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/travis.ini
61+
phpenv config-rm xdebug.ini || echo "xdebug not available"
62+
fi
63+
echo memory_limit = -1 >> $INI
64+
65+
install:
66+
- if [[ ! $skip ]]; then $COMPOSER_UP; fi
67+
- |
68+
run_tests () {
69+
set -e
70+
if [[ $skip ]]; then
71+
echo -e "\\n\\e[1;34mIntermediate PHP version $PHP is skipped for pull requests.\\e[0m"
72+
elif [[ $deps = high ]]; then
73+
echo "$COMPONENTS" | parallel --gnu -j10% "tfold {} 'cd {} && $COMPOSER_UP && $PHPUNIT_X$LEGACY'"
74+
elif [[ $deps = low ]]; then
75+
echo "$COMPONENTS" | parallel --gnu -j10% "tfold {} 'cd {} && $COMPOSER_UP --prefer-lowest --prefer-stable && $PHPUNIT_X'" &&
76+
# Test the PhpUnit bridge on PHP 5.5, using the original phpunit script
77+
tfold src/Symfony/Bridge/PhpUnit \
78+
"cd src/Symfony/Bridge/PhpUnit && wget https://phar.phpunit.de/phpunit-4.8.phar && phpenv global 5.3 && composer update --no-progress --ansi && php phpunit-4.8.phar"
79+
elif [[ $PHP = hhvm* ]]; then
80+
$PHPUNIT --exclude-group benchmark,intl-data
81+
else
82+
echo "$COMPONENTS" | parallel --gnu "tfold {} $PHPUNIT_X {}"
83+
tfold tty-group $PHPUNIT --group tty
84+
fi
85+
}
86+
87+
script:
88+
- (run_tests)
3389

34-
script: ./vendor/bin/phpunit --coverage-text

CHANGELOG.md

Lines changed: 1 addition & 0 deletions

composer.json

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,14 @@
2121
"php-http/discovery": "^1.0"
2222
},
2323
"require-dev": {
24-
"phpunit/phpunit": "^4.8",
24+
"phpunit/phpunit": "^4.8 || ^5.4",
25+
"symfony/phpunit-bridge": "^3.2",
2526
"geoip2/geoip2": "~2.0",
2627
"symfony/stopwatch": "~2.5",
2728
"php-http/message": "^1.0",
28-
"php-http/guzzle6-adapter": "^1.0",
29-
"php-http/mock-client": "^0.3.0"
29+
"php-http/curl-client": "^1.7",
30+
"php-http/mock-client": "^0.3.0",
31+
"guzzlehttp/psr7": "^1.4"
3032
},
3133
"suggest": {
3234
"ext-geoip": "Enabling the geoip extension allows you to use the MaxMindProvider.",
@@ -35,7 +37,9 @@
3537
"symfony/stopwatch": "If you want to use the TimedGeocoder"
3638
},
3739
"autoload": {
38-
"psr-4": { "Geocoder\\": "src/" }
40+
"psr-4": {
41+
"Geocoder\\": ["src/Common", "src/"]
42+
}
3943
},
4044
"autoload-dev": {
4145
"psr-4": { "Geocoder\\Tests\\": "tests/" }

phpunit

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#!/usr/bin/env php
2+
<?php
3+
4+
if (!file_exists(__DIR__.'/vendor/phpunit/phpunit/phpunit')) {
5+
echo "Unable to find the `PHPUnit` script in `vendor/phpunit/phpunit/`.\nPlease run `composer update` before running this command.\n";
6+
exit(1);
7+
}
8+
9+
require __DIR__.'/vendor/phpunit/phpunit/phpunit';

phpunit.xml.dist

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,28 @@
3030
<!-- <server name="MAXMIND_API_KEY" value="YOUR_API_KEY" /> -->
3131
<!-- <server name="IPINFODB_API_KEY" value="YOUR_API_KEY" /> -->
3232
</php>
33+
3334
<testsuites>
3435
<testsuite name="Geocoder Test Suite">
3536
<directory>./tests/</directory>
37+
<directory>./src/Common/Tests/</directory>
38+
<directory>./src/Provider/*/Tests/</directory>
3639
</testsuite>
3740
</testsuites>
41+
3842
<filter>
3943
<whitelist>
4044
<directory>./src/</directory>
45+
<exclude>
46+
<directory>./src/Common/Tests</directory>
47+
<directory>./src/Provider/*/Tests</directory>
48+
<directory>./src/Common/vendor</directory>
49+
<directory>./src/Provider/*/vendor</directory>
50+
</exclude>
4151
</whitelist>
4252
</filter>
53+
54+
<listeners>
55+
<listener class="Symfony\Bridge\PhpUnit\SymfonyTestsListener" />
56+
</listeners>
4357
</phpunit>
File renamed without changes.

0 commit comments

Comments
 (0)