File tree Expand file tree Collapse file tree 2 files changed +45
-1
lines changed Expand file tree Collapse file tree 2 files changed +45
-1
lines changed Original file line number Diff line number Diff line change 14
14
use Doctrine \Bundle \PHPCRBundle \Test \RepositoryManager ;
15
15
use Symfony \Bundle \FrameworkBundle \Client ;
16
16
use Symfony \Bundle \FrameworkBundle \Test \WebTestCase ;
17
+ use Symfony \Cmf \Component \Testing \Functional \DbManager \PhpcrDecorator ;
17
18
use Symfony \Component \DependencyInjection \Container ;
18
19
use Symfony \Component \HttpFoundation \Response ;
19
20
@@ -114,7 +115,7 @@ public function getDbManager($type)
114
115
);
115
116
116
117
if ('phpcr ' === strtolower ($ type ) && class_exists (RepositoryManager::class)) {
117
- $ className = RepositoryManager ::class;
118
+ $ className = PhpcrDecorator ::class;
118
119
}
119
120
120
121
if (!class_exists ($ className )) {
Original file line number Diff line number Diff line change
1
+ <?php
2
+
3
+ /*
4
+ * This file is part of the Symfony CMF package.
5
+ *
6
+ * (c) 2011-2017 Symfony CMF
7
+ *
8
+ * For the full copyright and license information, please view the LICENSE
9
+ * file that was distributed with this source code.
10
+ */
11
+
12
+ namespace Symfony \Cmf \Component \Testing \Functional \DbManager ;
13
+
14
+ use Doctrine \Bundle \PHPCRBundle \Test \RepositoryManager ;
15
+ use Doctrine \ODM \PHPCR \DocumentManagerInterface ;
16
+
17
+ /**
18
+ * A decorator around the DoctrinePHPCRBundle RepositoryManager class to
19
+ * provide BC with the PHPCR manager in this bundle.
20
+ */
21
+ class PhpcrDecorator extends RepositoryManager
22
+ {
23
+ public function getOm (string $ managerName = null ): DocumentManagerInterface
24
+ {
25
+ return $ this ->getDocumentManager ($ managerName );
26
+ }
27
+
28
+ /**
29
+ * Create a test node, if the test node already exists, remove it.
30
+ */
31
+ public function createTestNode ()
32
+ {
33
+ $ session = $ this ->getDocumentManager ()->getPhpcrSession ();
34
+
35
+ if ($ session ->nodeExists ('/test ' )) {
36
+ $ session ->getNode ('/test ' )->remove ();
37
+ }
38
+
39
+ $ session ->getRootNode ()->addNode ('test ' , 'nt:unstructured ' );
40
+
41
+ $ session ->save ();
42
+ }
43
+ }
You can’t perform that action at this time.
0 commit comments