Author: Raymond Bosman
Date: 2007-01-24 17:32:45 +0100 (Wed, 24 Jan 2007)
New Revision: 4563

Log:
- Added a PDO test to check and easily report bugs.

Added:
   trunk/Database/tests/pdo_test.php

Added: trunk/Database/tests/pdo_test.php
===================================================================
--- trunk/Database/tests/pdo_test.php   2007-01-24 16:26:06 UTC (rev 4562)
+++ trunk/Database/tests/pdo_test.php   2007-01-24 16:32:45 UTC (rev 4563)
@@ -0,0 +1,64 @@
+<?php
+/**
+ * @copyright Copyright (C) 2005-2007 eZ systems as. All rights reserved.
+ * @license http://ez.no/licenses/new_bsd New BSD License
+ * @version //autogentag//
+ * @filesource
+ * @package Database
+ * @subpackage Tests
+ */
+
+/**
+ * Test the PDO system.
+ *
+ * @package Database
+ * @subpackage Tests
+ */
+class PDOTest extends ezcTestCase
+{
+    protected function setUp()
+    {
+        try
+        {
+            $db = ezcDbInstance::get();
+        }
+        catch ( Exception $e )
+        {
+            $this->markTestSkipped();
+        }
+
+        $this->q = new ezcQueryInsert( $db );
+        try
+        {
+            $db->exec( 'DROP TABLE query_test' );
+        }
+        catch ( Exception $e ) {} // eat
+
+        // insert some data
+        $db->exec( 'CREATE TABLE query_test ( id int, company VARCHAR(255), 
section VARCHAR(255), employees int )' );
+
+    }
+
+    protected function tearDown()
+    {
+        $db = ezcDbInstance::get();
+        $db->exec( 'DROP TABLE query_test' );
+    }
+
+
+    // Works in PHP 5.1.4, Fails (hangs) in PHP 5.2.1RC2-dev.
+    public function testInsertWithWrongColon()
+    {
+        $db = ezcDbInstance::get();
+
+        $q = $db->prepare("INSERT INTO query_test VALUES( ':id', 'name', 
'section', 22)" ); // <-- ':id' should be :id (or a string without ":")
+        $q->execute();
+    }
+
+    public static function suite()
+    {
+         return new PHPUnit_Framework_TestSuite( "PDOTest" );
+    }
+}
+
+?>


Property changes on: trunk/Database/tests/pdo_test.php
___________________________________________________________________
Name: svn:eol-style
   + native

-- 
svn-components mailing list
svn-components@lists.ez.no
http://lists.ez.no/mailman/listinfo/svn-components

Reply via email to