Skip to content

Commit

Permalink
Merge pull request #16 from Algatux/tests
Browse files Browse the repository at this point in the history
Missing testsuite
  • Loading branch information
peelandsee committed Jun 8, 2016
2 parents f84b317 + d116a4e commit 351ce2e
Show file tree
Hide file tree
Showing 5 changed files with 130 additions and 4 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
.idea
vendor
bin
composer.phar
composer.lock
69 changes: 69 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
language: php

php:
- 5.4
- 5.5
- 5.6
- 7.0
- hhvm

matrix:
fast_finish: true
include:
- php: '5.4'
env: COMPOSER_FLAGS="--prefer-lowest"
- php: '5.4'
env: SYMFONY=2.8.*

- php: '5.5'
env: COMPOSER_FLAGS="--prefer-lowest"
- php: '5.5'
env: SYMFONY=2.8.*
- php: '5.5'
env: SYMFONY=3.0.*

- php: '5.6'
env: COMPOSER_FLAGS="--prefer-lowest"
- php: '5.6'
env: SYMFONY=2.8.*
- php: '5.6'
env: SYMFONY=3.0.*
- php: '5.6'
env: SYMFONY=3.1.*

- php: '7.0'
env: COMPOSER_FLAGS="--prefer-lowest"
- php: '7.0'
env: SYMFONY=2.8.*
- php: '7.0'
env: SYMFONY=3.0.*
- php: '7.0'
env: SYMFONY=3.1.*
- php: '7.0'
env: SYMFONY=dev-master

allow_failures:
- env: SYMFONY=3.1.*
- env: SYMFONY=dev-master

cache:
directories:
- $HOME/.composer/cache/files

before_install:
- if [ "$TRAVIS_PHP_VERSION" != "hhvm" ]; then phpenv config-rm xdebug.ini; fi;
- composer self-update
- if [ "$SYMFONY" != "" ]; then composer require "symfony/symfony:${SYMFONY}" --no-update; fi;

install:
- composer update --prefer-dist --no-interaction ${COMPOSER_FLAGS}

before_script:
- if [ "$TRAVIS_PHP_VERSION" != "hhvm" ]; then echo "zend_extension=xdebug.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini; fi;

script:
- bin/phpunit

notifications:
on_success: never
on_failure: always
15 changes: 11 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,26 @@
"name": "facile-it/doctrine-mysql-come-back",
"description": "Auto reconnect on Doctrine MySql has gone away exceptions on doctrine/dbal",
"keywords": ["mysql","doctrine","reconnect","refresh","connection","has gone away","exception"],
"require": {
"php" : ">=5.4",
"doctrine/dbal": ">=2.3,<2.6-dev"
},
"license": "Apache License Version 2.0",
"authors": [
{
"name": "Luca Bo",
"email": "[email protected]"
}
],
"require": {
"php" : ">=5.4",
"doctrine/dbal": ">=2.3,<2.6-dev"
},
"require-dev": {
"phpunit/phpunit": "^4.8"
},
"autoload": {
"psr-4": { "Facile\\DoctrineMySQLComeBack\\Doctrine\\DBAL\\": "src/" }
},
"config": {
"preferred-install": "dist",
"bin-dir": "bin"
},
"minimum-stability": "stable"
}
28 changes: 28 additions & 0 deletions phpunit.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>

<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/4.1/phpunit.xsd"
backupGlobals="false"
colors="true"
bootstrap="vendor/autoload.php"
>
<php>
<ini name="error_reporting" value="-1" />
</php>

<testsuites>
<testsuite name="doctrine-mysql-come-back testsuite">
<directory>./tests/</directory>
</testsuite>
</testsuites>

<filter>
<whitelist>
<directory>./src/</directory>
<exclude>
<directory>./tests</directory>
<directory>./vendor</directory>
</exclude>
</whitelist>
</filter>
</phpunit>
21 changes: 21 additions & 0 deletions tests/unit/StatementTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?php

use Facile\DoctrineMySQLComeBack\Doctrine\DBAL\Statement;

class StatementTest extends \PHPUnit_Framework_TestCase
{

public function test_construction()
{
$sql = 'SELECT 1';
$connection = $this->prophesize('Facile\DoctrineMySQLComeBack\Doctrine\DBAL\Connection');
$connection
->prepareUnwrapped($sql)
->shouldBeCalledTimes(1);

$statement = new Statement($sql, $connection->reveal());

$this->assertInstanceOf('Facile\DoctrineMySQLComeBack\Doctrine\DBAL\Statement', $statement);
}

}

0 comments on commit 351ce2e

Please sign in to comment.