Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
matyhtf committed May 9, 2024
1 parent 4662202 commit fe3a5f8
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion tests/swoole_client_sync/eof.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ $pm->parentFunc = function ($pid) use ($port) {
for ($i = 0; $i < 1000; $i++) {
$pkg = $client->recv();
Assert::assert($pkg != false);
$_pkg = unserialize($pkg);
$_pkg = swoole_substr_unserialize($pkg, 0, strlen($pkg) - 4);
Assert::assert(is_array($_pkg));
Assert::same($_pkg['i'], $i);
Assert::assert(strlen($_pkg['data']) > 8192 and strlen($_pkg['data']) <= 256 * 1024);
Expand Down
2 changes: 1 addition & 1 deletion tests/swoole_client_sync/eof_close.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ $pm->parentFunc = function ($pid) use ($port, $pkg, $pm) {
$client->send("recv\r\n\r\n");
$recvPkg = $client->recv();
Assert::assert($recvPkg != false);
$_pkg = unserialize($recvPkg);
$_pkg = swoole_substr_unserialize($recvPkg, 0, strlen($recvPkg) - 4);
Assert::assert(is_array($_pkg));
Assert::eq($_pkg['data'], $pkg);
$recvPkg = $client->recv();
Expand Down
4 changes: 2 additions & 2 deletions tests/swoole_function/substr_unserialize.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ $a['int'] = rand(1, 999999);
$a['list'] = ['a,', 'b', 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'];

$val = serialize($a);
$str = pack('N', strlen($val)).$val."\r\n";
$str = pack('N', strlen($val)) . $val . "\r\n";

$l = strlen($str) - 6;
Assert::eq(swoole_substr_unserialize($str, 4, $l), $a);
Assert::eq(swoole_substr_unserialize($str, 4), $a);
Assert::eq(@swoole_substr_unserialize($str, 4), $a);
Assert::eq(@swoole_substr_unserialize($str, 0), false);
Assert::eq(@swoole_substr_unserialize($str, 6), false);
Assert::eq(@swoole_substr_unserialize($str, 4, $l - 4), false);
Expand Down
2 changes: 1 addition & 1 deletion tests/swoole_pdo_oracle/bug44301.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,5 @@ run(function() {
?>
--EXPECTF--
SQLSTATE[HY000]: General error: 942 OCIStmtExecute: ORA-00942: table or view does not exist
Help: %s
Help: %s
(%s:%d)"
2 changes: 1 addition & 1 deletion tests/swoole_pdo_oracle/bug_33707.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,6 @@ array(3) {
int(942)
[2]=>
string(%d) "OCIStmtExecute: ORA-00942: table or view does not exist
Help: %s
Help: %s
(%s:%d)"
}
4 changes: 2 additions & 2 deletions tests/swoole_pdo_oracle/pdo_oci_attr_autocommit_2.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,8 @@ Test 1 Check beginTransaction insertion
Test 2 Cause an exception and test beginTransaction rollback
Caught expected exception at line %d
SQLSTATE[HY000]: General error: 12899 OCIStmtExecute: ORA-12899: %s
Help: %s
(%s:%d)"
Help: %s
(%s:%d)
Test 3 Setting ATTR_AUTOCOMMIT to true will commit and end the transaction
PDO::ATTR_AUTOCOMMIT: bool(true)
Caught expected exception at line %d
Expand Down

0 comments on commit fe3a5f8

Please sign in to comment.