Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Develop #42

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 10 additions & 21 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,28 +3,17 @@ language: php

# list any PHP version you want to test against
php:
# using major version aliases

# aliased to 5.2.17
- 5.2
# aliased to 5.3.29
- 5.3
# aliased to a recent 5.4.x version
- 5.4
# aliased to a recent 5.5.x version
- 5.5
# aliased to a recent 5.6.x version
- 5.6
# aliased to a recent 7.x version
- 7.0
# aliased to a recent hhvm version
- hhvm
- '7.0'
- hhvm # on Trusty only
- nightly


# optionally specify a list of environments, for example to test different RDBMS
env:
- DB=mysql
- DB=pgsql


# optionally set up exclusions and allowed failures in the matrix
matrix:
exclude:
Expand All @@ -36,14 +25,14 @@ matrix:

# execute any number of scripts before the test run, custom env's are available as variables
before_script:
- if [[ "$DB" == "pgsql" ]]; then psql -c "DROP DATABASE IF EXISTS hello_world_test;" -U postgres; fi
- if [[ "$DB" == "pgsql" ]]; then psql -c "create database hello_world_test;" -U postgres; fi
- if [[ "$DB" == "mysql" ]]; then mysql -e "create database IF NOT EXISTS hello_world_test;" -uroot; fi
# - if [[ "$DB" == "pgsql" ]]; then psql -c "DROP DATABASE IF EXISTS hello_world_test;" -U postgres; fi
# - if [[ "$DB" == "pgsql" ]]; then psql -c "create database hello_world_test;" -U postgres; fi
# - if [[ "$DB" == "mysql" ]]; then mysql -e "create database IF NOT EXISTS hello_world_test;" -uroot; fi

# omitting "script:" will default to phpunit
# use the $DB env variable to determine the phpunit.xml to use
script: phpunit --configuration phpunit_$DB.xml --coverage-text
# script: phpunit --configuration phpunit_$DB.xml --coverage-text

# configure notifications (email, IRC, campfire etc)
notifications:
irc: "irc.freenode.org#yourfavouriteroomfortravis"
# irc: "irc.freenode.org#yourfavouriteroomfortravis"
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ continuous integration with a PHP project.

Here is a sample status icon showing the state of the master branch.

[![Build Status](https://travis-ci.org/travis-ci-examples/php.svg?branch=master)](https://travis-ci.org/travis-ci-examples/php)
[![Build Status](https://app.travis-ci.com/madrizcarlose/php-example.svg?branch=master)](https://travis-ci.org/travis-ci-examples/php)


In order to run this project just fork it on github.com and then [enable](http://about.travis-ci.org/docs/user/getting-started/)
your fork on your [travis-ci profile](http://travis-ci.org/profile). Every push will then trigger a new build on Travis CI.
Expand Down
45 changes: 1 addition & 44 deletions Tests/HelloWorldTest.php
Original file line number Diff line number Diff line change
@@ -1,47 +1,4 @@
<?php

class HelloWorldTest extends PHPUnit_Framework_TestCase
{
/**
* @var PDO
*/
private $pdo;

public function setUp()
{
$this->pdo = new PDO($GLOBALS['db_dsn'], $GLOBALS['db_username'], $GLOBALS['db_password']);
$this->pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$this->pdo->query("CREATE TABLE hello (what VARCHAR(50) NOT NULL)");
}

public function tearDown()
{
$this->pdo->query("DROP TABLE hello");
}

public function testHelloWorld()
{
$helloWorld = new HelloWorld($this->pdo);

$this->assertEquals('Hello World', $helloWorld->hello());
}

public function testHello()
{
$helloWorld = new HelloWorld($this->pdo);

$this->assertEquals('Hello Bar', $helloWorld->hello('Bar'));
}

public function testWhat()
{
$helloWorld = new HelloWorld($this->pdo);

$this->assertFalse($helloWorld->what());

$helloWorld->hello('Bar');

$this->assertEquals('Bar', $helloWorld->what());
}
}

>