diff --git a/.travis.yml b/.travis.yml index 2224fd0..a0c42b3 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,8 +1,26 @@ language: php -php: -- 7.1 -before_install: -- cp phpunit.xml.sample phpunit.xml -- composer install -script: -- ./vendor/bin/phpunit +jobs: + include: + - stage: php71-lowest + php: 7.1 + env: dependencies=lowest + script: ./vendor/bin/phpunit + - stage: php72-lowest + php: 7.2 + env: dependencies=lowest + script: ./vendor/bin/phpunit + - stage: php72 + php: 7.2 + script: ./vendor/bin/phpunit + - stage: php73 + php: 7.3 + script: ./vendor/bin/phpunit + - stage: php74 + php: 7.4 + script: ./vendor/bin/phpunit + +before_script: + - composer self-update -q + - if [ -z "$dependencies" ]; then composer install; fi; + - if [ "$dependencies" = "lowest" ]; then composer update --prefer-lowest -n; fi; + - if [ "$dependencies" = "highest" ]; then composer update -n; fi; diff --git a/README.md b/README.md index 272fa73..5623f9d 100644 --- a/README.md +++ b/README.md @@ -311,7 +311,7 @@ In order to pass the unit tests, you will need: ### To run the tests -- Copy file `phpunit.xml.sample` to `phpunit.xml` +- Copy file `phpunit.xml.dist` to `phpunit.xml` - Edit the new file and enter your values for `API_KEY`, `CLIENT_ID`, `CLIENT_SECRET`, `CALLBACK_URL`, `API_URL`, AND `OAUTH_TOKEN_URL` - Run `./vendor/bin/phpunit` diff --git a/composer.json b/composer.json index 1cce276..de3fbca 100644 --- a/composer.json +++ b/composer.json @@ -17,6 +17,6 @@ "phpunit/phpunit": "7.3.*" }, "require": { - "guzzlehttp/guzzle": "^7.0|^6.2" + "guzzlehttp/guzzle": "^6.3|^7.0" } } diff --git a/library/HelloSign/Client.php b/library/HelloSign/Client.php index dcdaf62..f1a214b 100644 --- a/library/HelloSign/Client.php +++ b/library/HelloSign/Client.php @@ -41,7 +41,7 @@ class Client { - const VERSION = '3.6.0'; + const VERSION = '3.7.0'; const API_URL = "https://api.hellosign.com/v3/"; diff --git a/library/HelloSign/Test/ApiAppTest.php b/library/HelloSign/Test/ApiAppTest.php index b2cfca0..4751683 100644 --- a/library/HelloSign/Test/ApiAppTest.php +++ b/library/HelloSign/Test/ApiAppTest.php @@ -30,6 +30,12 @@ class ApiAppTest extends AbstractTest { + private function generateApiAppName(string $prefix): string + { + $guid = TestUtils::generateGuid(8); + return $prefix . $guid; + } + /** * @expectedException HelloSign\Error * @expectedExceptionMessage An app with the same name already exists @@ -40,7 +46,7 @@ public function testCreateApiApp() $wl = array('primary_button_color' => '#626567', 'primary_button_text_color' => '#ffffff'); $wl = json_encode($wl); - $name = "Test" . rand(1, 2000); + $name = $this->generateApiAppName('Test'); $domain = "www.testdomain.com"; $callback = $_ENV['CALLBACK_URL']; $logo = __DIR__ . "/logo.jpg"; @@ -75,7 +81,7 @@ public function testCreateApiApp() */ public function testCreateOauthApiApp() { - $name = "Test Oauth" . rand(1, 2000); + $name = $this->generateApiAppName('Test Oauth'); $domain = "www.testdomain.com"; $callback = $_ENV['CALLBACK_URL']; $logo = __DIR__ . "/logo.jpg"; @@ -104,7 +110,7 @@ public function testCreateOauthApiApp() public function testUpdateApiApp() { - $name = "Test" . rand(1, 2000); + $name = $this->generateApiAppName('Test'); $domain = "www.testdomain.com"; $app = new ApiApp; @@ -131,7 +137,7 @@ public function testUpdateApiApp() */ public function testGetApiApp() { - $name = "Test" . rand(1, 2000); + $name = $this->generateApiAppName('Test'); $domain = "www.testdomain.com"; $callback_url = $_ENV['CALLBACK_URL']; diff --git a/library/HelloSign/Test/TemplateTest.php b/library/HelloSign/Test/TemplateTest.php index 6388653..d45dd1a 100644 --- a/library/HelloSign/Test/TemplateTest.php +++ b/library/HelloSign/Test/TemplateTest.php @@ -41,7 +41,7 @@ class TemplateTest extends AbstractTest */ public function testGetTemplatesWithPageNotFound() { - $templates = $this->client->getTemplates(9999); + $templates = $this->client->getTemplates(9999, 1); } /** @@ -187,7 +187,7 @@ public function testUpdateTemplateFiles() $templates = $this->client->getTemplates(); $template_id = $templates[0]->getId(); $client_id = $_ENV['CLIENT_ID']; - + $request = new \HelloSign\Template(); $request->setClientId($client_id); $request->addFile(__DIR__ . '/nda.docx'); diff --git a/library/HelloSign/Test/TestUtils.php b/library/HelloSign/Test/TestUtils.php new file mode 100644 index 0000000..a7b3565 --- /dev/null +++ b/library/HelloSign/Test/TestUtils.php @@ -0,0 +1,18 @@ + - - - + + +