From: Antony Dovgal Date: Tue, 12 Sep 2006 20:32:39 +0000 (+0000) Subject: new tests X-Git-Tag: php-5.2.0RC4~20 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=6e0915b631e3a7c6b3fa66adc1d88dd84189645b;p=php new tests --- diff --git a/ext/oci8/tests/array_bind_013.phpt b/ext/oci8/tests/array_bind_013.phpt new file mode 100644 index 0000000000..da8f6fdd1a --- /dev/null +++ b/ext/oci8/tests/array_bind_013.phpt @@ -0,0 +1,39 @@ +--TEST-- +oci_bind_array_by_name(), SQLT_CHR, default max_length and empty array +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +Warning: oci_bind_array_by_name() expects at most 6 parameters, 7 given in %s on line %d +NULL + +Warning: oci_bind_array_by_name(): You must provide max length value for empty arrays in %s on line %d +bool(false) + +Warning: oci_bind_array_by_name(): You must provide max length value for empty arrays in %s on line %d +bool(false) + +Warning: oci_bind_array_by_name(): You must provide max length value for empty arrays in %s on line %d +bool(false) +array(0) { +} +Done diff --git a/ext/oci8/tests/define1.phpt b/ext/oci8/tests/define1.phpt new file mode 100644 index 0000000000..f6e04cc185 --- /dev/null +++ b/ext/oci8/tests/define1.phpt @@ -0,0 +1,52 @@ +--TEST-- +oci_define_by_name() +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +bool(true) +bool(false) + +Warning: oci_define_by_name(): Column name cannot be empty in %s on line %d +bool(false) + +Warning: oci_define_by_name() expects at least 3 parameters, 2 given in %s on line %d +NULL +string(4) "some" +Done diff --git a/ext/oci8/tests/lob_021.phpt b/ext/oci8/tests/lob_021.phpt new file mode 100644 index 0000000000..32ef6f9fef --- /dev/null +++ b/ext/oci8/tests/lob_021.phpt @@ -0,0 +1,74 @@ +--TEST-- +oci_lob_free()/close() +--SKIPIF-- + +--FILE-- +write("test")); +var_dump($blob->close()); +var_dump($blob->write("test")); +var_dump(oci_free_descriptor($blob)); +var_dump($blob->write("test")); + +var_dump(oci_free_descriptor($blob)); +var_dump(oci_free_descriptor(new stdclass)); + +$blob = oci_new_descriptor($c,OCI_D_LOB); +unset($blob->descriptor); +var_dump(oci_free_descriptor($blob)); + +oci_commit($c); + +$select_sql = "SELECT blob FROM ".$schema.$table_name.""; +$s = oci_parse($c, $select_sql); +oci_execute($s); + +var_dump(oci_fetch_array($s, OCI_NUM + OCI_RETURN_LOBS)); + +require dirname(__FILE__).'/drop_table.inc'; + +echo "Done\n"; + +?> +--EXPECTF-- +int(4) + +Warning: OCI-Lob::close(): ORA-22289: cannot perform operation on an unopened file or LOB in %s on line %d +bool(false) +int(4) +bool(true) + +Warning: OCI-Lob::write(): %d is not a valid oci8 descriptor resource in %s on line %d +bool(false) + +Warning: oci_free_descriptor(): %d is not a valid oci8 descriptor resource in %s on line %d +bool(false) + +Warning: oci_free_descriptor() expects parameter 1 to be OCI-Lob, object given in %s on line %d +NULL + +Warning: oci_free_descriptor(): Unable to find descriptor property in %s on line %d +bool(false) +array(1) { + [0]=> + string(8) "testtest" +} +Done diff --git a/ext/oci8/tests/lob_022.phpt b/ext/oci8/tests/lob_022.phpt new file mode 100644 index 0000000000..5fb9dfab0e --- /dev/null +++ b/ext/oci8/tests/lob_022.phpt @@ -0,0 +1,80 @@ +--TEST-- +fetching the same lob several times +--SKIPIF-- + +--FILE-- +save(); +oci_lob_save(); +oci_lob_save($clob, "data"); +unset($clob->descriptor); +oci_lob_save($clob, "data"); + +oci_commit($c); + +$init = "INSERT INTO lob_test (mykey, lob_1) VALUES(2, EMPTY_CLOB()) RETURNING lob_1 INTO :mylob"; +$statement = oci_parse($c, $init); +$clob = oci_new_descriptor($c, OCI_D_LOB); +oci_bind_by_name($statement, ":mylob", $clob, -1, OCI_B_CLOB); +oci_execute($statement, OCI_DEFAULT); +$clob->save("long data"); +$clob->save("long data", -1); +$clob->save("long data", 0); + +oci_commit($c); + + +$query = 'SELECT * FROM lob_test ORDER BY mykey ASC'; +$statement = oci_parse ($c, $query); +oci_execute($statement, OCI_DEFAULT); + +while ($row = oci_fetch_array($statement, OCI_ASSOC)) { + $result = $row['LOB_1']->load(); + var_dump($result); +} + +$query = 'SELECT * FROM lob_test ORDER BY mykey DESC'; +$statement = oci_parse ($c, $query); +oci_execute($statement, OCI_DEFAULT); + +while ($row = oci_fetch_array($statement, OCI_ASSOC)) { + $result = $row['LOB_1']->load(); + var_dump($result); +} + +$drop = "DROP table lob_test"; +$statement = oci_parse($c, $drop); +@oci_execute($statement); + +echo "Done\n"; + +?> +--EXPECTF-- +Warning: OCI-Lob::save() expects at least 1 parameter, 0 given in %s on line %d + +Warning: oci_lob_save() expects at least 2 parameters, 0 given in %s on line %d + +Warning: oci_lob_save(): Unable to find descriptor property in %s on line %d + +Warning: OCI-Lob::save(): Offset parameter must be greater than or equal to 0 in %s on line %d +string(4) "data" +string(9) "long data" +string(9) "long data" +string(4) "data" +Done diff --git a/ext/oci8/tests/lob_023.phpt b/ext/oci8/tests/lob_023.phpt new file mode 100644 index 0000000000..0c352956de --- /dev/null +++ b/ext/oci8/tests/lob_023.phpt @@ -0,0 +1,84 @@ +--TEST-- +oci_lob_import()/read() +--SKIPIF-- + +--FILE-- +seek(10, OCI_SEEK_CUR)); +var_dump($blob->import(dirname(__FILE__)."/lob_009.txt")); +var_dump($blob->import()); +var_dump(oci_lob_import($blob)); +var_dump(oci_lob_import($blob, dirname(__FILE__)."/lob_009.txt")); +unset($blob->descriptor); +var_dump(oci_lob_import($blob, dirname(__FILE__)."/lob_009.txt")); +oci_commit($c); + +$select_sql = "SELECT blob FROM ".$schema.$table_name." FOR UPDATE"; +$s = oci_parse($c, $select_sql); +oci_execute($s, OCI_DEFAULT); + +var_dump($row = oci_fetch_array($s)); + +while (!$row[0]->eof()) { + var_dump($row[0]->read(1024)); +} + +require dirname(__FILE__).'/drop_table.inc'; + +echo "Done\n"; + +?> +--EXPECTF-- +object(OCI-Lob)#%d (1) { + ["descriptor"]=> + resource(%d) of type (oci8 descriptor) +} +bool(true) +bool(true) + +Warning: OCI-Lob::import() expects exactly 1 parameter, 0 given in %s on line %d +NULL + +Warning: oci_lob_import() expects exactly 2 parameters, 1 given in %s on line %d +NULL +bool(true) + +Warning: oci_lob_import(): Unable to find descriptor property in %s on line %d +bool(false) +array(2) { + [0]=> + object(OCI-Lob)#%d (1) { + ["descriptor"]=> + resource(%d) of type (oci8 descriptor) + } + ["BLOB"]=> + object(OCI-Lob)#%d (1) { + ["descriptor"]=> + resource(%d) of type (oci8 descriptor) + } +} +string(43) "this +is +a +test +file for +test lob_009.phpt +" +Done diff --git a/ext/oci8/tests/lob_024.phpt b/ext/oci8/tests/lob_024.phpt new file mode 100644 index 0000000000..9a7f53240d --- /dev/null +++ b/ext/oci8/tests/lob_024.phpt @@ -0,0 +1,75 @@ +--TEST-- +oci_lob_load() +--SKIPIF-- + +--FILE-- +size()); +var_dump($blob->write(str_repeat("string.", 1000))); +var_dump($blob->size()); +oci_commit($c); + +$select_sql = "SELECT blob FROM ".$schema.$table_name." FOR UPDATE"; +$s = oci_parse($c, $select_sql); +oci_execute($s, OCI_DEFAULT); + +var_dump($row = oci_fetch_array($s)); + +var_dump(strlen($row[0]->load())); +var_dump(strlen(oci_lob_load($row[0]))); +var_dump(oci_lob_load()); +unset($row[0]->descriptor); +var_dump(oci_lob_load($row[0])); + +require dirname(__FILE__).'/drop_table.inc'; + +echo "Done\n"; + +?> +--EXPECTF-- +object(OCI-Lob)#%d (1) { + ["descriptor"]=> + resource(%d) of type (oci8 descriptor) +} +int(0) +int(7000) +int(7000) +array(2) { + [0]=> + object(OCI-Lob)#%d (1) { + ["descriptor"]=> + resource(%d) of type (oci8 descriptor) + } + ["BLOB"]=> + object(OCI-Lob)#%d (1) { + ["descriptor"]=> + resource(%d) of type (oci8 descriptor) + } +} +int(7000) +int(7000) + +Warning: oci_lob_load() expects exactly 1 parameter, 0 given in %s on line %d +NULL + +Warning: oci_lob_load(): Unable to find descriptor property in %s on line %d +bool(false) +Done diff --git a/ext/oci8/tests/lob_025.phpt b/ext/oci8/tests/lob_025.phpt new file mode 100644 index 0000000000..5b5e845a7a --- /dev/null +++ b/ext/oci8/tests/lob_025.phpt @@ -0,0 +1,82 @@ +--TEST-- +oci_lob_read() tests +--SKIPIF-- + +--FILE-- +size()); +var_dump($blob->write(str_repeat("string.", 1000))); +var_dump($blob->size()); +oci_commit($c); + +$select_sql = "SELECT blob FROM ".$schema.$table_name." FOR UPDATE"; +$s = oci_parse($c, $select_sql); +oci_execute($s, OCI_DEFAULT); + +var_dump($row = oci_fetch_array($s)); + +var_dump(oci_lob_read($row[0], 2)); +var_dump(oci_lob_read($row[0])); +var_dump(oci_lob_read()); +var_dump(oci_lob_eof($row[0])); +var_dump(oci_lob_eof()); + +unset($row[0]->descriptor); +var_dump(oci_lob_read($row[0],1)); +var_dump(oci_lob_eof($row[0])); + +require dirname(__FILE__).'/drop_table.inc'; + +echo "Done\n"; + +?> +--EXPECTF-- +int(0) +int(7000) +int(7000) +array(2) { + [0]=> + object(OCI-Lob)#%d (1) { + ["descriptor"]=> + resource(%d) of type (oci8 descriptor) + } + ["BLOB"]=> + object(OCI-Lob)#%d (1) { + ["descriptor"]=> + resource(%d) of type (oci8 descriptor) + } +} +string(2) "st" + +Warning: oci_lob_read() expects exactly 2 parameters, 1 given in %s on line %d +NULL + +Warning: oci_lob_read() expects exactly 2 parameters, 0 given in %s on line %d +NULL +bool(false) + +Warning: oci_lob_eof() expects exactly 1 parameter, 0 given in %s on line %d +NULL + +Warning: oci_lob_read(): Unable to find descriptor property in %s on line %d +bool(false) + +Warning: oci_lob_eof(): Unable to find descriptor property in %s on line %d +bool(false) +Done diff --git a/ext/oci8/tests/lob_026.phpt b/ext/oci8/tests/lob_026.phpt new file mode 100644 index 0000000000..157d78a2b6 --- /dev/null +++ b/ext/oci8/tests/lob_026.phpt @@ -0,0 +1,100 @@ +--TEST-- +oci_lob_seek()/rewind()/append() +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +object(OCI-Lob)#%d (1) { + ["descriptor"]=> + resource(%d) of type (oci8 descriptor) +} +int(4) + +Warning: oci_lob_rewind() expects exactly 1 parameter, 0 given in %s on line %d +NULL +bool(true) +int(3) + +Warning: oci_lob_seek() expects parameter 1 to be OCI-Lob, integer given in %s on line %d +NULL +bool(true) +array(2) { + [0]=> + object(OCI-Lob)#%d (1) { + ["descriptor"]=> + resource(%d) of type (oci8 descriptor) + } + ["BLOB"]=> + object(OCI-Lob)#%d (1) { + ["descriptor"]=> + resource(%d) of type (oci8 descriptor) + } +} + +Warning: oci_lob_append() expects exactly 2 parameters, 0 given in %s on line %d +NULL + +Warning: oci_lob_append() expects exactly 2 parameters, 1 given in %s on line %d +NULL +bool(true) + +Warning: oci_lob_read() expects exactly 2 parameters, 1 given in %s on line %d +NULL +string(4) "strt" +string(8) "strtstrt" +Done