summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--README.md5
-rw-r--r--composer.json2
-rw-r--r--composer.lock146
-rw-r--r--tests/MySqlShimTest.php75
4 files changed, 129 insertions, 99 deletions
diff --git a/README.md b/README.md
index a84fead..5f17442 100644
--- a/README.md
+++ b/README.md
@@ -25,5 +25,6 @@ Once the file is included, it will create `mysql_*` function if they don't alrea
## Caveats
- Calls to `is_resource()` and `get_resource_type()` on MySQL connections and results will fail as these are now their `mysqli` equivalents.
--Some errors are now from `ext/mysqli`, and others are `E_USER_WARNING` instead of `E_WARNING`.
-- Column lengths reported by `mysql_field_len()` assume latin1
+- Some errors are now from `ext/mysqli`, and others are `E_USER_WARNING` instead of `E_WARNING`.
+- You must use the `mysqli.*` INI entries instead of `mysql.*` (e.g. `mysqli.default_user` instead of `mysql.default_usert`)
+- Column lengths reported by `mysql_field_len()` assume `latin1`
diff --git a/composer.json b/composer.json
index aa53015..837a059 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.1"
},
"autoload": {
"files": ["lib/mysql.php"]
diff --git a/composer.lock b/composer.lock
index 34261d6..9a24d7d 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": "4029c3ee9d261492406caa51871b7ca6",
+ "hash": "1614360ecd1754ede53dd90e62663fb1",
"packages": [],
"packages-dev": [
{
@@ -63,16 +63,16 @@
},
{
"name": "fabpot/php-cs-fixer",
- "version": "v1.11",
+ "version": "v1.11.1",
"source": {
"type": "git",
"url": "https://github.com/FriendsOfPHP/PHP-CS-Fixer.git",
- "reference": "bd3ec2c2b774e0e127ac2c737ec646d9cf2f9eef"
+ "reference": "2c9f8298181f059c5077abda78019b9a0c9a7cc0"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/FriendsOfPHP/PHP-CS-Fixer/zipball/bd3ec2c2b774e0e127ac2c737ec646d9cf2f9eef",
- "reference": "bd3ec2c2b774e0e127ac2c737ec646d9cf2f9eef",
+ "url": "https://api.github.com/repos/FriendsOfPHP/PHP-CS-Fixer/zipball/2c9f8298181f059c5077abda78019b9a0c9a7cc0",
+ "reference": "2c9f8298181f059c5077abda78019b9a0c9a7cc0",
"shasum": ""
},
"require": {
@@ -113,7 +113,7 @@
}
],
"description": "A tool to automatically fix PHP code style",
- "time": "2015-12-01 22:34:33"
+ "time": "2016-01-20 19:00:28"
},
{
"name": "myclabs/deep-copy",
@@ -268,16 +268,16 @@
},
{
"name": "phpunit/php-code-coverage",
- "version": "3.0.2",
+ "version": "3.1.0",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/php-code-coverage.git",
- "reference": "f7bb5cddf4ffe113eeb737b05241adb947b43f9d"
+ "reference": "64d40a593fc31a8abf4ce3d200147ddf8ca64e52"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/f7bb5cddf4ffe113eeb737b05241adb947b43f9d",
- "reference": "f7bb5cddf4ffe113eeb737b05241adb947b43f9d",
+ "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/64d40a593fc31a8abf4ce3d200147ddf8ca64e52",
+ "reference": "64d40a593fc31a8abf4ce3d200147ddf8ca64e52",
"shasum": ""
},
"require": {
@@ -300,7 +300,7 @@
"type": "library",
"extra": {
"branch-alias": {
- "dev-master": "3.0.x-dev"
+ "dev-master": "3.1.x-dev"
}
},
"autoload": {
@@ -326,7 +326,7 @@
"testing",
"xunit"
],
- "time": "2015-11-12 21:08:20"
+ "time": "2016-01-11 10:05:34"
},
{
"name": "phpunit/php-file-iterator",
@@ -508,16 +508,16 @@
},
{
"name": "phpunit/phpunit",
- "version": "5.1.0",
+ "version": "5.1.7",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/phpunit.git",
- "reference": "01fb97441708f1616a97cfd3f5c36101db81c635"
+ "reference": "d0f7ae467dcbe7a6ad050540c9d1d39a7aefff26"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/01fb97441708f1616a97cfd3f5c36101db81c635",
- "reference": "01fb97441708f1616a97cfd3f5c36101db81c635",
+ "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/d0f7ae467dcbe7a6ad050540c9d1d39a7aefff26",
+ "reference": "d0f7ae467dcbe7a6ad050540c9d1d39a7aefff26",
"shasum": ""
},
"require": {
@@ -533,7 +533,7 @@
"phpunit/php-file-iterator": "~1.4",
"phpunit/php-text-template": "~1.2",
"phpunit/php-timer": ">=1.0.6",
- "phpunit/phpunit-mock-objects": ">=3.0",
+ "phpunit/phpunit-mock-objects": ">=3.0.5",
"sebastian/comparator": "~1.1",
"sebastian/diff": "~1.2",
"sebastian/environment": "~1.3",
@@ -578,20 +578,20 @@
"testing",
"xunit"
],
- "time": "2015-12-03 16:45:01"
+ "time": "2016-02-02 09:03:29"
},
{
"name": "phpunit/phpunit-mock-objects",
- "version": "3.0.4",
+ "version": "3.0.6",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/phpunit-mock-objects.git",
- "reference": "b28b029356e65091dfbf8c2bc4ef106ffece509e"
+ "reference": "49bc700750196c04dd6bc2c4c99cb632b893836b"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/b28b029356e65091dfbf8c2bc4ef106ffece509e",
- "reference": "b28b029356e65091dfbf8c2bc4ef106ffece509e",
+ "url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/49bc700750196c04dd6bc2c4c99cb632b893836b",
+ "reference": "49bc700750196c04dd6bc2c4c99cb632b893836b",
"shasum": ""
},
"require": {
@@ -634,7 +634,7 @@
"mock",
"xunit"
],
- "time": "2015-11-09 15:37:17"
+ "time": "2015-12-08 08:47:06"
},
{
"name": "sebastian/comparator",
@@ -702,28 +702,28 @@
},
{
"name": "sebastian/diff",
- "version": "1.3.0",
+ "version": "1.4.1",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/diff.git",
- "reference": "863df9687835c62aa423a22412d26fa2ebde3fd3"
+ "reference": "13edfd8706462032c2f52b4b862974dd46b71c9e"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/863df9687835c62aa423a22412d26fa2ebde3fd3",
- "reference": "863df9687835c62aa423a22412d26fa2ebde3fd3",
+ "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/13edfd8706462032c2f52b4b862974dd46b71c9e",
+ "reference": "13edfd8706462032c2f52b4b862974dd46b71c9e",
"shasum": ""
},
"require": {
"php": ">=5.3.3"
},
"require-dev": {
- "phpunit/phpunit": "~4.2"
+ "phpunit/phpunit": "~4.8"
},
"type": "library",
"extra": {
"branch-alias": {
- "dev-master": "1.3-dev"
+ "dev-master": "1.4-dev"
}
},
"autoload": {
@@ -746,11 +746,11 @@
}
],
"description": "Diff implementation",
- "homepage": "http://www.github.com/sebastianbergmann/diff",
+ "homepage": "https://github.com/sebastianbergmann/diff",
"keywords": [
"diff"
],
- "time": "2015-02-22 15:13:53"
+ "time": "2015-12-08 07:14:41"
},
{
"name": "sebastian/environment",
@@ -1051,16 +1051,16 @@
},
{
"name": "squizlabs/php_codesniffer",
- "version": "2.4.0",
+ "version": "2.5.1",
"source": {
"type": "git",
"url": "https://github.com/squizlabs/PHP_CodeSniffer.git",
- "reference": "32a879f4f35019d78d568db2885d7779ca084a33"
+ "reference": "6731851d6aaf1d0d6c58feff1065227b7fda3ba8"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/32a879f4f35019d78d568db2885d7779ca084a33",
- "reference": "32a879f4f35019d78d568db2885d7779ca084a33",
+ "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/6731851d6aaf1d0d6c58feff1065227b7fda3ba8",
+ "reference": "6731851d6aaf1d0d6c58feff1065227b7fda3ba8",
"shasum": ""
},
"require": {
@@ -1068,6 +1068,9 @@
"ext-xmlwriter": "*",
"php": ">=5.1.2"
},
+ "require-dev": {
+ "phpunit/phpunit": "~4.0"
+ },
"bin": [
"scripts/phpcs",
"scripts/phpcbf"
@@ -1075,7 +1078,7 @@
"type": "library",
"extra": {
"branch-alias": {
- "dev-master": "2.0.x-dev"
+ "dev-master": "2.x-dev"
}
},
"autoload": {
@@ -1121,20 +1124,20 @@
"phpcs",
"standards"
],
- "time": "2015-11-23 21:30:59"
+ "time": "2016-01-19 23:39:10"
},
{
"name": "symfony/console",
- "version": "v3.0.0",
+ "version": "v3.0.1",
"source": {
"type": "git",
"url": "https://github.com/symfony/console.git",
- "reference": "175871ca8d1ef16ff8d8cac395a1c73afa8d0e63"
+ "reference": "ebcdc507829df915f4ca23067bd59ee4ef61f6c3"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/console/zipball/175871ca8d1ef16ff8d8cac395a1c73afa8d0e63",
- "reference": "175871ca8d1ef16ff8d8cac395a1c73afa8d0e63",
+ "url": "https://api.github.com/repos/symfony/console/zipball/ebcdc507829df915f4ca23067bd59ee4ef61f6c3",
+ "reference": "ebcdc507829df915f4ca23067bd59ee4ef61f6c3",
"shasum": ""
},
"require": {
@@ -1181,11 +1184,11 @@
],
"description": "Symfony Console Component",
"homepage": "https://symfony.com",
- "time": "2015-11-30 12:36:17"
+ "time": "2015-12-22 10:39:06"
},
{
"name": "symfony/event-dispatcher",
- "version": "v3.0.0",
+ "version": "v3.0.1",
"source": {
"type": "git",
"url": "https://github.com/symfony/event-dispatcher.git",
@@ -1245,16 +1248,16 @@
},
{
"name": "symfony/filesystem",
- "version": "v3.0.0",
+ "version": "v3.0.1",
"source": {
"type": "git",
"url": "https://github.com/symfony/filesystem.git",
- "reference": "692d98d813e4ef314b9c22775c86ddbeb0f44884"
+ "reference": "c2e59d11dccd135dc8f00ee97f34fe1de842e70c"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/filesystem/zipball/692d98d813e4ef314b9c22775c86ddbeb0f44884",
- "reference": "692d98d813e4ef314b9c22775c86ddbeb0f44884",
+ "url": "https://api.github.com/repos/symfony/filesystem/zipball/c2e59d11dccd135dc8f00ee97f34fe1de842e70c",
+ "reference": "c2e59d11dccd135dc8f00ee97f34fe1de842e70c",
"shasum": ""
},
"require": {
@@ -1290,20 +1293,20 @@
],
"description": "Symfony Filesystem Component",
"homepage": "https://symfony.com",
- "time": "2015-11-23 10:41:47"
+ "time": "2015-12-22 10:39:06"
},
{
"name": "symfony/finder",
- "version": "v3.0.0",
+ "version": "v3.0.1",
"source": {
"type": "git",
"url": "https://github.com/symfony/finder.git",
- "reference": "3577eb98dba90721d1a0a3edfc6956ab8b1aecee"
+ "reference": "8617895eb798b6bdb338321ce19453dc113e5675"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/finder/zipball/3577eb98dba90721d1a0a3edfc6956ab8b1aecee",
- "reference": "3577eb98dba90721d1a0a3edfc6956ab8b1aecee",
+ "url": "https://api.github.com/repos/symfony/finder/zipball/8617895eb798b6bdb338321ce19453dc113e5675",
+ "reference": "8617895eb798b6bdb338321ce19453dc113e5675",
"shasum": ""
},
"require": {
@@ -1339,29 +1342,32 @@
],
"description": "Symfony Finder Component",
"homepage": "https://symfony.com",
- "time": "2015-10-30 23:35:59"
+ "time": "2015-12-05 11:13:14"
},
{
"name": "symfony/polyfill-mbstring",
- "version": "v1.0.0",
+ "version": "v1.1.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-mbstring.git",
- "reference": "0b6a8940385311a24e060ec1fe35680e17c74497"
+ "reference": "1289d16209491b584839022f29257ad859b8532d"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/0b6a8940385311a24e060ec1fe35680e17c74497",
- "reference": "0b6a8940385311a24e060ec1fe35680e17c74497",
+ "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/1289d16209491b584839022f29257ad859b8532d",
+ "reference": "1289d16209491b584839022f29257ad859b8532d",
"shasum": ""
},
"require": {
"php": ">=5.3.3"
},
+ "suggest": {
+ "ext-mbstring": "For best performance"
+ },
"type": "library",
"extra": {
"branch-alias": {
- "dev-master": "1.0-dev"
+ "dev-master": "1.1-dev"
}
},
"autoload": {
@@ -1395,20 +1401,20 @@
"portable",
"shim"
],
- "time": "2015-11-04 20:28:58"
+ "time": "2016-01-20 09:13:37"
},
{
"name": "symfony/process",
- "version": "v3.0.0",
+ "version": "v3.0.1",
"source": {
"type": "git",
"url": "https://github.com/symfony/process.git",
- "reference": "01383ed02a1020759bc8ee5d975fcec04ba16fbf"
+ "reference": "f4794f1d00f0746621be3020ffbd8c5e0b217ee3"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/process/zipball/01383ed02a1020759bc8ee5d975fcec04ba16fbf",
- "reference": "01383ed02a1020759bc8ee5d975fcec04ba16fbf",
+ "url": "https://api.github.com/repos/symfony/process/zipball/f4794f1d00f0746621be3020ffbd8c5e0b217ee3",
+ "reference": "f4794f1d00f0746621be3020ffbd8c5e0b217ee3",
"shasum": ""
},
"require": {
@@ -1444,11 +1450,11 @@
],
"description": "Symfony Process Component",
"homepage": "https://symfony.com",
- "time": "2015-11-30 12:36:17"
+ "time": "2015-12-23 11:04:02"
},
{
"name": "symfony/stopwatch",
- "version": "v3.0.0",
+ "version": "v3.0.1",
"source": {
"type": "git",
"url": "https://github.com/symfony/stopwatch.git",
@@ -1497,16 +1503,16 @@
},
{
"name": "symfony/yaml",
- "version": "v3.0.0",
+ "version": "v3.0.1",
"source": {
"type": "git",
"url": "https://github.com/symfony/yaml.git",
- "reference": "177a015cb0e19ff4a49e0e2e2c5fc1c1bee07002"
+ "reference": "3df409958a646dad2bc5046c3fb671ee24a1a691"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/yaml/zipball/177a015cb0e19ff4a49e0e2e2c5fc1c1bee07002",
- "reference": "177a015cb0e19ff4a49e0e2e2c5fc1c1bee07002",
+ "url": "https://api.github.com/repos/symfony/yaml/zipball/3df409958a646dad2bc5046c3fb671ee24a1a691",
+ "reference": "3df409958a646dad2bc5046c3fb671ee24a1a691",
"shasum": ""
},
"require": {
@@ -1542,7 +1548,7 @@
],
"description": "Symfony Yaml Component",
"homepage": "https://symfony.com",
- "time": "2015-11-30 12:36:17"
+ "time": "2015-12-26 13:39:53"
}
],
"aliases": [],
diff --git a/tests/MySqlShimTest.php b/tests/MySqlShimTest.php
index 6d2fa17..2945464 100644
--- a/tests/MySqlShimTest.php
+++ b/tests/MySqlShimTest.php
@@ -221,6 +221,8 @@ class MySqlShimTest extends \PHPUnit_Framework_TestCase
public function test_mysql_db_query()
{
+ $this->skipForHHVM();
+
$this->getConnection();
$result = mysql_db_query("shim_test", "SELECT DATABASE()");
$this->assertResult($result);
@@ -232,6 +234,8 @@ class MySqlShimTest extends \PHPUnit_Framework_TestCase
public function test_mysql_db_query_fail()
{
+ $this->skipForHHVM();
+
$this->getConnection();
$result = mysql_db_query("nonexistent", "SELECT DATABASE()");
$this->assertFalse($result);
@@ -271,6 +275,8 @@ class MySqlShimTest extends \PHPUnit_Framework_TestCase
public function test_mysql_list_tables_fail()
{
+ $this->skipForHHVM();
+
$this->getConnection();
$result = mysql_list_tables("nonexistent");
$this->assertFalse($result);
@@ -278,6 +284,8 @@ class MySqlShimTest extends \PHPUnit_Framework_TestCase
public function test_mysql_list_fields()
{
+ $this->skipForHHVM();
+
$this->getConnection();
$result = mysql_list_fields("shim_test", "testing");
$this->assertResult($result);
@@ -299,14 +307,18 @@ class MySqlShimTest extends \PHPUnit_Framework_TestCase
return;
}
- /**
- * @expectedException \PHPUnit_Framework_Error_Warning
- * @expectedExceptionMessage mysql_list_fields(): Unable to save MySQL query result
- */
public function test_mysql_list_fields_fail()
{
- $this->getConnection();
- $result = mysql_list_fields("shim_test", "nonexistent");
+ $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->assertInstanceOf(\PHPUnit_Framework_Error_Warning::class, $e);
}
public function test_mysql_field()
@@ -389,7 +401,7 @@ class MySqlShimTest extends \PHPUnit_Framework_TestCase
/**
* @expectedException \PHPUnit_Framework_Error_Warning
- * @expectedExceptionMessageRegExp /^(mysql_field_name\(\)):)? Field 999 is invalid for MySQL result index .*$/
+ * @expectedExceptionMessageRegExp /^(mysql_field_name\(\): )?Field 999 is invalid for MySQL result index .*$/
*/
public function test_mysql_field_name_fail()
{
@@ -401,7 +413,7 @@ class MySqlShimTest extends \PHPUnit_Framework_TestCase
/**
* @expectedException \PHPUnit_Framework_Error_Warning
- * @expectedExceptionMessageRegExp /^(mysql_field_table\(\):)? Field 999 is invalid for MySQL result index .*$/
+ * @expectedExceptionMessageRegExp /^(mysql_field_table\(\): )?Field 999 is invalid for MySQL result index .*$/
*/
public function test_mysql_field_table_fail()
{
@@ -413,7 +425,7 @@ class MySqlShimTest extends \PHPUnit_Framework_TestCase
/**
* @expectedException \PHPUnit_Framework_Error_Warning
- * @expectedExceptionMessageRegExp /^(mysql_field_type\(\):)? Field 999 is invalid for MySQL result index .*$/
+ * @expectedExceptionMessageRegExp /^(mysql_field_type\(\): )?Field 999 is invalid for MySQL result index .*$/
*/
public function test_mysql_field_type_fail()
{
@@ -425,7 +437,7 @@ class MySqlShimTest extends \PHPUnit_Framework_TestCase
/**
* @expectedException \PHPUnit_Framework_Error_Warning
- * @expectedExceptionMessageRegExp /^(mysql_field_len\(\):)? Field 999 is invalid for MySQL result index .*$/
+ * @expectedExceptionMessageRegExp /^(mysql_field_len\(\): )?Field 999 is invalid for MySQL result index .*$/
*/
public function test_mysql_field_len_fail()
{
@@ -437,7 +449,7 @@ class MySqlShimTest extends \PHPUnit_Framework_TestCase
/**
* @expectedException \PHPUnit_Framework_Error_Warning
- * @expectedExceptionMessageRegExp /^(mysql_field_flags\(\):)? Field 999 is invalid for MySQL result index .*$/
+ * @expectedExceptionMessageRegExp /^(mysql_field_flags\(\): )?Field 999 is invalid for MySQL result index .*$/
*/
public function test_mysql_field_flags_fail()
{
@@ -471,16 +483,20 @@ class MySqlShimTest extends \PHPUnit_Framework_TestCase
/**
* @dataProvider mysql_function_invalid_result_DataProvider
*/
- public function test_mysql_function_invalid_result($function, $error, $args)
+ public function test_mysql_function_invalid_result($function, $error, $args, $skipHHVM = false)
{
+ $this->skipForHHVM($skipHHVM);
+
try {
if ($args !== []) {
$function(null, ...$args);
}
$function(null);
} catch (\PHPUnit_Framework_Error_Warning $e) {
- $this->assertRequest('@' . $error . '@', $e->getMessage());
+ $this->assertRegExp('@' . $error . '@', $e->getMessage());
}
+
+ $this->assertInstanceOf(\PHPUnit_Framework_Error_Warning::class, $e);
}
/**
@@ -556,7 +572,7 @@ class MySqlShimTest extends \PHPUnit_Framework_TestCase
/**
* @expectedException \PHPUnit_Framework_Error_Warning
- * @expectedExceptionMessageRegExp /^(mysql_result\(\):)? three not found in MySQL result index (.*?)$/
+ * @expectedExceptionMessageRegExp /^(mysql_result\(\): )?three not found in MySQL result index (.*?)$/
*/
public function test_mysql_result_fail()
{
@@ -581,7 +597,7 @@ class MySqlShimTest extends \PHPUnit_Framework_TestCase
/**
* @expectedException \PHPUnit_Framework_Error_Warning
- * @expectedExceptionMessageRegExp /^(mysql_result\(\):)? testing.three not found in MySQL result index (.*?)$/
+ * @expectedExceptionMessageRegExp /^(mysql_result\(\): )?testing.three not found in MySQL result index (.*?)$/
*/
public function test_mysql_result_prefixed_fail()
{
@@ -595,7 +611,7 @@ class MySqlShimTest extends \PHPUnit_Framework_TestCase
/**
* @expectedException \PHPUnit_Framework_Error_Warning
- * @expectedExceptionMessageRegExp /^(mysql_result\(\):)? Unable to jump to row 1 on MySQL result index (.*?)$/
+ * @expectedExceptionMessageRegExp /^(mysql_result\(\): )?Unable to jump to row 1 on MySQL result index (.*?)$/
*/
public function test_mysql_result_invalid_row()
{
@@ -613,15 +629,18 @@ class MySqlShimTest extends \PHPUnit_Framework_TestCase
$this->assertTrue(mysql_close());
}
- /**
- * @expectedException \PHPUnit_Framework_Error_Warning
- * @expectedExceptionMessage mysql_close(): no MySQL-Link resource supplied
- */
public function test_mysql_close_fail()
{
$this->skipForHHVM();
- mysql_close();
+ try {
+ mysql_close();
+ } catch (\PHPUnit_Framework_Error_Warning $e) {
+ $this->assertEquals("mysql_close(): no MySQL-Link resource supplied", $e->getMessage());
+ }
+
+
+ $this->assertInstanceOf(\PHPUnit_Framework_Error_Warning::class, $e);
}
public function test_mysql_error()
@@ -847,6 +866,7 @@ class MySqlShimTest extends \PHPUnit_Framework_TestCase
"function" => "mysql_fetch_row",
"message" => "mysql_fetch_row\(\) expects parameter 1 to be resource, (null|NULL) given",
"args" => [],
+ "skipHHVM" => true
],
[
"function" => "mysql_fetch_array",
@@ -857,10 +877,11 @@ class MySqlShimTest extends \PHPUnit_Framework_TestCase
"function" => "mysql_fetch_assoc",
"message" => "mysql_fetch_assoc\(\) expects parameter 1 to be resource, (null|NULL) given",
"args" => [],
+ "skipHHVM" => true
],
[
"function" => "mysql_fetch_object",
- "message" => "mysql_fetch_object\(\): supplied argument is not a valid (null|NULL) result resource",
+ "message" => "(mysql_fetch_object\(\): )?supplied argument is not a valid MySQL result resource",
"args" => ["StdClass"]
],
[
@@ -916,12 +937,14 @@ class MySqlShimTest extends \PHPUnit_Framework_TestCase
[
"function" => "mysql_db_name",
"message" => "mysql_db_name\(\) expects parameter 1 to be resource, (null|NULL) given",
- "args" => [0]
+ "args" => [0],
+ "skipHHVM" => true
],
[
"function" => "mysql_tablename",
"message" => "mysql_tablename\(\) expects parameter 1 to be resource, (null|NULL) given",
- "args" => [0]
+ "args" => [0],
+ "skipHHVM" => true
],
];
}
@@ -993,9 +1016,9 @@ class MySqlShimTest extends \PHPUnit_Framework_TestCase
);
}
- protected function skipForHHVM()
+ protected function skipForHHVM($condition = true)
{
- if (defined('HHVM_VERSION')) {
+ if (defined('HHVM_VERSION') && $condition) {
$this->markTestSkipped("HHVM Behavior differs from PHP");
}
}