File:  [ELWIX - Embedded LightWeight unIX -] / embedaddon / php / ext / oci8 / tests / coll_018.phpt
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs - revision graph
Tue Feb 21 23:47:58 2012 UTC (12 years, 4 months ago) by misho
Branches: php, MAIN
CVS tags: v5_4_3elwix, v5_4_29p0, v5_4_29, v5_4_20p0, v5_4_20, v5_4_17p0, v5_4_17, v5_3_10, HEAD
php

--TEST--
Collection trim tests
--SKIPIF--
<?php
$target_dbs = array('oracledb' => true, 'timesten' => false);  // test runs on these DBs
require(dirname(__FILE__).'/skipif.inc');
?> 
--FILE--
<?php

require dirname(__FILE__)."/connect.inc";
require dirname(__FILE__)."/create_type.inc";

$coll1 = oci_new_collection($c, $type_name);

echo "Test 1.\n";
var_dump($coll1->trim());

echo "\nTest 2.\n";
var_dump($coll1->trim(0));

echo "\nTest 3.\n";
var_dump($coll1->append(1));
var_dump($coll1->append(2));
var_dump($coll1->append(3));
var_dump($coll1->append(4));

var_dump($coll1->getElem(-1));  // check before the beginning
var_dump($coll1->getElem(0));
var_dump($coll1->getElem(1));
var_dump($coll1->getElem(2));
var_dump($coll1->getElem(3));
var_dump($coll1->getElem(4));  // check past the end

echo "\nTest 4.\n";
var_dump($coll1->trim(1));
var_dump($coll1->getElem(2));  // this should be the last element
var_dump($coll1->getElem(3));  // this element should have gone

echo "\nTest 5.\n";
var_dump($coll1->trim(2));
var_dump($coll1->getElem(0));  // this should be the last element
var_dump($coll1->getElem(1));  // this element should have gone

echo "\nTest 6.\n";
var_dump($coll1->trim(0));
var_dump($coll1->getElem(0));  // this should still be the last element

echo "\nTest 7.\n";
var_dump($coll1->trim(1));
var_dump($coll1->getElem(0));  // this should have gone

echo "Done\n";

require dirname(__FILE__)."/drop_type.inc";

?>
--EXPECTF--
Test 1.

Warning: OCI-Collection::trim() expects exactly 1 parameter, 0 given in %s on line 9
NULL

Test 2.
bool(true)

Test 3.
bool(true)
bool(true)
bool(true)
bool(true)
bool(false)
float(1)
float(2)
float(3)
float(4)
bool(false)

Test 4.
bool(true)
float(3)
bool(false)

Test 5.
bool(true)
float(1)
bool(false)

Test 6.
bool(true)
float(1)

Test 7.
bool(true)
bool(false)
Done

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>