summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavey Shafik <me@daveyshafik.com>2016-02-05 02:30:40 -0500
committerDavey Shafik <me@daveyshafik.com>2016-02-05 03:32:37 -0500
commit8321437895a364345544a5b5ba48e1d256d53003 (patch)
tree866e2a40d67d14e38dfa3e3fb00718537842ebd6
parent743bc7fcac808b9048e6f1266cc93202b5d66e63 (diff)
downloadphp7-mysql-shim-8321437895a364345544a5b5ba48e1d256d53003.zip
php7-mysql-shim-8321437895a364345544a5b5ba48e1d256d53003.tar.gz
php7-mysql-shim-8321437895a364345544a5b5ba48e1d256d53003.tar.bz2
Fix tests, better HHVM skipping exception handling
-rw-r--r--composer.json2
-rw-r--r--composer.lock118
-rw-r--r--tests/MySqlShimTest.php40
3 files changed, 79 insertions, 81 deletions
diff --git a/composer.json b/composer.json
index 837a059..e626d02 100644
--- a/composer.json
+++ b/composer.json
@@ -12,7 +12,7 @@
"require-dev": {
"squizlabs/php_codesniffer": "^2.3",
"fabpot/php-cs-fixer": "^1.9",
- "phpunit/phpunit": "^5.1"
+ "phpunit/phpunit": "^5.2"
},
"autoload": {
"files": ["lib/mysql.php"]
diff --git a/composer.lock b/composer.lock
index 9a24d7d..a89b197 100644
--- a/composer.lock
+++ b/composer.lock
@@ -4,7 +4,7 @@
"Read more about it at http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
"This file is @generated automatically"
],
- "hash": "1614360ecd1754ede53dd90e62663fb1",
+ "hash": "e554392e93b8beab1ef25067f2431638",
"packages": [],
"packages-dev": [
{
@@ -268,16 +268,16 @@
},
{
"name": "phpunit/php-code-coverage",
- "version": "3.1.0",
+ "version": "3.1.1",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/php-code-coverage.git",
- "reference": "64d40a593fc31a8abf4ce3d200147ddf8ca64e52"
+ "reference": "92f5c61b5c64159faec5298325ffab0c7e59dcc8"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/64d40a593fc31a8abf4ce3d200147ddf8ca64e52",
- "reference": "64d40a593fc31a8abf4ce3d200147ddf8ca64e52",
+ "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/92f5c61b5c64159faec5298325ffab0c7e59dcc8",
+ "reference": "92f5c61b5c64159faec5298325ffab0c7e59dcc8",
"shasum": ""
},
"require": {
@@ -286,7 +286,7 @@
"phpunit/php-text-template": "~1.2",
"phpunit/php-token-stream": "~1.3",
"sebastian/environment": "^1.3.2",
- "sebastian/version": "~1.0"
+ "sebastian/version": "~1.0|~2.0"
},
"require-dev": {
"ext-xdebug": ">=2.1.4",
@@ -326,7 +326,7 @@
"testing",
"xunit"
],
- "time": "2016-01-11 10:05:34"
+ "time": "2016-02-04 13:05:19"
},
{
"name": "phpunit/php-file-iterator",
@@ -508,16 +508,16 @@
},
{
"name": "phpunit/phpunit",
- "version": "5.1.7",
+ "version": "5.2.0",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/phpunit.git",
- "reference": "d0f7ae467dcbe7a6ad050540c9d1d39a7aefff26"
+ "reference": "d5a3df263ea4fda53d15d5dd7446d2d5f86543e4"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/d0f7ae467dcbe7a6ad050540c9d1d39a7aefff26",
- "reference": "d0f7ae467dcbe7a6ad050540c9d1d39a7aefff26",
+ "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/d5a3df263ea4fda53d15d5dd7446d2d5f86543e4",
+ "reference": "d5a3df263ea4fda53d15d5dd7446d2d5f86543e4",
"shasum": ""
},
"require": {
@@ -529,7 +529,7 @@
"myclabs/deep-copy": "~1.3",
"php": ">=5.6",
"phpspec/prophecy": "^1.3.1",
- "phpunit/php-code-coverage": "~3.0",
+ "phpunit/php-code-coverage": "~3.1",
"phpunit/php-file-iterator": "~1.4",
"phpunit/php-text-template": "~1.2",
"phpunit/php-timer": ">=1.0.6",
@@ -540,7 +540,7 @@
"sebastian/exporter": "~1.2",
"sebastian/global-state": "~1.0",
"sebastian/resource-operations": "~1.0",
- "sebastian/version": "~1.0",
+ "sebastian/version": "~2.0",
"symfony/yaml": "~2.1|~3.0"
},
"suggest": {
@@ -552,7 +552,7 @@
"type": "library",
"extra": {
"branch-alias": {
- "dev-master": "5.1.x-dev"
+ "dev-master": "5.2.x-dev"
}
},
"autoload": {
@@ -578,7 +578,7 @@
"testing",
"xunit"
],
- "time": "2016-02-02 09:03:29"
+ "time": "2016-02-04 13:12:44"
},
{
"name": "phpunit/phpunit-mock-objects",
@@ -1016,19 +1016,27 @@
},
{
"name": "sebastian/version",
- "version": "1.0.6",
+ "version": "2.0.0",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/version.git",
- "reference": "58b3a85e7999757d6ad81c787a1fbf5ff6c628c6"
+ "reference": "c829badbd8fdf16a0bad8aa7fa7971c029f1b9c5"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/58b3a85e7999757d6ad81c787a1fbf5ff6c628c6",
- "reference": "58b3a85e7999757d6ad81c787a1fbf5ff6c628c6",
+ "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/c829badbd8fdf16a0bad8aa7fa7971c029f1b9c5",
+ "reference": "c829badbd8fdf16a0bad8aa7fa7971c029f1b9c5",
"shasum": ""
},
+ "require": {
+ "php": ">=5.6"
+ },
"type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "2.0.x-dev"
+ }
+ },
"autoload": {
"classmap": [
"src/"
@@ -1047,7 +1055,7 @@
],
"description": "Library that helps with managing the version number of Git-hosted PHP projects",
"homepage": "https://github.com/sebastianbergmann/version",
- "time": "2015-06-21 13:59:46"
+ "time": "2016-02-04 12:56:52"
},
{
"name": "squizlabs/php_codesniffer",
@@ -1128,16 +1136,16 @@
},
{
"name": "symfony/console",
- "version": "v3.0.1",
+ "version": "v3.0.2",
"source": {
"type": "git",
"url": "https://github.com/symfony/console.git",
- "reference": "ebcdc507829df915f4ca23067bd59ee4ef61f6c3"
+ "reference": "5a02eaadaa285e2bb727eb6bbdfb8201fcd971b0"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/console/zipball/ebcdc507829df915f4ca23067bd59ee4ef61f6c3",
- "reference": "ebcdc507829df915f4ca23067bd59ee4ef61f6c3",
+ "url": "https://api.github.com/repos/symfony/console/zipball/5a02eaadaa285e2bb727eb6bbdfb8201fcd971b0",
+ "reference": "5a02eaadaa285e2bb727eb6bbdfb8201fcd971b0",
"shasum": ""
},
"require": {
@@ -1184,20 +1192,20 @@
],
"description": "Symfony Console Component",
"homepage": "https://symfony.com",
- "time": "2015-12-22 10:39:06"
+ "time": "2016-02-02 13:44:19"
},
{
"name": "symfony/event-dispatcher",
- "version": "v3.0.1",
+ "version": "v3.0.2",
"source": {
"type": "git",
"url": "https://github.com/symfony/event-dispatcher.git",
- "reference": "d36355e026905fa5229e1ed7b4e9eda2e67adfcf"
+ "reference": "4dd5df31a28c0f82b41cb1e1599b74b5dcdbdafa"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/d36355e026905fa5229e1ed7b4e9eda2e67adfcf",
- "reference": "d36355e026905fa5229e1ed7b4e9eda2e67adfcf",
+ "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/4dd5df31a28c0f82b41cb1e1599b74b5dcdbdafa",
+ "reference": "4dd5df31a28c0f82b41cb1e1599b74b5dcdbdafa",
"shasum": ""
},
"require": {
@@ -1244,20 +1252,20 @@
],
"description": "Symfony EventDispatcher Component",
"homepage": "https://symfony.com",
- "time": "2015-10-30 23:35:59"
+ "time": "2016-01-27 05:14:46"
},
{
"name": "symfony/filesystem",
- "version": "v3.0.1",
+ "version": "v3.0.2",
"source": {
"type": "git",
"url": "https://github.com/symfony/filesystem.git",
- "reference": "c2e59d11dccd135dc8f00ee97f34fe1de842e70c"
+ "reference": "064ac12afd2ceb8a2c1bfb7bed8e931c6dd1997f"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/filesystem/zipball/c2e59d11dccd135dc8f00ee97f34fe1de842e70c",
- "reference": "c2e59d11dccd135dc8f00ee97f34fe1de842e70c",
+ "url": "https://api.github.com/repos/symfony/filesystem/zipball/064ac12afd2ceb8a2c1bfb7bed8e931c6dd1997f",
+ "reference": "064ac12afd2ceb8a2c1bfb7bed8e931c6dd1997f",
"shasum": ""
},
"require": {
@@ -1293,20 +1301,20 @@
],
"description": "Symfony Filesystem Component",
"homepage": "https://symfony.com",
- "time": "2015-12-22 10:39:06"
+ "time": "2016-01-27 11:34:55"
},
{
"name": "symfony/finder",
- "version": "v3.0.1",
+ "version": "v3.0.2",
"source": {
"type": "git",
"url": "https://github.com/symfony/finder.git",
- "reference": "8617895eb798b6bdb338321ce19453dc113e5675"
+ "reference": "623bda0abd9aa29e529c8e9c08b3b84171914723"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/finder/zipball/8617895eb798b6bdb338321ce19453dc113e5675",
- "reference": "8617895eb798b6bdb338321ce19453dc113e5675",
+ "url": "https://api.github.com/repos/symfony/finder/zipball/623bda0abd9aa29e529c8e9c08b3b84171914723",
+ "reference": "623bda0abd9aa29e529c8e9c08b3b84171914723",
"shasum": ""
},
"require": {
@@ -1342,7 +1350,7 @@
],
"description": "Symfony Finder Component",
"homepage": "https://symfony.com",
- "time": "2015-12-05 11:13:14"
+ "time": "2016-01-27 05:14:46"
},
{
"name": "symfony/polyfill-mbstring",
@@ -1405,16 +1413,16 @@
},
{
"name": "symfony/process",
- "version": "v3.0.1",
+ "version": "v3.0.2",
"source": {
"type": "git",
"url": "https://github.com/symfony/process.git",
- "reference": "f4794f1d00f0746621be3020ffbd8c5e0b217ee3"
+ "reference": "dfecef47506179db2501430e732adbf3793099c8"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/process/zipball/f4794f1d00f0746621be3020ffbd8c5e0b217ee3",
- "reference": "f4794f1d00f0746621be3020ffbd8c5e0b217ee3",
+ "url": "https://api.github.com/repos/symfony/process/zipball/dfecef47506179db2501430e732adbf3793099c8",
+ "reference": "dfecef47506179db2501430e732adbf3793099c8",
"shasum": ""
},
"require": {
@@ -1450,20 +1458,20 @@
],
"description": "Symfony Process Component",
"homepage": "https://symfony.com",
- "time": "2015-12-23 11:04:02"
+ "time": "2016-02-02 13:44:19"
},
{
"name": "symfony/stopwatch",
- "version": "v3.0.1",
+ "version": "v3.0.2",
"source": {
"type": "git",
"url": "https://github.com/symfony/stopwatch.git",
- "reference": "6aeac8907e3e1340a0033b0a9ec075f8e6524800"
+ "reference": "4a204804952ff267ace88cf499e0b4bb302a475e"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/stopwatch/zipball/6aeac8907e3e1340a0033b0a9ec075f8e6524800",
- "reference": "6aeac8907e3e1340a0033b0a9ec075f8e6524800",
+ "url": "https://api.github.com/repos/symfony/stopwatch/zipball/4a204804952ff267ace88cf499e0b4bb302a475e",
+ "reference": "4a204804952ff267ace88cf499e0b4bb302a475e",
"shasum": ""
},
"require": {
@@ -1499,20 +1507,20 @@
],
"description": "Symfony Stopwatch Component",
"homepage": "https://symfony.com",
- "time": "2015-10-30 23:35:59"
+ "time": "2016-01-03 15:35:16"
},
{
"name": "symfony/yaml",
- "version": "v3.0.1",
+ "version": "v3.0.2",
"source": {
"type": "git",
"url": "https://github.com/symfony/yaml.git",
- "reference": "3df409958a646dad2bc5046c3fb671ee24a1a691"
+ "reference": "3cf0709d7fe936e97bee9e954382e449003f1d9a"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/yaml/zipball/3df409958a646dad2bc5046c3fb671ee24a1a691",
- "reference": "3df409958a646dad2bc5046c3fb671ee24a1a691",
+ "url": "https://api.github.com/repos/symfony/yaml/zipball/3cf0709d7fe936e97bee9e954382e449003f1d9a",
+ "reference": "3cf0709d7fe936e97bee9e954382e449003f1d9a",
"shasum": ""
},
"require": {
@@ -1548,7 +1556,7 @@
],
"description": "Symfony Yaml Component",
"homepage": "https://symfony.com",
- "time": "2015-12-26 13:39:53"
+ "time": "2016-02-02 13:44:19"
}
],
"aliases": [],
diff --git a/tests/MySqlShimTest.php b/tests/MySqlShimTest.php
index f8d8f62..b638f89 100644
--- a/tests/MySqlShimTest.php
+++ b/tests/MySqlShimTest.php
@@ -19,8 +19,9 @@ class MySqlShimTest extends \PHPUnit_Framework_TestCase
protected $runtime;
- public function __construct()
+ public function __construct($name = null, array $data = [], $dataName = '')
{
+ parent::__construct($name, $data, $dataName);
$this->runtime = new \SebastianBergmann\Environment\Runtime();
}
@@ -334,14 +335,11 @@ class MySqlShimTest extends \PHPUnit_Framework_TestCase
{
$this->skipForHHVM();
- try {
- $this->getConnection();
- $result = mysql_list_fields("shim_test", "nonexistent");
- } catch (\PHPUnit_Framework_Error_Warning $e) {
- $this->assertEquals('mysql_list_fields(): Unable to save MySQL query result', $e->getMessage());
- }
+ $this->expectException(\PHPUnit_Framework_Error_Warning::class);
+ $this->expectExceptionMessage('mysql_list_fields(): Unable to save MySQL query result');
- $this->assertInstanceOf(\PHPUnit_Framework_Error_Warning::class, $e);
+ $this->getConnection();
+ mysql_list_fields("shim_test", "nonexistent");
}
public function test_mysql_field()
@@ -510,16 +508,13 @@ class MySqlShimTest extends \PHPUnit_Framework_TestCase
{
$this->skipForHHVM($skipHHVM);
- try {
- if ($args !== []) {
- $function(null, ...$args);
- }
- $function(null);
- } catch (\PHPUnit_Framework_Error_Warning $e) {
- $this->assertRegExp('@' . $error . '@', $e->getMessage());
- }
+ $this->expectException(\PHPUnit_Framework_Error_Warning::class);
+ $this->expectExceptionMessageRegExp('@' . $error . '@');
- $this->assertInstanceOf(\PHPUnit_Framework_Error_Warning::class, $e);
+ if ($args !== []) {
+ $function(null, ...$args);
+ }
+ $function(null);
}
/**
@@ -544,7 +539,6 @@ class MySqlShimTest extends \PHPUnit_Framework_TestCase
}
/**
- * @param $function
* @dataProvider mysql_fetch_no_rows_dataProvider
*/
public function test_mysql_fetch_no_rows($function)
@@ -656,14 +650,10 @@ class MySqlShimTest extends \PHPUnit_Framework_TestCase
{
$this->skipForHHVM();
- try {
- mysql_close();
- } catch (\PHPUnit_Framework_Error_Warning $e) {
- $this->assertEquals("mysql_close(): no MySQL-Link resource supplied", $e->getMessage());
- }
-
+ $this->expectException(\PHPUnit_Framework_Error_Warning::class);
+ $this->expectExceptionMessage("mysql_close(): no MySQL-Link resource supplied");
- $this->assertInstanceOf(\PHPUnit_Framework_Error_Warning::class, $e);
+ mysql_close();
}
public function test_mysql_error()