We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 8ac9ad1 commit be9f665Copy full SHA for be9f665
tests/Databases/MySQLTest.php
@@ -0,0 +1,35 @@
1
+<?php
2
+namespace Kir\MySQL\Databases;
3
+
4
+use PDO;
5
6
+class MySQLTest extends \PHPUnit_Framework_TestCase {
7
+ public function testTransactionTries1() {
8
+ $pdo = new PDO('sqlite::memory:');
9
+ $mysql = new MySQL($pdo);
10
11
+ $this->setExpectedException('Exception', '5');
12
13
+ $mysql->transaction(5, function () {
14
+ static $i;
15
+ $i++;
16
+ throw new \Exception($i);
17
+ });
18
+ }
19
20
+ public function testTransactionTries2() {
21
22
23
24
+ $result = $mysql->transaction(5, function () {
25
26
27
+ if($i < 5) {
28
29
30
+ return $i;
31
32
33
+ $this->assertEquals(5, $result);
34
35
+}
0 commit comments