From e43e7d2a5c537c80e2eff8495014c113b6bc0c19 Mon Sep 17 00:00:00 2001 From: zYne Date: Mon, 5 Feb 2007 12:06:41 +0000 Subject: [PATCH] --- tests/Db/ProfilerTestCase.php | 59 +++++++++++++++++++++++++++++------ 1 file changed, 50 insertions(+), 9 deletions(-) diff --git a/tests/Db/ProfilerTestCase.php b/tests/Db/ProfilerTestCase.php index 1acb3d1f2..b8bac0ee6 100644 --- a/tests/Db/ProfilerTestCase.php +++ b/tests/Db/ProfilerTestCase.php @@ -1,12 +1,48 @@ . + */ + +/** + * Doctrine_Db_Profiler_TestCase + * + * @package Doctrine + * @subpackage Doctrine_Db + * @author Konsta Vesterinen + * @license http://www.opensource.org/licenses/lgpl-license.php LGPL + * @category Object Relational Mapping + * @link www.phpdoctrine.com + * @since 1.0 + * @version $Revision$ + */ +class Doctrine_Db_Profiler_TestCase extends Doctrine_UnitTestCase +{ protected $dbh; protected $profiler; - public function prepareTables() {} - public function prepareData() {} + public function prepareTables() + {} + public function prepareData() + {} - public function testQuery() { + public function testQuery() + { $this->dbh = Doctrine_Db::getConnection('sqlite::memory:'); $this->profiler = new Doctrine_Db_Profiler(); @@ -22,7 +58,8 @@ class Doctrine_Db_Profiler_TestCase extends Doctrine_UnitTestCase { $this->assertEqual($this->dbh->count(), 1); } - public function testPrepareAndExecute() { + public function testPrepareAndExecute() + { $stmt = $this->dbh->prepare('INSERT INTO test (id) VALUES (?)'); $event = $this->profiler->lastEvent(); @@ -41,7 +78,8 @@ class Doctrine_Db_Profiler_TestCase extends Doctrine_UnitTestCase { $this->assertEqual($this->dbh->count(), 2); } - public function testMultiplePrepareAndExecute() { + public function testMultiplePrepareAndExecute() + { $stmt = $this->dbh->prepare('INSERT INTO test (id) VALUES (?)'); $this->assertEqual($this->profiler->lastEvent()->getQuery(), 'INSERT INTO test (id) VALUES (?)'); @@ -65,7 +103,8 @@ class Doctrine_Db_Profiler_TestCase extends Doctrine_UnitTestCase { $this->assertEqual($this->dbh->count(), 4); } - public function testExecuteStatementMultipleTimes() { + public function testExecuteStatementMultipleTimes() + { try { $stmt = $this->dbh->prepare('INSERT INTO test (id) VALUES (?)'); $stmt->execute(array(1)); @@ -85,7 +124,8 @@ class Doctrine_Db_Profiler_TestCase extends Doctrine_UnitTestCase { $this->assertEqual($this->profiler->lastEvent()->getCode(), Doctrine_Db_Event::EXECUTE); $this->assertTrue(is_numeric($this->profiler->lastEvent()->getElapsedSecs())); } - public function testTransactionRollback() { + public function testTransactionRollback() + { try { $this->dbh->beginTransaction(); $this->pass(); @@ -109,7 +149,8 @@ class Doctrine_Db_Profiler_TestCase extends Doctrine_UnitTestCase { $this->assertEqual($this->profiler->lastEvent()->getCode(), Doctrine_Db_Event::ROLLBACK); $this->assertTrue(is_numeric($this->profiler->lastEvent()->getElapsedSecs())); } - public function testTransactionCommit() { + public function testTransactionCommit() + { try { $this->dbh->beginTransaction(); $this->pass();