Skip to content

Commit

Permalink
add mac tests and travis-ci
Browse files Browse the repository at this point in the history
  • Loading branch information
leventogut committed Sep 29, 2016
1 parent da6a2ff commit 13f6d9f
Show file tree
Hide file tree
Showing 5 changed files with 76 additions and 1 deletion.
13 changes: 13 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
language: php

php:
- 5.5
- 5.6
- 7.0
- hhvm

sudo: false

install: travis_retry composer install --no-interaction --prefer-dist

script: vendor/bin/phpunit --verbose
3 changes: 3 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@
"guzzlehttp/guzzle": "^6.2",
"monolog/monolog": "^1.19"
},
"require-dev": {
"phpunit/phpunit": "~4.0|~5.0"
},w
"autoload": {
"psr-4": {
"MailiumOauthClient\\": "src/"
Expand Down
5 changes: 4 additions & 1 deletion docs/index.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
# Welcome to Mailium Oauth Client for PHP
# Mailium Oauth Client for PHP
[![Latest Stable Version](https://poser.pugx.org/mailium/oauth-client-php/v/stable.svg)](https://packagist.org/packages/mailium/oauth-client-php) [![Monthly Downloads](https://poser.pugx.org/mailium/oauth-client-php/d/monthly.png)](https://packagist.org/packages/mailium/oauth-client-php) [![License](https://poser.pugx.org/mailium/oauth-client-php/license.svg)](https://packagist.org/packages/mailium/oauth-client-php) ![Build Status](https://travis-ci.org/mailium/oauth-client-php.svg?branch=master)



Mailium Oauth Client provides easy to use wrappers for authorizing your application and getting the tokens required to talk to the API.

Expand Down
18 changes: 18 additions & 0 deletions phpunit.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit backupGlobals="false"
backupStaticAttributes="false"
bootstrap="vendor/autoload.php"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false"
syntaxCheck="false"
>
<testsuites>
<testsuite name="Package Test Suite">
<directory suffix=".php">./tests/</directory>
</testsuite>
</testsuites>
</phpunit>
38 changes: 38 additions & 0 deletions tests/HMACTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<?php
use PHPUnit\Framework\TestCase;
use MailiumOauthClient\Hmac;

class HmacTest extends PHPUnit_Framework_TestCase
{
const KEY = 'verysecretveryhushhush';
/**
* A basic test example.
*
* @return void
*/
public function testHmacGenerationUsingStringAndVerification()
{
$queryString = 'accid=test-customer.mailium.net';

$generateHmacResult = Hmac::generateHmac($queryString, static::KEY);
echo (print_r($generateHmacResult));

$hmacVerificationResult = Hmac::verifyHmac($generateHmacResult['query_string'], static::KEY);

$this->assertTrue($hmacVerificationResult);
}

public function testHmacGenerationUsingArrayAndVerification()
{
$queryArray = array(
'accid' => 'test-customer.mailium.net',
);

$generateHmacResult = Hmac::generateHmac($queryArray, static::KEY);
echo (print_r($generateHmacResult));

$hmacVerificationResult = Hmac::verifyHmac($generateHmacResult['query_string'], static::KEY);

$this->assertTrue($hmacVerificationResult);
}
}

0 comments on commit 13f6d9f

Please sign in to comment.