Skip to content

Commit

Permalink
update .travis.yml and add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
orvice committed Apr 12, 2016
1 parent 965fd58 commit 5b8641e
Show file tree
Hide file tree
Showing 5 changed files with 82 additions and 2 deletions.
33 changes: 33 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
language: php

php:
- 5.5
- 5.6
- 7.0
- hhvm

matrix:
allow_failures:
- php: 5.5


services:

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

before_script:
- if [[ "$TRAVIS_PHP_VERSION" == '5.6' ]]; then composer require satooshi/php-coveralls:dev-master squizlabs/php_codesniffer:2.* -n ; fi
- if [[ "$TRAVIS_PHP_VERSION" != '5.6' ]]; then composer install -n ; fi


script:
- if [ "$TRAVIS_PHP_VERSION" != "5.5.9" ] && [ "$TRAVIS_PHP_VERSION" != "5.5" ] && [ "$TRAVIS_PHP_VERSION" != "5.6" ]; then vendor/bin/phpunit; fi
- if [ "$TRAVIS_PHP_VERSION" == "5.5.9" ] || [ "$TRAVIS_PHP_VERSION" == "5.5" ] || [ "$TRAVIS_PHP_VERSION" == "5.6" ]; then vendor/bin/phpunit --coverage-clover build/logs/clover.xml; fi

after_script:
- if [ "$TRAVIS_PHP_VERSION" == "5.5.9" ] || [ "$TRAVIS_PHP_VERSION" == "5.5" ] || [ "$TRAVIS_PHP_VERSION" == "5.6" ]; then wget https://scrutinizer-ci.com/ocular.phar; fi
- if [ "$TRAVIS_PHP_VERSION" == "5.5.9" ] || [ "$TRAVIS_PHP_VERSION" == "5.5" ] || [ "$TRAVIS_PHP_VERSION" == "5.6" ]; then php ocular.phar code-coverage:upload --format=php-clover build/logs/clover.xml; fi

after_success:
- travis_retry php vendor/bin/coveralls
6 changes: 4 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,13 @@
"firebase/php-jwt": "~3.0",
"aws/aws-sdk-php": "3.*",
"gregwar/captcha": "1.*",
"desarrolla2/cache": "~2.0"
"desarrolla2/cache": "~2.0"
},
"require-dev": {
"phpunit/phpunit": "~5.0"
},
"autoload": {
"classmap": [

],
"files": [
"src/Pongtan/Support/helpers.php"
Expand Down
25 changes: 25 additions & 0 deletions phpunit.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?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="true">
<testsuites>
<testsuite name="Pongtan Test Suite">
<directory>./tests/</directory>
</testsuite>
</testsuites>
<filter>
<whitelist>
<directory suffix=".php">app/</directory>
</whitelist>
</filter>
<php>
<env name="APP_ENV" value="testing"/>
</php>
</phpunit>
5 changes: 5 additions & 0 deletions src/Pongtan/Services/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,9 @@ public static function get($key)
}
return $key;
}

public static function set($key, $value)
{
putenv("$key=$value");
}
}
15 changes: 15 additions & 0 deletions tests/Services/ConfigTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?php

use Pongtan\Services\Config;

class ConfigTest extends PHPUnit_Framework_TestCase
{
public function testConfig()
{
$key = "test_key";
$value = "test_value";
Config::set($key,$value);
$this->assertEquals($value,Config::get($key));
}

}

0 comments on commit 5b8641e

Please sign in to comment.