Skip to content

Commit

Permalink
Drop abstract static methods [ch4671] #40
Browse files Browse the repository at this point in the history
* use different php versions from Travis

* disable master-only travis build

* Use php7 in Dockerfile and update Tests namespace

* Trigger Travis build

* Travis before_script

* Fixed  Call to undefined method ClientTest::setExpectedException() in phpunit 6

* Removed abstract static method, testing in php 5 & 7, code formatting

* class alias
  • Loading branch information
hassansin committed Jul 24, 2018
1 parent e8851d6 commit 1d607be
Show file tree
Hide file tree
Showing 30 changed files with 453 additions and 70 deletions.
3 changes: 1 addition & 2 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
/coverage export-ignore

/coverage export-ignore php.ini
17 changes: 9 additions & 8 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
sudo: required
language: php
php:
- '5.5'
- '5.6'
- '7.2'
- nightly

services:
- docker
before_script:
- composer install

script:
- make test

branches:
only:
- master
- phpunit
12 changes: 10 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
FROM php:5.5.37-fpm
ARG VERSION
FROM php:${VERSION}
RUN curl -O https://getcomposer.org/composer.phar
RUN mv composer.phar /usr/local/bin/composer
RUN chmod a+x /usr/local/bin/composer
RUN pecl install xdebug-2.5.5 && docker-php-ext-enable xdebug
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
ENV PATH="${PATH}:/root/.composer/vendor/bin"
COPY php.ini /usr/local/etc/php/
15 changes: 8 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
RUNNER=docker run -it --rm --workdir "/src" -v "$(PWD):/src" chartmogulphp /bin/bash -c
RUNNER=docker run -it --rm --workdir "/src" -v "$(PWD):/src" -v "$(HOME)/.composer/cache:/root/.composer/cache" chartmogulphp5 /bin/bash -c

.PHONY: build composer php

build:
if [ "$(shell docker images -q chartmogulphp 2> /dev/null)" = "" ]; then docker build --tag=chartmogulphp .; fi;
composer: build
$(RUNNER) "composer $(filter-out $@,$(MAKECMDGOALS))"
dependencies: build
if [ ! -d vendor ]; then make composer install; fi;
@docker build --build-arg VERSION=5.5 --tag=chartmogulphp5 .
@docker build --build-arg VERSION=7.2 --tag=chartmogulphp7 .
composer:
@$(RUNNER) "composer $(filter-out $@,$(MAKECMDGOALS))"
dependencies:
make -s composer update -- --prefer-dist
test: dependencies
$(RUNNER) "./vendor/bin/phpunit --coverage-text --coverage-html ./coverage "
$(RUNNER) "phpunit --coverage-text --coverage-html ./coverage "
php: dependencies
$(RUNNER) "php $(filter-out $@,$(MAKECMDGOALS))"
cs: dependencies
Expand Down
1 change: 0 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
"php-http/mock-client": "^0.3",
"squizlabs/php_codesniffer": "^2.7",
"phpdocumentor/phpdocumentor": "^2.9",
"phpunit/phpunit": "4.*",
"evert/phpdoc-md": "^0.2.0"
}
}
1 change: 1 addition & 0 deletions php.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
error_reporting = E_ALL
3 changes: 2 additions & 1 deletion phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
stopOnFailure="false"
verbose="true"
bootstrap="tests/bootstrap.php">
<testsuites>
<testsuite name="ChartMogul PHP SDK Test Suite">
Expand All @@ -16,4 +17,4 @@
<directory suffix=".php">./src</directory>
</whitelist>
</filter>
</phpunit>
</phpunit>
4 changes: 2 additions & 2 deletions src/Customer.php
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,9 @@ public static function findByExternalId($externalId)
$response = static::all($externalId);

if (is_null($response)) {
return null;
return null;
} else {
return $response->first();
return $response->first();
}
}

Expand Down
3 changes: 2 additions & 1 deletion src/Import/Customer.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
/**
* @deprecated Use ChartMogul\Customer, Import\CustomerInvoices or Import\Subscription.
*/
class Customer extends ChartMogul\Customer {
class Customer extends ChartMogul\Customer
{

}
3 changes: 2 additions & 1 deletion src/Import/CustomerInvoices.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
/**
* @deprecated Use \ChartMogul\CustomerInvoices
*/
class CustomerInvoices extends \ChartMogul\CustomerInvoices {
class CustomerInvoices extends \ChartMogul\CustomerInvoices
{

}
3 changes: 2 additions & 1 deletion src/Import/DataSource.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
/**
* @deprecated Use ChartMogul\DataSource
*/
class DataSource extends ChartMogul\DataSource {
class DataSource extends ChartMogul\DataSource
{

}
3 changes: 2 additions & 1 deletion src/Import/Invoice.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
/**
* @deprecated Use \ChartMogul\Invoice
*/
class Invoice extends \ChartMogul\Invoice {
class Invoice extends \ChartMogul\Invoice
{

}
3 changes: 2 additions & 1 deletion src/Import/LineItems/OneTime.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
* @codeCoverageIgnore
* @deprecated Use ChartMogul\OneTime
*/
class OneTime extends ChartMogul\OneTime {
class OneTime extends ChartMogul\OneTime
{

}
3 changes: 2 additions & 1 deletion src/Import/LineItems/Subscription.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
* @codeCoverageIgnore
* @deprecated Use ChartMogul\Subscription
*/
class Subscription extends Subscription{
class Subscription extends Subscription
{

}
3 changes: 2 additions & 1 deletion src/Import/Plan.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
/**
* @deprecated Use ChartMogul\Plan
*/
class Plan extends ChartMogul\Plan {
class Plan extends ChartMogul\Plan
{

}
5 changes: 3 additions & 2 deletions src/Import/Subscription.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
/**
* @deprecated Use \ChartMogul\Subscription
*/
class Subscription extends \ChartMogul\Subscription {
class Subscription extends \ChartMogul\Subscription
{

}
}
3 changes: 2 additions & 1 deletion src/Import/Transactions/AbstractTransaction.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
* @property-read string $uuid
* @deprecated Use ChartMogul\AbstractTransaction
*/
abstract class AbstractTransaction extends ChartMogul\AbstractTransaction {
abstract class AbstractTransaction extends ChartMogul\AbstractTransaction
{

}
3 changes: 2 additions & 1 deletion src/Import/Transactions/Payment.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
* @codeCoverageIgnore
* @deprecated Use ChartMogul\Payment
*/
class Payment extends ChartMogul\Payment {
class Payment extends ChartMogul\Payment
{

}
3 changes: 2 additions & 1 deletion src/Import/Transactions/Refund.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
* @codeCoverageIgnore
* @deprecated Use ChartMogul\Refund
*/
class Refund extends ChartMogul\Refund {
class Refund extends ChartMogul\Refund
{

}
48 changes: 24 additions & 24 deletions src/LineItems/AbstractLineItem.php
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
<?php

namespace ChartMogul\LineItems;

/**
* @codeCoverageIgnore
* @property-read string $uuid
*/
abstract class AbstractLineItem extends \ChartMogul\Resource\AbstractModel
{

protected $uuid;

public $type;
public $amount_in_cents;
public $quantity;
public $discount_amount_in_cents;
public $discount_code;
public $tax_amount_in_cents;
public $transaction_fees_in_cents;
public $external_id;

public $invoice_uuid;
}
<?php

namespace ChartMogul\LineItems;

/**
* @codeCoverageIgnore
* @property-read string $uuid
*/
abstract class AbstractLineItem extends \ChartMogul\Resource\AbstractModel
{

protected $uuid;

public $type;
public $amount_in_cents;
public $quantity;
public $discount_amount_in_cents;
public $discount_code;
public $tax_amount_in_cents;
public $transaction_fees_in_cents;
public $external_id;

public $invoice_uuid;
}
2 changes: 0 additions & 2 deletions src/Resource/EntryTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ trait EntryTrait

protected $entries = [];

protected abstract static function getEntryClass();

protected function setEntries(array $entries = [])
{
$this->entries = new ArrayCollection($entries);
Expand Down

0 comments on commit 1d607be

Please sign in to comment.