1
|
|
|
<?php |
2
|
|
|
namespace StefanoTreeTest\Integration\Adapter; |
3
|
|
|
|
4
|
|
|
use StefanoTree\NestedSet\Adapter\AdapterInterface as TreeAdapterInterface; |
5
|
|
|
use StefanoTree\NestedSet\Adapter\StefanoDb as NestedSetAdapter; |
6
|
|
|
use StefanoTree\NestedSet\Options; |
7
|
|
|
use StefanoTreeTest\TestUtil; |
8
|
|
|
|
9
|
|
|
|
10
|
|
|
class StefanoDbTest |
11
|
|
|
extends AdapterTestAbstract |
|
|
|
|
12
|
|
|
{ |
13
|
|
|
/** |
14
|
|
|
* @return TreeAdapterInterface |
15
|
|
|
*/ |
16
|
|
|
protected function getAdapter() |
17
|
|
|
{ |
18
|
|
|
$options = new Options(array( |
19
|
|
|
'tableName' => 'tree_traversal', |
20
|
|
|
'idColumnName' => 'tree_traversal_id', |
21
|
|
|
)); |
22
|
|
|
|
23
|
|
|
if ('pgsql' == TEST_STEFANO_DB_ADAPTER) { |
24
|
|
|
$options->setSequenceName('tree_traversal_tree_traversal_id_seq'); |
25
|
|
|
} |
26
|
|
|
|
27
|
|
|
return new NestedSetAdapter($options, TestUtil::getStefanoDbAdapter()); |
28
|
|
|
} |
29
|
|
|
|
30
|
|
|
public function testNestedTransactionCannotFail() |
31
|
|
|
{ |
32
|
|
|
$adapter = $this->getAdapter(); |
33
|
|
|
$adapter->beginTransaction(); |
34
|
|
|
$adapter->beginTransaction(); |
35
|
|
|
$adapter->commitTransaction(); |
36
|
|
|
$adapter->commitTransaction(); |
37
|
|
|
} |
38
|
|
|
|
39
|
|
|
public function testNestedTransactionCannotFail2() |
40
|
|
|
{ |
41
|
|
|
$adapter = $this->getAdapter(); |
42
|
|
|
$adapter->beginTransaction(); |
43
|
|
|
$adapter->beginTransaction(); |
44
|
|
|
$adapter->rollbackTransaction(); |
45
|
|
|
$adapter->rollbackTransaction(); |
46
|
|
|
} |
47
|
|
|
} |
48
|
|
|
|