Skip to content

Commit

Permalink
hhvm workarounds, with xdebug via travis-ci/travis-ci#2980
Browse files Browse the repository at this point in the history
  • Loading branch information
SignpostMarv committed Oct 16, 2016
1 parent fc36b0f commit deb3a69
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 6 deletions.
3 changes: 1 addition & 2 deletions composer.json
Expand Up @@ -38,7 +38,6 @@
}
},
"require": {
"php": "^7.0",
"ext-pdo": "^7.0"
"ext-pdo": "*"
}
}
7 changes: 6 additions & 1 deletion phpunit.sh
Expand Up @@ -36,7 +36,12 @@ if [ $? -eq 0 ]; then
echo
echo -e "\033[33mBegin Unit Testing\033[0m"
# Run the testing suite
php phpunit.phar
if [ "$TRAVIS_PHP_VERSION" = 'hhvm' ]; then
echo 'xdebug.enable = On' >> /etc/hhvm/php.ini;
hhvm -v Eval.EnableHipHopSyntax=true phpunit.phar
else
php phpunit.phar
fi
# Cleanup
if [ "$clean" -eq 1 ]; then
echo -e "\033[32mCleaning Up!\033[0m"
Expand Down
55 changes: 52 additions & 3 deletions tests/EscapeIdentifierTest.php
Expand Up @@ -3,7 +3,10 @@

namespace ParagonIE\EasyDB\Tests;

use Throwable;
use ParagonIE\EasyDB\EasyDB;
use ParagonIE\EasyDB\Exception as Issues;
use PHPUnit_Framework_Error;
use TypeError;

class EscapeIdentifierTest
extends
Expand Down Expand Up @@ -110,8 +113,54 @@ public function testEscapeIdentifier(callable $cb, $identifier)
public function testEscapeIdentifierThrowsSomething(callable $cb, $identifier)
{
$db = $this->EasyDBExpectedFromCallable($cb);
$this->expectException(Throwable::class);
$db->escapeIdentifier($identifier);
$thrown = false;
try {
$db->escapeIdentifier($identifier);
} catch (Issues\InvalidIdentifier $e) {
$this->assertTrue(true);
$thrown = true;
} catch (TypeError $e) {
$this->assertTrue(true);
$thrown = true;
} catch (PHPUnit_Framework_Error $e) {
if (
preg_match(
(
'/^' .
preg_quote(
('Argument 1 passed to ' . EasyDB::class . '::escapeIdentifier()'),
'/'
) .
' must be an instance of string, [^ ]+ given$/'
),
$e->getMessage()
)
) {
$this->assertTrue(true);
$thrown = true;
} else {
throw $e;
}
} finally {
if (!$thrown) {
$this->assertTrue(
false,
(
'Argument 2 of ' .
static::class .
'::' .
__METHOD__ .
'() must cause either ' .
Issues\InvalidIdentifier::class .
' or ' .
TypeError::class .
' (' .
var_export($identifier, true) .
')'
)
);
}
}
}


Expand Down

0 comments on commit deb3a69

Please sign in to comment.