cvs: pear /MDB2/tests MDB2_datatype_testcase.php MDB2_usage_testcase.php

From: Date: Sun, 20 Aug 2006 12:14:25 +0000
Subject: cvs: pear /MDB2/tests MDB2_datatype_testcase.php MDB2_usage_testcase.php
Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-41762@lists.php.net to get a copy of this message
lsmith Sun Aug 20 12:14:25 2006 UTC Modified files: /pear/MDB2/tests MDB2_datatype_testcase.php MDB2_usage_testcase.php Log: - removed redundant assertions when testing if a given feature is unsupported - removed tests of portability off (users should just set the given portability setting they want to test in their test_setup.php)

http://cvs.php.net/viewvc.cgi/pear/MDB2/tests/MDB2_datatype_testcase.php?r1=1.11&r2=1.12&diff_format=u Index: pear/MDB2/tests/MDB2_datatype_testcase.php diff -u pear/MDB2/tests/MDB2_datatype_testcase.php:1.11 pear/MDB2/tests/MDB2_datatype_testcase.php:1.12 --- pear/MDB2/tests/MDB2_datatype_testcase.php:1.11 Mon Aug 7 20:17:43 2006 +++ pear/MDB2/tests/MDB2_datatype_testcase.php Sun Aug 20 12:14:25 2006 @@ -41,7 +41,7 @@ // | Author: Lorenzo Alberton <l dot alberton at quipo dot it> | // +----------------------------------------------------------------------+ // -// $Id: MDB2_datatype_testcase.php,v 1.11 2006/08/07 20:17:43 lsmith Exp $ +// $Id: MDB2_datatype_testcase.php,v 1.12 2006/08/20 12:14:25 lsmith Exp $ require_once 'MDB2_testcase.php'; @@ -479,7 +479,6 @@ */ function testEscapePatternSequences() { if (!$this->supported('pattern_escaping')) { - $this->assertTrue(false, '"pattern_escaping" is not supported'); return; } http://cvs.php.net/viewvc.cgi/pear/MDB2/tests/MDB2_usage_testcase.php?r1=1.80&r2=1.81&diff_format=u Index: pear/MDB2/tests/MDB2_usage_testcase.php diff -u pear/MDB2/tests/MDB2_usage_testcase.php:1.80 pear/MDB2/tests/MDB2_usage_testcase.php:1.81 --- pear/MDB2/tests/MDB2_usage_testcase.php:1.80 Sun Aug 20 10:24:11 2006 +++ pear/MDB2/tests/MDB2_usage_testcase.php Sun Aug 20 12:14:25 2006 @@ -41,7 +41,7 @@ // | Author: Paul Cooper <pgc@ucecom.com> | // +----------------------------------------------------------------------+ // -// $Id: MDB2_usage_testcase.php,v 1.80 2006/08/20 10:24:11 lsmith Exp $ +// $Id: MDB2_usage_testcase.php,v 1.81 2006/08/20 12:14:25 lsmith Exp $ require_once 'MDB2_testcase.php'; @@ -546,7 +546,6 @@ */ function testRanges() { if (!$this->supported('limit_queries')) { - $this->assertTrue(false, '"limit_queries" is not supported'); return; } @@ -619,8 +618,7 @@ */ function testSequences() { if (!$this->supported('sequences')) { - $this->assertTrue(false, '"sequences" is not supported'); - return; + return; } $this->db->loadModule('Manager', null, true); @@ -698,7 +696,6 @@ */ function testReplace() { if (!$this->supported('replace')) { - $this->assertTrue(false, '"replace" is not supported'); return; } @@ -806,7 +803,6 @@ */ function testAffectedRows() { if (!$this->supported('affected_rows')) { - $this->assertTrue(false, '"affected_rows" is not supported'); return; } @@ -876,7 +872,6 @@ */ function testTransactionsRollback() { if (!$this->supported('transactions')) { - $this->assertTrue(false, '"transactions" is not supported'); return; } @@ -905,7 +900,6 @@ */ function testTransactionsCommit() { if (!$this->supported('transactions')) { - $this->assertTrue(false, '"transactions" is not supported'); return; } @@ -935,7 +929,6 @@ function testTransactionsBoth() { if (!$this->supported('transactions')) { - $this->assertTrue(false, '"transactions" is not supported'); return; } @@ -965,7 +958,6 @@ */ function testNestedTransactions() { if (!$this->supported('transactions')) { - $this->assertTrue(false, '"transactions" is not supported'); return; } @@ -1010,7 +1002,6 @@ */ function testSavepoint() { if (!$this->supported('savepoints')) { - $this->assertTrue(false, '"savepoints" is not supported'); return; } @@ -1081,7 +1072,6 @@ */ function testLOBStorage() { if (!$this->supported('LOBs')) { - $this->assertTrue(false, '"LOBs" is not supported'); return; } @@ -1155,7 +1145,6 @@ */ function testLOBFiles() { if (!$this->supported('LOBs')) { - $this->assertTrue(false, '"LOBs" is not supported'); return; } @@ -1260,7 +1249,6 @@ */ function testLOBNulls() { if (!$this->supported('LOBs')) { - $this->assertTrue(false, '"LOBs" is not supported'); return; } @@ -1292,7 +1280,6 @@ function testLOBUpdate() { if (!$this->supported('LOBs')) { - $this->assertTrue(false, '"LOBs" is not supported'); return; } @@ -1475,24 +1462,6 @@ $field = next($fields); } - /* - This is not a valid test case. Turning off portability means that the underlying - extension will choose the case of the responses, not the query. - // leave the case as-is - $this->db->setOption('portability', MDB2_PORTABILITY_NONE); - $fields = array('User_Name', 'UseR_PassWord'); - $query = 'SELECT '. implode(',', $fields).' FROM users'; - $result =& $this->db->queryRow($query, null, MDB2_FETCHMODE_ASSOC); - if (PEAR::isError($result)) { - $this->assertTrue(false, 'Error selecting from users'.$result->getMessage()); - } - $field = reset($fields); - foreach (array_keys($result) as $fieldname) { - $this->assertEquals($field, $fieldname, '"MDB2_PORTABILITY_FIX_CASE = off" not working'); - $field = next($fields); - } - */ - // MDB2_PORTABILITY_RTRIM $this->db->setOption('portability', MDB2_PORTABILITY_NONE | MDB2_PORTABILITY_RTRIM); $value = 'rtrim '; @@ -1508,22 +1477,7 @@ } $this->assertEquals(rtrim($value), $result, '"MDB2_PORTABILITY_RTRIM = on" not working'); - $this->db->setOption('portability', MDB2_PORTABILITY_NONE); - $value = 'rtrim '; - $query = 'INSERT INTO users (user_id, user_password) VALUES (2, ' . $this->db->quote($value, 'text') .')'; - $res = $this->db->exec($query); - if (PEAR::isError($res)) { - $this->assertTrue(false, 'Error executing query'.$res->getMessage()); - } - $query = 'SELECT user_password FROM users WHERE user_id = 2'; - $result = $this->db->queryOne($query, array('text')); - if (PEAR::isError($result)) { - $this->assertTrue(false, 'Error selecting from users'.$result->getMessage()); - } - $this->assertEquals($value, $result, '"MDB2_PORTABILITY_RTRIM = off" not working'); - if (!$this->supported('LOBs')) { - $this->assertTrue(false, '"LOBs" is not supported'); return; } @@ -1553,7 +1507,6 @@ $stmt->free(); - $this->db->setOption('portability', MDB2_PORTABILITY_ALL); $result =& $this->db->query('SELECT document, picture FROM files WHERE id = 1', array('clob', 'blob')); if (PEAR::isError($result)) { $this->assertTrue(false, 'Error selecting from files'.$result->getMessage()); @@ -1591,45 +1544,6 @@ $this->assertTrue(false, 'Error retrieving BLOB result'); } $result->free(); - - $this->db->setOption('portability', MDB2_PORTABILITY_ALL ^ MDB2_PORTABILITY_RTRIM); - $result =& $this->db->query('SELECT document, picture FROM files WHERE id = 1', array('clob', 'blob')); - if (PEAR::isError($result)) { - $this->assertTrue(false, 'Error selecting from files'.$result->getMessage()); - } - - $this->assertTrue($result->valid(), 'The query result seem to have reached the end of result too soon.'); - - $row = $result->fetchRow(); - $clob = $row[0]; - if (!PEAR::isError($clob) && is_resource($clob)) { - $value = ''; - while (!feof($clob)) { - $data = fread($clob, 8192); - $this->assertTrue(strlen($data) >= 0, 'Could not read CLOB'); - $value.= $data; - } - $this->db->datatype->destroyLOB($clob); - $this->assertEquals($character_lob, $value, '"MDB2_PORTABILITY_RTRIM = off" Retrieved character LOB value is different from what was stored'); - } else { - $this->assertTrue(false, 'Error retrieving CLOB result'); - } - - $blob = $row[1]; - if (!PEAR::isError($blob) && is_resource($blob)) { - $value = ''; - while (!feof($blob)) { - $data = fread($blob, 8192); - $this->assertTrue(strlen($data) >= 0, 'Could not read BLOB'); - $value.= $data; - } - - $this->db->datatype->destroyLOB($blob); - $this->assertEquals($binary_lob, $value, '"MDB2_PORTABILITY_RTRIM = off" Retrieved binary LOB value is different from what was stored'); - } else { - $this->assertTrue(false, 'Error retrieving BLOB result'); - } - $result->free(); } /**
« previous php.pear.cvs (#41762) next »