Skip to content

Commit

Permalink
add fixtures missing to fix full ParameterTest and solve issue GH-274
Browse files Browse the repository at this point in the history
  • Loading branch information
llaville committed Sep 29, 2020
1 parent e1cac14 commit 2743681
Show file tree
Hide file tree
Showing 30 changed files with 409 additions and 0 deletions.
15 changes: 15 additions & 0 deletions tests/fixtures/references/fputcsv.18881d.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?php // @link https://www.php.net/manual/en/function.fputcsv.php

$list = array (
array('aaa', 'bbb', 'ccc', 'dddd'),
array('123', '456', '789'),
array('"aaa"', '"bbb"')
);

$fp = fopen('file.csv', 'w');

foreach ($list as $fields) {
fputcsv($fp, $fields);
}

fclose($fp);
16 changes: 16 additions & 0 deletions tests/fixtures/references/fputcsv.18881o.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?php // @link https://www.php.net/manual/en/function.fputcsv.php


$list = array (
array('aaa', 'bbb', 'ccc', 'dddd'),
array('123', '456', '789'),
array('"aaa"', '"bbb"')
);

$fp = fopen('file.csv', 'w');

foreach ($list as $fields) {
fputcsv($fp, $fields, '-');
}

fclose($fp);
8 changes: 8 additions & 0 deletions tests/fixtures/references/imagepng.18881d.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?php // @link https://www.php.net/manual/en/function.imagepng.php

$im = imagecreatefrompng("test.png");

header('Content-Type: image/png');

imagepng($im);
imagedestroy($im);
10 changes: 10 additions & 0 deletions tests/fixtures/references/imagepng.18881o.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?php // @link https://www.php.net/manual/en/function.imagepng.php

$im = imagecreatefrompng("test.png");

header('Content-Type: image/png');

$file = 'image.png';

imagepng($im, $file);
imagedestroy($im);
23 changes: 23 additions & 0 deletions tests/fixtures/references/mb_eregi_replace.18881d.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?php // @link https://www.php.net/manual/en/function.mb-eregi-replace.php

function do_translit($st) {
$replacement = array(
"й"=>"i","ц"=>"c","у"=>"u","к"=>"k","е"=>"e","н"=>"n",
"г"=>"g","ш"=>"sh","щ"=>"sh","з"=>"z","х"=>"x","ъ"=>"\'",
"ф"=>"f","ы"=>"i","в"=>"v","а"=>"a","п"=>"p","р"=>"r",
"о"=>"o","л"=>"l","д"=>"d","ж"=>"zh","э"=>"ie","ё"=>"e",
"я"=>"ya","ч"=>"ch","с"=>"c","м"=>"m","и"=>"i","т"=>"t",
"ь"=>"\'","б"=>"b","ю"=>"yu",
"Й"=>"I","Ц"=>"C","У"=>"U","К"=>"K","Е"=>"E","Н"=>"N",
"Г"=>"G","Ш"=>"SH","Щ"=>"SH","З"=>"Z","Х"=>"X","Ъ"=>"\'",
"Ф"=>"F","Ы"=>"I","В"=>"V","А"=>"A","П"=>"P","Р"=>"R",
"О"=>"O","Л"=>"L","Д"=>"D","Ж"=>"ZH","Э"=>"IE","Ё"=>"E",
"Я"=>"YA","Ч"=>"CH","С"=>"C","М"=>"M","И"=>"I","Т"=>"T",
"Ь"=>"\'","Б"=>"B","Ю"=>"YU",
);

foreach($replacement as $i=>$u) {
$st = mb_eregi_replace($i,$u,$st);
}
return $st;
}
23 changes: 23 additions & 0 deletions tests/fixtures/references/mb_eregi_replace.18881o.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?php // @link https://www.php.net/manual/en/function.mb-eregi-replace.php

function do_translit($st) {
$replacement = array(
"й"=>"i","ц"=>"c","у"=>"u","к"=>"k","е"=>"e","н"=>"n",
"г"=>"g","ш"=>"sh","щ"=>"sh","з"=>"z","х"=>"x","ъ"=>"\'",
"ф"=>"f","ы"=>"i","в"=>"v","а"=>"a","п"=>"p","р"=>"r",
"о"=>"o","л"=>"l","д"=>"d","ж"=>"zh","э"=>"ie","ё"=>"e",
"я"=>"ya","ч"=>"ch","с"=>"c","м"=>"m","и"=>"i","т"=>"t",
"ь"=>"\'","б"=>"b","ю"=>"yu",
"Й"=>"I","Ц"=>"C","У"=>"U","К"=>"K","Е"=>"E","Н"=>"N",
"Г"=>"G","Ш"=>"SH","Щ"=>"SH","З"=>"Z","Х"=>"X","Ъ"=>"\'",
"Ф"=>"F","Ы"=>"I","В"=>"V","А"=>"A","П"=>"P","Р"=>"R",
"О"=>"O","Л"=>"L","Д"=>"D","Ж"=>"ZH","Э"=>"IE","Ё"=>"E",
"Я"=>"YA","Ч"=>"CH","С"=>"C","М"=>"M","И"=>"I","Т"=>"T",
"Ь"=>"\'","Б"=>"B","Ю"=>"YU",
);

foreach($replacement as $i=>$u) {
$st = mb_eregi_replace($i,$u,$st,"i");
}
return $st;
}
23 changes: 23 additions & 0 deletions tests/fixtures/references/mberegi_replace.18881d.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?php // @link https://www.php.net/manual/en/function.mb-eregi-replace.php

function do_translit($st) {
$replacement = array(
"й"=>"i","ц"=>"c","у"=>"u","к"=>"k","е"=>"e","н"=>"n",
"г"=>"g","ш"=>"sh","щ"=>"sh","з"=>"z","х"=>"x","ъ"=>"\'",
"ф"=>"f","ы"=>"i","в"=>"v","а"=>"a","п"=>"p","р"=>"r",
"о"=>"o","л"=>"l","д"=>"d","ж"=>"zh","э"=>"ie","ё"=>"e",
"я"=>"ya","ч"=>"ch","с"=>"c","м"=>"m","и"=>"i","т"=>"t",
"ь"=>"\'","б"=>"b","ю"=>"yu",
"Й"=>"I","Ц"=>"C","У"=>"U","К"=>"K","Е"=>"E","Н"=>"N",
"Г"=>"G","Ш"=>"SH","Щ"=>"SH","З"=>"Z","Х"=>"X","Ъ"=>"\'",
"Ф"=>"F","Ы"=>"I","В"=>"V","А"=>"A","П"=>"P","Р"=>"R",
"О"=>"O","Л"=>"L","Д"=>"D","Ж"=>"ZH","Э"=>"IE","Ё"=>"E",
"Я"=>"YA","Ч"=>"CH","С"=>"C","М"=>"M","И"=>"I","Т"=>"T",
"Ь"=>"\'","Б"=>"B","Ю"=>"YU",
);

foreach($replacement as $i=>$u) {
$st = mberegi_replace($i,$u,$st);
}
return $st;
}
23 changes: 23 additions & 0 deletions tests/fixtures/references/mberegi_replace.18881o.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?php // @link https://www.php.net/manual/en/function.mb-eregi-replace.php

function do_translit($st) {
$replacement = array(
"й"=>"i","ц"=>"c","у"=>"u","к"=>"k","е"=>"e","н"=>"n",
"г"=>"g","ш"=>"sh","щ"=>"sh","з"=>"z","х"=>"x","ъ"=>"\'",
"ф"=>"f","ы"=>"i","в"=>"v","а"=>"a","п"=>"p","р"=>"r",
"о"=>"o","л"=>"l","д"=>"d","ж"=>"zh","э"=>"ie","ё"=>"e",
"я"=>"ya","ч"=>"ch","с"=>"c","м"=>"m","и"=>"i","т"=>"t",
"ь"=>"\'","б"=>"b","ю"=>"yu",
"Й"=>"I","Ц"=>"C","У"=>"U","К"=>"K","Е"=>"E","Н"=>"N",
"Г"=>"G","Ш"=>"SH","Щ"=>"SH","З"=>"Z","Х"=>"X","Ъ"=>"\'",
"Ф"=>"F","Ы"=>"I","В"=>"V","А"=>"A","П"=>"P","Р"=>"R",
"О"=>"O","Л"=>"L","Д"=>"D","Ж"=>"ZH","Э"=>"IE","Ё"=>"E",
"Я"=>"YA","Ч"=>"CH","С"=>"C","М"=>"M","И"=>"I","Т"=>"T",
"Ь"=>"\'","Б"=>"B","Ю"=>"YU",
);

foreach($replacement as $i=>$u) {
$st = mberegi_replace($i,$u,$st,"i");
}
return $st;
}
6 changes: 6 additions & 0 deletions tests/fixtures/references/mysqli_escape_string.18881d.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?php // @link https://www.php.net/manual/en/function.mysqli-escape-string.php

$link = mysqli_connect("localhost", "my_user", "my_password", "world");

$city = "'s Hertogenbosch";
$city = mysqli_escape_string($link, $city);
6 changes: 6 additions & 0 deletions tests/fixtures/references/mysqli_escape_string.18881o.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?php // @link https://www.php.net/manual/en/function.mysqli-escape-string.php

$link = mysqli_connect("localhost", "my_user", "my_password", "world");

$city = "'s Hertogenbosch";
$city = mysqli_escape_string($link, $city);
16 changes: 16 additions & 0 deletions tests/fixtures/references/mysqli_query.18881d.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?php // @link https://www.php.net/manual/en/mysqli.query.php

$link = mysqli_connect("localhost", "my_user", "my_password", "world");

/* check connection */
if (mysqli_connect_errno()) {
printf("Connect failed: %s\n", mysqli_connect_error());
exit();
}

/* Create table doesn't return a resultset */
if (mysqli_query($link, "CREATE TEMPORARY TABLE myCity LIKE City") === TRUE) {
printf("Table myCity successfully created.\n");
}

mysqli_close($link);
18 changes: 18 additions & 0 deletions tests/fixtures/references/mysqli_query.18881o.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?php // @link https://www.php.net/manual/en/mysqli.query.php

$link = mysqli_connect("localhost", "my_user", "my_password", "world");

/* check connection */
if (mysqli_connect_errno()) {
printf("Connect failed: %s\n", mysqli_connect_error());
exit();
}

if ($result = mysqli_query($link, "SELECT Name FROM City LIMIT 10", MYSQLI_ASYNC )) {
printf("Select returned %d rows.\n", mysqli_num_rows($result));

/* free result set */
mysqli_free_result($result);
}

mysqli_close($link);
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?php // @link https://www.php.net/manual/en/mysqli.real-escape-string.php

$link = mysqli_connect("localhost", "my_user", "my_password", "world");

$city = "'s Hertogenbosch";
$city = mysqli_real_escape_string($link, $city);
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?php // @link https://www.php.net/manual/en/mysqli.real-escape-string.php

$link = mysqli_connect("localhost", "my_user", "my_password", "world");

$city = "'s Hertogenbosch";
$city = mysqli_real_escape_string($link, $city);
8 changes: 8 additions & 0 deletions tests/fixtures/references/openssl_decrypt.18881d.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?php // @link https://www.php.net/manual/en/function.openssl-decrypt.php

$data = 'string-to-crypt';

$key = hex2bin('5ae1b8a17bad4da4fdac796f64c16ecd');
$iv = hex2bin('34857d973953e44afb49ea9d61104d8c');

$output = openssl_decrypt($data, 'AES-256-CBC', $key);
8 changes: 8 additions & 0 deletions tests/fixtures/references/openssl_decrypt.18881o.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?php // @link https://www.php.net/manual/en/function.openssl-decrypt.php

$data = 'string-to-crypt';

$key = hex2bin('5ae1b8a17bad4da4fdac796f64c16ecd');
$iv = hex2bin('34857d973953e44afb49ea9d61104d8c');

$output = openssl_decrypt($data, 'AES-256-CBC', $key, OPENSSL_RAW_DATA, $iv);
13 changes: 13 additions & 0 deletions tests/fixtures/references/openssl_encrypt.18881d.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?php // @link https://www.php.net/manual/en/function.openssl-encrypt

$plaintext = "message to be encrypted";
$cipher = "aes-128-gcm";
if (in_array($cipher, openssl_get_cipher_methods()))
{
$ivlen = openssl_cipher_iv_length($cipher);
$iv = openssl_random_pseudo_bytes($ivlen);
$ciphertext = openssl_encrypt($plaintext, $cipher, $key, $options=0, $iv, $tag);
//store $cipher, $iv, and $tag for decryption later
$original_plaintext = openssl_decrypt($ciphertext, $cipher, $key, $options=0, $iv, $tag);
echo $original_plaintext."\n";
}
13 changes: 13 additions & 0 deletions tests/fixtures/references/openssl_encrypt.18881o.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?php // @link https://www.php.net/manual/en/function.openssl-encrypt

$plaintext = "message to be encrypted";
$cipher = "aes-128-gcm";
if (in_array($cipher, openssl_get_cipher_methods()))
{
$ivlen = openssl_cipher_iv_length($cipher);
$iv = openssl_random_pseudo_bytes($ivlen);
$ciphertext = openssl_encrypt($plaintext, $cipher, $key, $options=0, $iv, $tag);
//store $cipher, $iv, and $tag for decryption later
$original_plaintext = openssl_decrypt($ciphertext, $cipher, $key, $options=0, $iv, $tag);
echo $original_plaintext."\n";
}
16 changes: 16 additions & 0 deletions tests/fixtures/references/openssl_open.18881d.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?php // @link https://www.php.net/manual/en/function.openssl-open.php

$fp = fopen("/src/openssl-0.9.6/demos/sign/key.pem", "r");
$priv_key = fread($fp, 8192);
fclose($fp);
$pkeyid = openssl_get_privatekey($priv_key);

// decrypt the data and store it in $open
if (openssl_open($sealed, $open, $env_key, $pkeyid)) {
echo "here is the opened data: ", $open;
} else {
echo "failed to open data";
}

// free the private key from memory
openssl_free_key($pkeyid);
16 changes: 16 additions & 0 deletions tests/fixtures/references/openssl_open.18881o.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?php // @link https://www.php.net/manual/en/function.openssl-open.php

$fp = fopen("/src/openssl-0.9.6/demos/sign/key.pem", "r");
$priv_key = fread($fp, 8192);
fclose($fp);
$pkeyid = openssl_get_privatekey($priv_key);

// decrypt the data and store it in $open
if (openssl_open($sealed, $open, $env_key, $pkeyid)) {
echo "here is the opened data: ", $open;
} else {
echo "failed to open data";
}

// free the private key from memory
openssl_free_key($pkeyid);
19 changes: 19 additions & 0 deletions tests/fixtures/references/openssl_seal.18881d.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?php // @link https://www.php.net/manual/en/function.openssl-seal.php

$fp = fopen("/src/openssl-0.9.6/demos/maurice/cert.pem", "r");
$cert = fread($fp, 8192);
fclose($fp);
$pk1 = openssl_get_publickey($cert);
// Repeat for second recipient
$fp = fopen("/src/openssl-0.9.6/demos/sign/cert.pem", "r");
$cert = fread($fp, 8192);
fclose($fp);
$pk2 = openssl_get_publickey($cert);

// seal message, only owners of $pk1 and $pk2 can decrypt $sealed with keys
// $ekeys[0] and $ekeys[1] respectively.
openssl_seal($data, $sealed, $ekeys, array($pk1, $pk2));

// free the keys from memory
openssl_free_key($pk1);
openssl_free_key($pk2);
19 changes: 19 additions & 0 deletions tests/fixtures/references/openssl_seal.18881o.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?php // @link https://www.php.net/manual/en/function.openssl-seal.php

$fp = fopen("/src/openssl-0.9.6/demos/maurice/cert.pem", "r");
$cert = fread($fp, 8192);
fclose($fp);
$pk1 = openssl_get_publickey($cert);
// Repeat for second recipient
$fp = fopen("/src/openssl-0.9.6/demos/sign/cert.pem", "r");
$cert = fread($fp, 8192);
fclose($fp);
$pk2 = openssl_get_publickey($cert);

// seal message, only owners of $pk1 and $pk2 can decrypt $sealed with keys
// $ekeys[0] and $ekeys[1] respectively.
openssl_seal($data, $sealed, $ekeys, array($pk1, $pk2));

// free the keys from memory
openssl_free_key($pk1);
openssl_free_key($pk2);
17 changes: 17 additions & 0 deletions tests/fixtures/references/pg_fetch_all.18881d.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?php // @link https://www.php.net/manual/en/function.pg-fetch-all.php

$conn = pg_pconnect("dbname=publisher");
if (!$conn) {
echo "An error occurred.\n";
exit;
}

$result = pg_query($conn, "SELECT * FROM authors");
if (!$result) {
echo "An error occurred.\n";
exit;
}

$arr = pg_fetch_all($result);

print_r($arr);
17 changes: 17 additions & 0 deletions tests/fixtures/references/pg_fetch_all.18881o.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?php // @link https://www.php.net/manual/en/function.pg-fetch-all.php

$conn = pg_pconnect("dbname=publisher");
if (!$conn) {
echo "An error occurred.\n";
exit;
}

$result = pg_query($conn, "SELECT * FROM authors");
if (!$result) {
echo "An error occurred.\n";
exit;
}

$arr = pg_fetch_all($result, PGSQL_ASSOC );

print_r($arr);
9 changes: 9 additions & 0 deletions tests/fixtures/references/pg_last_notice.18881d.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?php // @link https://www.php.net/manual/en/function.pg-last-notice

$pgsql_conn = pg_connect("dbname=mark host=localhost");

$res = pg_query("CREATE TABLE test (id SERIAL)");

$notice = pg_last_notice($pgsql_conn);

echo $notice;
9 changes: 9 additions & 0 deletions tests/fixtures/references/pg_last_notice.18881o.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?php // @link https://www.php.net/manual/en/function.pg-last-notice

$pgsql_conn = pg_connect("dbname=mark host=localhost");

$res = pg_query("CREATE TABLE test (id SERIAL)");

$notice = pg_last_notice($pgsql_conn, PGSQL_NOTICE_ALL );

echo $notice;
Loading

0 comments on commit 2743681

Please sign in to comment.