Skip to content

Commit b8acf5a

Browse files
committed
Merge pull request firebase#3 from phansys/master
Improved test suite
2 parents c794eeb + 66c3957 commit b8acf5a

File tree

6 files changed

+56
-3
lines changed

6 files changed

+56
-3
lines changed

.travis.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
language: php
2+
3+
php:
4+
- 5.3
5+
- 5.4
6+
- 5.5
7+
8+
before_script:
9+
- wget -nc http://getcomposer.org/composer.phar
10+
- php composer.phar install
11+
12+
script: phpunit --configuration phpunit.xml.dist

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
1+
[![Build Status](https://travis-ci.org/phansys/php-jwt.png?branch=master)](https://travis-ci.org/phansys/php-jwt)
22
PHP-JWT
33
=======
44
A simple library to encode and decode JSON Web Tokens (JWT) in PHP. Should

phpunit.xml.dist

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
3+
<phpunit backupGlobals="false"
4+
backupStaticAttributes="false"
5+
colors="true"
6+
convertErrorsToExceptions="true"
7+
convertNoticesToExceptions="true"
8+
convertWarningsToExceptions="true"
9+
processIsolation="false"
10+
stopOnFailure="false"
11+
syntaxCheck="false"
12+
bootstrap="tests/bootstrap.php"
13+
>
14+
<testsuites>
15+
<testsuite name="PHP JSON Web Token Test Suite">
16+
<directory>./tests</directory>
17+
</testsuite>
18+
</testsuites>
19+
</phpunit>

tests/JWTTest.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
<?php
22

3-
include_once 'Authentication/JWT.php';
4-
53
class JWTTest extends PHPUnit_Framework_TestCase {
64
function testEncodeDecode() {
75
$msg = JWT::encode('abc', 'my_key');

tests/autoload.php.dist

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?php
2+
3+
// if the library is the project, try to use the composer's autoload for the tests
4+
$composerAutoload = __DIR__ . '/../vendor/autoload.php';
5+
6+
if (is_file($composerAutoload)) {
7+
include $composerAutoload;
8+
} else {
9+
die('Unable to find autoload.php file, please use composer to load dependencies:
10+
11+
wget http://getcomposer.org/composer.phar
12+
php composer.phar install
13+
14+
Visit http://getcomposer.org/ for more information.
15+
16+
');
17+
}

tests/bootstrap.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<?php
2+
3+
if (file_exists($file = __DIR__ . '/autoload.php')) {
4+
require_once $file;
5+
} elseif (file_exists($file = __DIR__ . '/autoload.php.dist')) {
6+
require_once $file;
7+
}

0 commit comments

Comments
 (0)