Skip to content
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
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,5 @@ script/*
/build
/test/reports
.env
/.php_cs
/.php_cs.cache
11 changes: 11 additions & 0 deletions .php_cs.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?php
return PhpCsFixer\Config::create()
->setFinder(
PhpCsFixer\Finder::create()
->files()
->in(__DIR__ . '/src')
->in(__DIR__ . '/test')
)
->setRules([
'@PSR2' => true,
]);
49 changes: 35 additions & 14 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,36 @@
sudo: false

cache:
directories:
- $HOME/.composer

git:
depth: 1

language: php
php:
- 7.2
- 7.1
- 7.0
before_script:
- composer install --dev --optimize-autoloader
- mkdir -p build/logs
after_script:
- php vendor/bin/coveralls -v
env:
global:
- secure: esQlDAcdxPtpwlOIFrC6d7/ejoOQyJJGeY/lhPv0qiWJ974+XxjLU7vGn0lKS5K4Z5WlZkGClEsfNok51Bm4JPnMsAZHTAO9f6bR7YpNrynmTyrwdv2NMUfAID8cJ9pUVZpbuT91M9aCuxUy4i2s+lx88myOVVr2r1YxQVcV1OA=
- secure: c9AOiucZTzzQu5QSLycx5CnQObIvkLiGrAv7yZg9gEouCDd3p4InOrW28WwMJjvVlTSN5BzEe1FLDh+rvatO2q4dwTTbx6NQ2QMTfM4W/L3M/Iv5yBt7VjuqlPXb4oHIvydvr/GXoRL/hNtn9wL/EdU5sKfSu+n0xVwsmCql/3U=
- secure: VKJgrYDePSIbdux5NodegW3vhLa3YSWLEkeTlScrGHBZVGK7K4F73s3v+32TeSNz/RYM8/MnSq2r9DUA7uPdms4UAWAFcz8uC36sOl1hkBy2gJAvYJJB5oLylR9TWXe+j20sDShdeGgfpFLcy/POcqdwQcJAx5XitDY4pw2ZwBI=

before_install:
- composer self-update
- phpenv config-rm xdebug.ini || return 0
- composer global show hirak/prestissimo -q || composer global require hirak/prestissimo

matrix:
include:
- name: PHP 7.0 with lowest versions of dependencies
php: '7.0'
install: composer update --prefer-lowest
- name: PHP 7.0
php: '7.0'
install: composer update
- name: PHP 7.1
php: '7.1'
install: composer update
- name: PHP 7.2
php: '7.2'
install: composer update
after_script:
- php vendor/bin/coveralls -v

script:
- vendor/bin/php-cs-fixer fix --diff --dry-run -v
- vendor/bin/phpunit
22 changes: 14 additions & 8 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,13 @@
"name": "bigcommerce/api",
"type": "library",
"description": "Enables PHP applications to communicate with the Bigcommerce API.",
"keywords": ["api", "http", "rest", "ecommerce", "business"],
"keywords": [
"api",
"http",
"rest",
"ecommerce",
"business"
],
"homepage": "http://developer.bigcommerce.com",
"license": "MIT",
"authors": [
Expand All @@ -13,22 +19,22 @@
],
"require": {
"php": ">=7.0",
"firebase/php-jwt": "~3.0|~5.0"
"firebase/php-jwt": "~3.0 || ~5.0"
},
"require-dev": {
"phpunit/phpunit": "^4.8.35",
"codeless/jugglecode": "1.0",
"friendsofphp/php-cs-fixer": "^2.13",
"php-coveralls/php-coveralls": "2.1",
"codeless/jugglecode": "1.0"
"phpunit/phpunit": "^6.4 || ^7.4"
},
"autoload": {
"psr-0": {
"Bigcommerce": "src/"
},
}
},
"autoload-dev": {
"psr-4": {
"Bigcommerce\\Test\\": "test/"
}
},
"scripts": {
"test": "phpunit"
}
}
11 changes: 4 additions & 7 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/4.8/phpunit.xsd"
xsi:noNamespaceSchemaLocation='vendor/phpunit/phpunit/phpunit.xsd'
backupGlobals="true"
backupStaticAttributes="true"
colors="true"
Expand All @@ -15,18 +15,15 @@
<log type="coverage-php" target="build/logs/coverage.cov"/>
<log type="coverage-text" target="build/logs/coverage.txt" showUncoveredFiles="false"/>
<log type="coverage-html" target="test/reports/coverage/" showUncoveredFiles="true"/>
<log type="junit" target="test/reports/junit.xml" logIncompleteSkipped="false"/>
<log type="junit" target="test/reports/junit.xml"/>
</logging>
<testsuites>
<testsuite>
<testsuite name="test">
<directory>test/</directory>
</testsuite>
</testsuites>
<filter>
<blacklist>
<directory suffix=".php">vendor/</directory>
</blacklist>
<whitelist addUncoveredFilesFromWhitelist="true">
<whitelist>
<directory suffix=".php">src/</directory>
</whitelist>
</filter>
Expand Down
28 changes: 14 additions & 14 deletions src/Bigcommerce/Api/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,56 +15,56 @@ class Client
*
* @var string
*/
static private $store_url;
private static $store_url;

/**
* Username to connect to the store API with
*
* @var string
*/
static private $username;
private static $username;

/**
* API key
*
* @var string
*/
static private $api_key;
private static $api_key;

/**
* Connection instance
*
* @var Connection
*/
static private $connection;
private static $connection;

/**
* Resource class name
*
* @var string
*/
static private $resource;
private static $resource;

/**
* API path prefix to be added to store URL for requests
*
* @var string
*/
static private $path_prefix = '/api/v2';
private static $path_prefix = '/api/v2';

/**
* Full URL path to the configured store API.
*
* @var string
*/
static public $api_path;
static private $client_id;
static private $store_hash;
static private $auth_token;
static private $client_secret;
static private $stores_prefix = '/stores/%s/v2';
static private $api_url = 'https://api.bigcommerce.com';
static private $login_url = 'https://login.bigcommerce.com';
public static $api_path;
private static $client_id;
private static $store_hash;
private static $auth_token;
private static $client_secret;
private static $stores_prefix = '/stores/%s/v2';
private static $api_url = 'https://api.bigcommerce.com';
private static $login_url = 'https://login.bigcommerce.com';

/**
* Configure the API client with the required settings to access
Expand Down
1 change: 0 additions & 1 deletion src/Bigcommerce/Api/ClientError.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
*/
class ClientError extends Error
{

public function __toString()
{
return "Client Error ({$this->code}): " . $this->message;
Expand Down
1 change: 0 additions & 1 deletion src/Bigcommerce/Api/Connection.php
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,6 @@ private function followRedirectPath()
}

$this->get($url);

} else {
$errorString = "Too many redirects when trying to follow location.";
throw new NetworkError($errorString, CURLE_TOO_MANY_REDIRECTS);
Expand Down
3 changes: 1 addition & 2 deletions src/Bigcommerce/Api/Resources/Address.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,4 @@

class Address extends Resource
{

}
}
1 change: 0 additions & 1 deletion src/Bigcommerce/Api/Resources/DiscountRule.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,4 @@
*/
class DiscountRule extends Resource
{

}
3 changes: 1 addition & 2 deletions src/Bigcommerce/Api/Resources/OrderCoupons.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,4 @@

class OrderCoupons extends Resource
{

}
}
3 changes: 1 addition & 2 deletions src/Bigcommerce/Api/Resources/OrderProduct.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,4 @@

class OrderProduct extends Resource
{

}
}
3 changes: 1 addition & 2 deletions src/Bigcommerce/Api/Resources/OrderStatus.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,4 @@

class OrderStatus extends Resource
{

}
}
2 changes: 0 additions & 2 deletions src/Bigcommerce/Api/Resources/ProductConfigurableField.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,4 @@
*/
class ProductConfigurableField extends Resource
{

}

Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,4 @@
*/
class ProductGoogleProductSearch extends Resource
{

}
1 change: 0 additions & 1 deletion src/Bigcommerce/Api/Resources/ProductReview.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,4 @@
*/
class ProductReview extends Resource
{

}
1 change: 0 additions & 1 deletion src/Bigcommerce/Api/Resources/ProductVideo.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,4 @@
*/
class ProductVideo extends Resource
{

}
3 changes: 1 addition & 2 deletions src/Bigcommerce/Api/Resources/RequestLog.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,4 @@
*/
class RequestLog extends Resource
{

}
}
1 change: 0 additions & 1 deletion src/Bigcommerce/Api/Resources/TaxClass.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,4 @@
*/
class TaxClass extends Resource
{

}
3 changes: 2 additions & 1 deletion test/Unit/Api/ClientErrorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@
namespace Bigcommerce\Unit\Api;

use Bigcommerce\Api\ClientError;
use PHPUnit\Framework\TestCase;

class ClientErrorTest extends \PHPUnit_Framework_TestCase
class ClientErrorTest extends TestCase
{
public function testStringifyingReturnsTheMessageAndCodeAppropriately()
{
Expand Down
Loading