Skip to content

Commit

Permalink
Merge pull request #11 from starkbank/refactor/test-user-in-env-varia…
Browse files Browse the repository at this point in the history
…bles

Refactor test-user to use environment variables instead of hardcoded …
  • Loading branch information
cdottori-stark committed Jun 5, 2020
2 parents fc70ae8 + 8daf061 commit b3cda90
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 9 deletions.
14 changes: 14 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
language: php

matrix:
include:
- php: "7.1"
- php: "7.2"
- php: "7.3"
- php: "7.4"

install:
- composer install

script:
- php tests/test.php
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,13 @@ Given a version number MAJOR.MINOR.PATCH, increment:


## [Unreleased]
### Added
- Travis CI integration
### Removed
- PHP 7.0 compatibility

### Change
- Test user credentials to environment variable instead of hard-code

## [0.4.1] - 2020-05-15
### Added
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ is as easy as sending a text message to your client!

This library supports the following PHP versions:

* PHP 7.1
* PHP 7.2
* PHP 7.3
* PHP 7.4
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
}
],
"require": {
"php": ">=7.0",
"php": ">=7.1",
"starkbank/ecdsa": "^0.0.4"
},
"keywords": [
Expand Down
17 changes: 9 additions & 8 deletions tests/test.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,17 @@
require_once("vendor/autoload.php");
require_once("src/init.php");

$projectId = $_SERVER["SANDBOX_ID"]; # "9999999999999999",
$privateKey = $_SERVER["SANDBOX_PRIVATE_KEY"]; # "-----BEGIN EC PRIVATE KEY-----\nMHQCAQEEIBEcEJZLk/DyuXVsEjz0w4vrE7plPXhQxODvcG1Jc0WToAcGBSuBBAAK\noUQDQgAE6t4OGx1XYktOzH/7HV6FBukxq0Xs2As6oeN6re1Ttso2fwrh5BJXDq75\nmSYHeclthCRgU8zl6H1lFQ4BKZ5RCQ==\n-----END EC PRIVATE KEY-----"

if (is_null($projectId) || is_null($privateKey)) {
throw new \Exception("missing test credentials");
}

$project = new \StarkBank\Project([
"environment" => "sandbox",
"id" => "9999999999999999",
"privateKey" => "
-----BEGIN EC PRIVATE KEY-----
MHQCAQEEIBEcEJZLk/DyuXVsEjz0w4vrE7plPXhQxODvcG1Jc0WToAcGBSuBBAAK
oUQDQgAE6t4OGx1XYktOzH/7HV6FBukxq0Xs2As6oeN6re1Ttso2fwrh5BJXDq75
mSYHeclthCRgU8zl6H1lFQ4BKZ5RCQ==
-----END EC PRIVATE KEY-----
"
"id" => $projectId,
"privateKey" => $privateKey
]);
\StarkBank\User::setDefault($project);

Expand Down

0 comments on commit b3cda90

Please sign in to comment.