1
0
mirror of synced 2024-12-13 14:56:01 +03:00
This commit is contained in:
zYne 2007-08-10 21:00:40 +00:00
parent bc031289c0
commit 28abbc2f1e

View File

@ -197,6 +197,32 @@ class Doctrine_Transaction_TestCase extends Doctrine_UnitTestCase
$this->assertEqual($this->adapter->pop(), 'COMMIT');
}
public function testNestedTransaction()
{
$conn = Doctrine_Manager::connection();
try {
$conn->beginTransaction();
// Create new client
$user = new User();
$user->set('name', 'Test User');
$user->save();
// Create new credit card
$phonenumber = new Phonenumber();
$phonenumber->set('entity_id', $user->get('id'));
$phonenumber->set('phonenumber', '123 123');
$phonenumber->save();
$conn->commit();
} catch (Exception $e) {
$conn->rollback();
}
$this->assertTrue($user->id > 0);
$this->assertTrue($phonenumber->id > 0);
}
}
class TransactionListener extends Doctrine_EventListener