From 1e03bdc445cb240f07b0c375c7f696762c8327cf Mon Sep 17 00:00:00 2001 From: Hassansin Date: Mon, 5 Aug 2019 16:47:57 +0600 Subject: [PATCH] Exclusive support for php 7 (#48) * PHP 7 exclusive (#45) * Update mock-client and guzzle adapter * Remove phpunit exception annotations * Make php7 exclusive * Fix tests * Remove php5 references * Revert nightly build removal * Update composer.json Co-Authored-By: Hassansin * Include php 7.x test support * Fix Travis Build on php 7.1 [ch14742] (#46) * install phpunit 7 when testing on php 7.1 * fix shell if condition * revert composer.json changes * Updated dependencies & Remove outdated docs [ch14742] (#47) * Updated dependencies and removed outdated docs * Updated README * Updated README & Added nightly build --- .travis.yml | 20 +- Dockerfile | 9 +- Makefile | 10 +- README.md | 12 +- composer.json | 15 +- docs/ChartMogul-Configuration.md | 126 - docs/ChartMogul-Enrichment-Customer.md | 458 - docs/ChartMogul-Enrichment-Customers.md | 137 - ...artMogul-Exceptions-ChartMogulException.md | 67 - ...hartMogul-Exceptions-ForbiddenException.md | 68 - ...ChartMogul-Exceptions-NotFoundException.md | 68 - ...gul-Exceptions-ResourceInvalidException.md | 68 - ...ChartMogul-Exceptions-ResponseException.md | 46 - ...Mogul-Exceptions-SchemaInvalidException.md | 68 - docs/ChartMogul-Http-Client.md | 216 - docs/ChartMogul-Http-ClientInterface.md | 112 - docs/ChartMogul-Import-Customer.md | 311 - docs/ChartMogul-Import-CustomerInvoices.md | 161 - docs/ChartMogul-Import-DataSource.md | 196 - docs/ChartMogul-Import-Invoice.md | 149 - ...Mogul-Import-LineItems-AbstractLineItem.md | 172 - docs/ChartMogul-Import-LineItems-OneTime.md | 183 - ...hartMogul-Import-LineItems-Subscription.md | 238 - docs/ChartMogul-Import-Plan.md | 205 - docs/ChartMogul-Import-Subscription.md | 220 - ...Import-Transactions-AbstractTransaction.md | 198 - .../ChartMogul-Import-Transactions-Payment.md | 207 - docs/ChartMogul-Import-Transactions-Refund.md | 207 - docs/ChartMogul-Metrics-ARPA.md | 94 - docs/ChartMogul-Metrics-ARPAs.md | 120 - docs/ChartMogul-Metrics-ARR.md | 94 - docs/ChartMogul-Metrics-ARRs.md | 120 - docs/ChartMogul-Metrics-ASP.md | 94 - docs/ChartMogul-Metrics-ASPs.md | 120 - docs/ChartMogul-Metrics-AbstractMetric.md | 119 - docs/ChartMogul-Metrics-Activities.md | 119 - docs/ChartMogul-Metrics-Activity.md | 189 - docs/ChartMogul-Metrics-AllKeyMetric.md | 171 - docs/ChartMogul-Metrics-AllKeyMetrics.md | 119 - docs/ChartMogul-Metrics-CustomerChurnRate.md | 94 - docs/ChartMogul-Metrics-CustomerChurnRates.md | 120 - docs/ChartMogul-Metrics-CustomerCount.md | 94 - docs/ChartMogul-Metrics-CustomerCounts.md | 120 - docs/ChartMogul-Metrics-LTV.md | 94 - docs/ChartMogul-Metrics-LTVs.md | 120 - docs/ChartMogul-Metrics-MRR.md | 149 - docs/ChartMogul-Metrics-MRRChurnRate.md | 94 - docs/ChartMogul-Metrics-MRRChurnRates.md | 120 - docs/ChartMogul-Metrics-MRRs.md | 120 - docs/ChartMogul-Metrics-Subscription.md | 222 - docs/ChartMogul-Metrics-Subscriptions.md | 119 - docs/ChartMogul-Metrics.md | 182 - docs/ChartMogul-Resource-AbstractModel.md | 67 - docs/ChartMogul-Resource-AbstractResource.md | 100 - docs/ChartMogul-Summary.md | 105 - docs/README.md | 62 - docs/structure.xml | 8635 ----------------- src/Subscription.php | 4 +- tests/Unit/Http/ClientTest.php | 20 +- tests/Unit/InvoiceTest.php | 5 +- 60 files changed, 49 insertions(+), 15903 deletions(-) delete mode 100644 docs/ChartMogul-Configuration.md delete mode 100644 docs/ChartMogul-Enrichment-Customer.md delete mode 100644 docs/ChartMogul-Enrichment-Customers.md delete mode 100644 docs/ChartMogul-Exceptions-ChartMogulException.md delete mode 100644 docs/ChartMogul-Exceptions-ForbiddenException.md delete mode 100644 docs/ChartMogul-Exceptions-NotFoundException.md delete mode 100644 docs/ChartMogul-Exceptions-ResourceInvalidException.md delete mode 100644 docs/ChartMogul-Exceptions-ResponseException.md delete mode 100644 docs/ChartMogul-Exceptions-SchemaInvalidException.md delete mode 100644 docs/ChartMogul-Http-Client.md delete mode 100644 docs/ChartMogul-Http-ClientInterface.md delete mode 100644 docs/ChartMogul-Import-Customer.md delete mode 100644 docs/ChartMogul-Import-CustomerInvoices.md delete mode 100644 docs/ChartMogul-Import-DataSource.md delete mode 100644 docs/ChartMogul-Import-Invoice.md delete mode 100644 docs/ChartMogul-Import-LineItems-AbstractLineItem.md delete mode 100644 docs/ChartMogul-Import-LineItems-OneTime.md delete mode 100644 docs/ChartMogul-Import-LineItems-Subscription.md delete mode 100644 docs/ChartMogul-Import-Plan.md delete mode 100644 docs/ChartMogul-Import-Subscription.md delete mode 100644 docs/ChartMogul-Import-Transactions-AbstractTransaction.md delete mode 100644 docs/ChartMogul-Import-Transactions-Payment.md delete mode 100644 docs/ChartMogul-Import-Transactions-Refund.md delete mode 100644 docs/ChartMogul-Metrics-ARPA.md delete mode 100644 docs/ChartMogul-Metrics-ARPAs.md delete mode 100644 docs/ChartMogul-Metrics-ARR.md delete mode 100644 docs/ChartMogul-Metrics-ARRs.md delete mode 100644 docs/ChartMogul-Metrics-ASP.md delete mode 100644 docs/ChartMogul-Metrics-ASPs.md delete mode 100644 docs/ChartMogul-Metrics-AbstractMetric.md delete mode 100644 docs/ChartMogul-Metrics-Activities.md delete mode 100644 docs/ChartMogul-Metrics-Activity.md delete mode 100644 docs/ChartMogul-Metrics-AllKeyMetric.md delete mode 100644 docs/ChartMogul-Metrics-AllKeyMetrics.md delete mode 100644 docs/ChartMogul-Metrics-CustomerChurnRate.md delete mode 100644 docs/ChartMogul-Metrics-CustomerChurnRates.md delete mode 100644 docs/ChartMogul-Metrics-CustomerCount.md delete mode 100644 docs/ChartMogul-Metrics-CustomerCounts.md delete mode 100644 docs/ChartMogul-Metrics-LTV.md delete mode 100644 docs/ChartMogul-Metrics-LTVs.md delete mode 100644 docs/ChartMogul-Metrics-MRR.md delete mode 100644 docs/ChartMogul-Metrics-MRRChurnRate.md delete mode 100644 docs/ChartMogul-Metrics-MRRChurnRates.md delete mode 100644 docs/ChartMogul-Metrics-MRRs.md delete mode 100644 docs/ChartMogul-Metrics-Subscription.md delete mode 100644 docs/ChartMogul-Metrics-Subscriptions.md delete mode 100644 docs/ChartMogul-Metrics.md delete mode 100644 docs/ChartMogul-Resource-AbstractModel.md delete mode 100644 docs/ChartMogul-Resource-AbstractResource.md delete mode 100644 docs/ChartMogul-Summary.md delete mode 100644 docs/README.md delete mode 100644 docs/structure.xml diff --git a/.travis.yml b/.travis.yml index a1790d2..95b684b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,12 +1,24 @@ language: php php: - - '5.5' - - '5.6' + - '7.1' - '7.2' + - '7.3' - nightly before_script: - - composer install + - | + if [[ "$TRAVIS_PHP_VERSION" == 'nightly' ]]; then + #ignore php version check on nightly build + composer install --ignore-platform-reqs + else + composer install + fi + - if [[ "$TRAVIS_PHP_VERSION" == '7.1' ]]; then composer require phpunit/phpunit:^7; fi script: - - phpunit + - | + if [[ "$TRAVIS_PHP_VERSION" == '7.1' ]]; then + vendor/bin/phpunit + else + phpunit + fi diff --git a/Dockerfile b/Dockerfile index bf02454..a77bbe4 100644 --- a/Dockerfile +++ b/Dockerfile @@ -5,10 +5,11 @@ RUN mv composer.phar /usr/local/bin/composer RUN chmod a+x /usr/local/bin/composer RUN apt-get update && apt-get install -y git unzip ARG VERSION -RUN if [ "$VERSION" = "7.2" ]; then \ - composer global require phpunit/phpunit:^7 && pecl install xdebug-2.7.0alpha1; else \ - composer global require phpunit/phpunit:^4 && pecl install xdebug-2.5.5; fi -RUN docker-php-ext-enable xdebug RUN composer global require hirak/prestissimo +RUN if [ "$VERSION" = "7.1" ]; then \ + composer global require phpunit/phpunit:^7; else \ + composer global require phpunit/phpunit:^8; fi +RUN pecl install xdebug-2.7.2; +RUN docker-php-ext-enable xdebug ENV PATH="${PATH}:/root/.composer/vendor/bin" COPY php.ini /usr/local/etc/php/ diff --git a/Makefile b/Makefile index 9027f83..bfca824 100644 --- a/Makefile +++ b/Makefile @@ -1,10 +1,11 @@ -RUNNER=docker run -it --rm --workdir "/src" -v "$(PWD):/src" -v "$(HOME)/.composer/cache:/root/.composer/cache" chartmogulphp5 /bin/bash -c +RUNNER=docker run -it --rm --workdir "/src" -v "$(PWD):/src" -v "$(HOME)/.composer/cache:/root/.composer/cache" chartmogulphp71 /bin/bash -c .PHONY: build composer php build: - @docker build --build-arg VERSION=5.5 --tag=chartmogulphp5 . - @docker build --build-arg VERSION=7.2 --tag=chartmogulphp7 . + @docker build --build-arg VERSION=7.1 --tag=chartmogulphp71 . + @docker build --build-arg VERSION=7.2 --tag=chartmogulphp72 . + @docker build --build-arg VERSION=7.3 --tag=chartmogulphp73 . composer: @$(RUNNER) "composer $(filter-out $@,$(MAKECMDGOALS))" dependencies: @@ -17,8 +18,5 @@ cs: $(RUNNER) "./vendor/bin/phpcs --standard=PSR2 src/" cbf: $(RUNNER) "./vendor/bin/phpcbf --standard=PSR2 src/" -doc: - $(RUNNER) "./vendor/bin/phpdoc" - $(RUNNER) "./vendor/bin/phpdocmd docs/structure.xml docs --index README.md" %: @: diff --git a/README.md b/README.md index 9bd0a5f..93f591b 100644 --- a/README.md +++ b/README.md @@ -31,9 +31,12 @@ This library requires php 5.5 or above. +For older php versions (`< 7.1`) use `1.x.x` releases of this library. + +For php version `>=7.1` use the latest releases (`2.x.x`) of the library -**Using Composer**: +**Using Composer**: ```sh composer require chartmogul/chartmogul-php @@ -43,7 +46,7 @@ or in `composer.json`: ```json { "require": { - "chartmogul/chartmogul-php": "~1.1" + "chartmogul/chartmogul-php": "~2.0" } } ``` @@ -633,10 +636,6 @@ ChartMogul\Configuration::getDefaultConfiguration() ->setRetries(15); //0 disables retrying ``` -## API Documentation - -Find the full public API documentation [here](docs/README.md). - ## Development @@ -648,7 +647,6 @@ You need `Docker` installed locally to use our `Makefile` workflow. * Install dependencies: `make build`. * Fix bugs or add features. Make sure the changes pass the coding guidelines by runing PHP CodeSniffer: `make cs`. You can also run `make cbf` to fix some errors automatically. * Write tests for your new features. Run tests and check test coverage with `make test`. -* Generate API documentation by running `make doc`. * To run any composer commands or php scripts, use `make composer ` or `make php