Permalink
Browse files

Move providers to new namespace (#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 (#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 (#2)

* Make sure tests run

* Use Curl

* Renamed cached files
  • Loading branch information...
Nyholm committed May 13, 2017
1 parent a85f3e8 commit 3180c7b61c6cf69d482765adfee671a516f938ad
Showing 354 changed files with 1,698 additions and 3,773 deletions.
@@ -10,3 +10,4 @@ enabled:
disabled:
- phpdoc_annotation_without_dot # This is still buggy: https://github.com/symfony/symfony/pull/19198
- phpdoc_summary # Currenly some issues 2017-05-13
@@ -1,34 +1,89 @@
language: php
sudo: false
addons:
apt:
packages:
- libgeoip-dev
language: php
apt_packages:
- parallel
- libgeoip-dev
env:
global:
- deps=""
php:
- 5.5
- 5.6
- 7.0
- 7.1
- hhvm
- MIN_PHP=5.5.9
matrix:
fast_finish: true
include:
- php: 5.5
env: deps="low"
- php: 5.5
- php: 5.6
- php: 7.0
- php: 7.1
- php: hhvm
before_script:
before_install:
- if [ "$TRAVIS_PHP_VERSION" != "hhvm" && "$TRAVIS_PHP_VERSION" != "7.0" ]; then pecl install geoip; fi
- composer self-update
- if [ "$deps" = "low" ]; then composer update --prefer-dist --prefer-lowest; fi
- if [ "$deps" = "" ]; then composer install --prefer-dist --no-interaction; fi
- if [ "$TRAVIS_PHP_VERSION" == "7.0" ]; then composer require "geoip/geoip"; fi
- |
# General configuration
stty cols 120
PHP=$TRAVIS_PHP_VERSION
[ -d ~/.composer ] || mkdir ~/.composer
export PHPUNIT=$(readlink -f ./phpunit)
export PHPUNIT_X="$PHPUNIT --exclude-group benchmark"
export COMPOSER_UP='composer update --no-progress --no-suggest --ansi'
# tfold is a helper to create folded reports
tfold () {
title=$1
fold=$(echo $title | sed -r 's/[^-_A-Za-z\d]+/./g')
shift
echo -e "travis_fold:start:$fold\\n\\e[1;34m$title\\e[0m"
bash -xc "$*" 2>&1 &&
echo -e "\\e[32mOK\\e[0m $title\\n\\ntravis_fold:end:$fold" ||
( echo -e "\\e[41mKO\\e[0m $title\\n" && exit 1 )
}
export -f tfold
# Matrix lines for intermediate PHP versions are skipped for pull requests
if [[ ! $deps && ! $PHP = ${MIN_PHP%.*} && ! $PHP = hhvm* && $TRAVIS_PULL_REQUEST != false ]]; then
deps=skip
skip=1
else
COMPONENTS=$(find src -mindepth 2 -type f -name phpunit.xml.dist -printf '%h\n')
fi
# php.ini configuration
if [[ $PHP = hhvm* ]]; then
INI=/etc/hhvm/php.ini
else
INI=~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/travis.ini
phpenv config-rm xdebug.ini || echo "xdebug not available"
fi
echo memory_limit = -1 >> $INI
install:
- if [[ ! $skip ]]; then $COMPOSER_UP; fi
- |
run_tests () {
set -e
if [[ $skip ]]; then
echo -e "\\n\\e[1;34mIntermediate PHP version $PHP is skipped for pull requests.\\e[0m"
elif [[ $deps = high ]]; then
echo "$COMPONENTS" | parallel --gnu -j10% "tfold {} 'cd {} && $COMPOSER_UP && $PHPUNIT_X$LEGACY'"
elif [[ $deps = low ]]; then
echo "$COMPONENTS" | parallel --gnu -j10% "tfold {} 'cd {} && $COMPOSER_UP --prefer-lowest --prefer-stable && $PHPUNIT_X'" &&
# Test the PhpUnit bridge on PHP 5.5, using the original phpunit script
tfold src/Symfony/Bridge/PhpUnit \
"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"
elif [[ $PHP = hhvm* ]]; then
$PHPUNIT --exclude-group benchmark,intl-data
else
echo "$COMPONENTS" | parallel --gnu "tfold {} $PHPUNIT_X {}"
tfold tty-group $PHPUNIT --group tty
fi
}
script:
- (run_tests)
script: ./vendor/bin/phpunit --coverage-text
@@ -6,6 +6,7 @@ CHANGELOG
* Introduced `GeocodeQuery` and `ReverseQuery`.
* `Provider` and `Geocoder` interfaces has been updated to use query objects
* All providers are stateless and immutable.
* Moved **all** providers to new namespaces. Previous `Geocoder\Provider\BingMaps` is now located at `Geocoder\Provider\BingMaps\BingMaps`
* Added: Interface for `Geocoder\Model\AddressCollection` called `Geocoder\Collection`. Public APIs are updated to type hint for `Geocoder\GeocoderResult`.
* Added: Interface for `Geocoder\Model\Address` called `Geocoder\Location`. Public APIs are updated to type hint for `Geocoder\Location`.
* Added: GeoArray dumper
@@ -21,12 +21,14 @@
"php-http/discovery": "^1.0"
},
"require-dev": {
"phpunit/phpunit": "^4.8",
"phpunit/phpunit": "^4.8 || ^5.4",
"symfony/phpunit-bridge": "^3.2",
"geoip2/geoip2": "~2.0",
"symfony/stopwatch": "~2.5",
"php-http/message": "^1.0",
"php-http/guzzle6-adapter": "^1.0",
"php-http/mock-client": "^0.3.0"
"php-http/curl-client": "^1.7",
"php-http/mock-client": "^0.3.0",
"guzzlehttp/psr7": "^1.4"
},
"suggest": {
"ext-geoip": "Enabling the geoip extension allows you to use the MaxMindProvider.",
@@ -35,7 +37,9 @@
"symfony/stopwatch": "If you want to use the TimedGeocoder"
},
"autoload": {
"psr-4": { "Geocoder\\": "src/" }
"psr-4": {
"Geocoder\\": ["src/Common", "src/"]
}
},
"autoload-dev": {
"psr-4": { "Geocoder\\Tests\\": "tests/" }
@@ -0,0 +1,9 @@
#!/usr/bin/env php
<?php
if (!file_exists(__DIR__.'/vendor/phpunit/phpunit/phpunit')) {
echo "Unable to find the `PHPUnit` script in `vendor/phpunit/phpunit/`.\nPlease run `composer update` before running this command.\n";
exit(1);
}
require __DIR__.'/vendor/phpunit/phpunit/phpunit';
@@ -30,14 +30,28 @@
<!-- <server name="MAXMIND_API_KEY" value="YOUR_API_KEY" /> -->
<!-- <server name="IPINFODB_API_KEY" value="YOUR_API_KEY" /> -->
</php>
<testsuites>
<testsuite name="Geocoder Test Suite">
<directory>./tests/</directory>
<directory>./src/Common/Tests/</directory>
<directory>./src/Provider/*/Tests/</directory>
</testsuite>
</testsuites>
<filter>
<whitelist>
<directory>./src/</directory>
<exclude>
<directory>./src/Common/Tests</directory>
<directory>./src/Provider/*/Tests</directory>
<directory>./src/Common/vendor</directory>
<directory>./src/Provider/*/vendor</directory>
</exclude>
</whitelist>
</filter>
<listeners>
<listener class="Symfony\Bridge\PhpUnit\SymfonyTestsListener" />
</listeners>
</phpunit>
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -34,7 +34,7 @@ class TimedGeocoderTest extends TestCase
protected function setUp()
{
$this->stopwatch = new Stopwatch();
$this->delegate = $this->getMock(Provider::class);
$this->delegate = $this->getMockBuilder(Provider::class)->getMock();
$this->geocoder = new TimedGeocoder($this->delegate, $this->stopwatch);
}
File renamed without changes.
@@ -0,0 +1,47 @@
{
"name": "willdurand/geocoder",
"type": "library",
"description": "Common files for PHP Geocoder",
"keywords": ["geocoder", "geocoding", "abstraction", "geoip"],
"homepage": "http://geocoder-php.org",
"license": "MIT",
"authors": [
{
"name": "William Durand",
"email": "william.durand1@gmail.com"
}
],
"require": {
"php": "^5.5 || ^7.0",
"igorw/get-in": "^1.0",
"psr/http-message-implementation": "^1.0",
"php-http/client-implementation": "^1.0",
"php-http/message-factory": "^1.0.2",
"php-http/httplug": "^1.0",
"php-http/discovery": "^1.0"
},
"require-dev": {
"phpunit/phpunit": "^4.8",
"symfony/stopwatch": "~2.5",
"php-http/message": "^1.0",
"php-http/curl-client": "^1.7",
"php-http/mock-client": "^0.3.0",
"guzzlehttp/psr7": "^1.4"
},
"suggest": {
"symfony/stopwatch": "If you want to use the TimedGeocoder"
},
"autoload": {
"psr-4": {
"Geocoder\\": ""
}
},
"scripts": {
"test": "vendor/bin/phpunit"
},
"extra": {
"branch-alias": {
"dev-master": "4.0-dev"
}
}
}
@@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/4.1/phpunit.xsd"
backupGlobals="false"
colors="true"
bootstrap="vendor/autoload.php"
>
<php>
<ini name="error_reporting" value="-1" />
</php>
<testsuites>
<testsuite name="Geocoder Test Suite">
<directory>./Tests/</directory>
</testsuite>
</testsuites>
<filter>
<whitelist>
<directory>./</directory>
<exclude>
<directory>./Tests</directory>
<directory>./vendor</directory>
</exclude>
</whitelist>
</filter>
</phpunit>
@@ -0,0 +1,3 @@
vendor/
composer.lock
phpunit.xml
@@ -8,14 +8,16 @@
* @license MIT License
*/
namespace Geocoder\Provider;
namespace Geocoder\Provider\ArcGISOnline;
use Geocoder\Exception\InvalidArgument;
use Geocoder\Exception\InvalidServerResponse;
use Geocoder\Exception\UnsupportedOperation;
use Geocoder\Exception\ZeroResults;
use Geocoder\Model\Query\GeocodeQuery;
use Geocoder\Model\Query\ReverseQuery;
use Geocoder\Provider\AbstractHttpProvider;
use Geocoder\Provider\Provider;
use Http\Client\HttpClient;
/**
@@ -8,13 +8,13 @@
* @license MIT License
*/
namespace Geocoder\Tests\Provider;
namespace Geocoder\Provider\ArcGISOnlineTest\Tests;
use Geocoder\Location;
use Geocoder\Model\Query\GeocodeQuery;
use Geocoder\Model\Query\ReverseQuery;
use Geocoder\Tests\TestCase;
use Geocoder\Provider\ArcGISOnline;
use Geocoder\Provider\ArcGISOnline\ArcGISOnline;
class ArcGISOnlineTest extends TestCase
{
@@ -0,0 +1,37 @@
{
"name": "geocoder-php/arcgis-online-provider",
"type": "library",
"description": "Geocoder ArcGIS Online adapter",
"keywords": [],
"homepage": "http://geocoder-php.org/Geocoder/",
"license": "MIT",
"authors": [
{
"name": "William Durand",
"email": "william.durand1@gmail.com"
}
],
"require": {
"php": "^5.5 || ^7.0",
"willdurand/geocoder": "^4.0"
},
"require-dev": {
"phpunit/phpunit": "^4.8",
"php-http/message": "^1.0",
"php-http/curl-client": "^1.7",
"symfony/phpunit-bridge": "^3.2",
"guzzlehttp/psr7": "^1.4"
},
"autoload": {
"psr-4": { "Geocoder\\Provider\\ArcGISOnine\\": "" },
"exclude-from-classmap": [
"/Tests/"
]
},
"minimum-stability": "dev",
"extra": {
"branch-alias": {
"dev-master": "4.0-dev"
}
}
}
@@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/4.1/phpunit.xsd"
backupGlobals="false"
colors="true"
bootstrap="vendor/autoload.php"
>
<php>
<ini name="error_reporting" value="-1" />
</php>
<testsuites>
<testsuite name="Geocoder Test Suite">
<directory>./Tests/</directory>
</testsuite>
</testsuites>
<filter>
<whitelist>
<directory>./</directory>
<exclude>
<directory>./Tests</directory>
<directory>./vendor</directory>
</exclude>
</whitelist>
</filter>
</phpunit>
@@ -0,0 +1,3 @@
vendor/
composer.lock
phpunit.xml
Oops, something went wrong.

0 comments on commit 3180c7b

Please sign in to comment.