33
44require_once (__DIR__ . '/../../inc/BaseCase.php ' );
55
6+ use PHPCR \RepositoryInterface ;
67use \PHPCR \Transaction ;
78
89/**
@@ -25,23 +26,21 @@ public function setUp()
2526
2627 public function testGetTransactionManager ()
2728 {
28- $ session = self ::$ staticSharedFixture ['session ' ];
29- $ utx = $ session ->getWorkspace ()->getTransactionManager ();
29+ $ utx = $ this ->session ->getWorkspace ()->getTransactionManager ();
3030
3131 $ this ->assertInstanceOf ('\PHPCR\Transaction\UserTransactionInterface ' , $ utx );
3232 }
3333
3434 public function testTransactionCommit ()
3535 {
36- $ session = self ::$ staticSharedFixture ['session ' ];
37- $ utx = $ session ->getWorkspace ()->getTransactionManager ();
36+ $ utx = $ this ->session ->getWorkspace ()->getTransactionManager ();
3837
3938 $ utx ->begin ();
4039 $ child = $ this ->node ->addNode ('insideTransaction ' );
4140
4241 $ this ->assertEquals ($ this ->node ->getPath () . '/insideTransaction ' , $ child ->getPath ());
4342
44- $ session ->save ();
43+ $ this -> session ->save ();
4544
4645 $ sessionbeforesave = self ::$ loader ->getSession ();
4746 $ this ->assertFalse ($ sessionbeforesave ->nodeExists ($ child ->getPath ()));
@@ -55,19 +54,17 @@ public function testTransactionCommit()
5554
5655 public function testTransactionRollback ()
5756 {
58- $ session = self ::$ staticSharedFixture ['session ' ];
59-
6057 $ copy = $ this ->node ->addNode ('copyTransaction ' );
6158 $ copiedNodePath = $ this ->node ->getPath ()."/copyTransactionCopy " ;
62- $ session ->save ();
59+ $ this -> session ->save ();
6360
64- $ utx = $ session ->getWorkspace ()->getTransactionManager ();
61+ $ utx = $ this -> session ->getWorkspace ()->getTransactionManager ();
6562
6663 $ child = $ this ->node ->addNode ('insideTransaction ' );
6764 $ utx ->begin ();
6865 //workspace operation
69- $ session ->getWorkspace ()->copy ($ copy ->getPath (),$ copiedNodePath );
70- $ session ->save ();
66+ $ this -> session ->getWorkspace ()->copy ($ copy ->getPath (),$ copiedNodePath );
67+ $ this -> session ->save ();
7168 $ this ->assertFalse ($ child ->isNew ());
7269 $ utx ->rollback ();
7370
@@ -79,7 +76,7 @@ public function testTransactionRollback()
7976
8077 // semantics of rollback is that the local session state does not roll back
8178 // this must work
82- $ session ->save ();
79+ $ this -> session ->save ();
8380
8481 $ sessionaftersave = self ::$ loader ->getSession ();
8582 $ this ->assertFalse ($ sessionaftersave ->nodeExists ($ child ->getPath ()));
@@ -88,20 +85,19 @@ public function testTransactionRollback()
8885
8986 public function testInTransaction ()
9087 {
91- $ session = self ::$ staticSharedFixture ['session ' ];
92- $ utx = $ session ->getWorkspace ()->getTransactionManager ();
88+ $ utx = $ this ->session ->getWorkspace ()->getTransactionManager ();
9389
9490 $ this ->assertFalse ($ utx ->inTransaction ());
9591 $ utx ->begin ();
9692 $ this ->node ->addNode ('insideTransaction0 ' );
97- $ session ->save ();
93+ $ this -> session ->save ();
9894 $ this ->assertTrue ($ utx ->inTransaction ());
9995 $ utx ->commit ();
10096 $ this ->assertFalse ($ utx ->inTransaction ());
10197
10298 $ utx ->begin ();
10399 $ this ->node ->addNode ('insideTransaction1 ' );
104- $ session ->save ();
100+ $ this -> session ->save ();
105101 $ this ->assertTrue ($ utx ->inTransaction ());
106102 $ utx ->rollback ();
107103 $ this ->assertFalse ($ utx ->inTransaction ());
@@ -114,19 +110,16 @@ public function testInTransaction()
114110 */
115111 public function testIllegalCheckin ()
116112 {
117- if (!self ::$ staticSharedFixture ['session ' ]->getRepository ()->getDescriptor ('option.versioning.supported ' )) {
118- $ this ->markTestSkipped ('PHPCR repository doesn \'t support versioning ' );
119- }
113+ $ this ->skipIfNotSupported (RepositoryInterface::OPTION_VERSIONING_SUPPORTED );
120114
121- $ session = self ::$ staticSharedFixture ['session ' ];
122- $ vm = $ session ->getWorkspace ()->getVersionManager ();
115+ $ vm = $ this ->session ->getWorkspace ()->getVersionManager ();
123116
124- $ utx = $ session ->getWorkspace ()->getTransactionManager ();
117+ $ utx = $ this -> session ->getWorkspace ()->getTransactionManager ();
125118 $ vm ->checkout ($ this ->node ->getPath ());
126119 $ this ->node ->setProperty ('foo ' , 'bar2 ' );
127120
128121 $ utx ->begin ();
129- $ session ->save ();
122+ $ this -> session ->save ();
130123
131124 $ vm ->checkin ($ this ->node ->getPath ());
132125 }
0 commit comments