1
1
<?php
2
2
3
+ /*
4
+ * This file is part of the PHPCR API Tests package
5
+ *
6
+ * Copyright (c) 2015 Liip and others
7
+ *
8
+ * For the full copyright and license information, please view the LICENSE
9
+ * file that was distributed with this source code.
10
+ */
11
+
3
12
namespace PHPCR \Test ;
4
13
5
14
use PHPCR \NoSuchWorkspaceException ;
@@ -18,20 +27,20 @@ abstract class AbstractLoader
18
27
protected $ otherWorkspacename ;
19
28
20
29
/**
21
- * array with chapter names to skip all test cases in (without the numbers)
30
+ * array with chapter names to skip all test cases in (without the numbers).
22
31
*/
23
32
protected $ unsupportedChapters = array ();
24
33
/**
25
- * array in the format Chapter\FeatureTest with all cases to skip
34
+ * array in the format Chapter\FeatureTest with all cases to skip.
26
35
*/
27
36
protected $ unsupportedCases = array ();
28
37
/**
29
- * array in the format Chapter\FeatureTest::testName with all single tests to skip
38
+ * array in the format Chapter\FeatureTest::testName with all single tests to skip.
30
39
*/
31
40
protected $ unsupportedTests = array ();
32
41
33
42
/**
34
- * Create the loader
43
+ * Create the loader.
35
44
*
36
45
* @param string $factoryclass the class name of your implementations
37
46
* RepositoryFactory. You can pass null but then you must overwrite
@@ -71,7 +80,7 @@ public function getRepositoryFactoryClass()
71
80
/**
72
81
* @return array hashmap with the parameters for the repository factory
73
82
*/
74
- public abstract function getRepositoryFactoryParameters ();
83
+ abstract public function getRepositoryFactoryParameters ();
75
84
76
85
/**
77
86
* You should overwrite this to instantiate the repository without the
@@ -85,39 +94,38 @@ public abstract function getRepositoryFactoryParameters();
85
94
public function getRepository ()
86
95
{
87
96
$ factoryclass = $ this ->getRepositoryFactoryClass ();
88
- $ factory = new $ factoryclass ;
89
- if (! $ factory instanceof RepositoryFactoryInterface) {
97
+ $ factory = new $ factoryclass() ;
98
+ if (!$ factory instanceof RepositoryFactoryInterface) {
90
99
throw new \Exception ("$ factoryclass is not of type RepositoryFactoryInterface " );
91
100
}
92
- /** @var $factory RepositoryFactoryInterface */
101
+ /* @var $factory RepositoryFactoryInterface */
93
102
return $ factory ->getRepository ($ this ->getRepositoryFactoryParameters ());
94
103
}
95
104
96
105
/**
97
106
* @return \PHPCR\CredentialsInterface the login credentials that lead to successful login into the repository
98
107
*/
99
- public abstract function getCredentials ();
108
+ abstract public function getCredentials ();
100
109
101
110
/**
102
111
* @return \PHPCR\CredentialsInterface the login credentials that lead to login failure
103
112
*/
104
- public abstract function getInvalidCredentials ();
113
+ abstract public function getInvalidCredentials ();
105
114
106
115
/**
107
116
* Used when impersonating another user in Reading\SessionReadMethodsTests::testImpersonate
108
- * And for Reading\SessionReadMethodsTest::testCheckPermissionAccessControlException
117
+ * And for Reading\SessionReadMethodsTest::testCheckPermissionAccessControlException.
109
118
*
110
119
* The user may not have write access to /tests_general_base/numberPropertyNode/jcr:content/foo
111
120
*
112
121
* @return \PHPCR\CredentialsInterface the login credentials with limited permissions for testing impersonate and access control
113
122
*/
114
- public abstract function getRestrictedCredentials ();
123
+ abstract public function getRestrictedCredentials ();
115
124
116
125
/**
117
126
* @return string the user id that is used in the credentials
118
127
*/
119
- public abstract function getUserId ();
120
-
128
+ abstract public function getUserId ();
121
129
122
130
/**
123
131
* Make the repository ready for login with null credentials, handling the
@@ -126,9 +134,9 @@ public abstract function getUserId();
126
134
* If the implementation does not support this feature, it must return
127
135
* false for this method, otherwise true.
128
136
*
129
- * @return boolean true if anonymous login is supposed to work
137
+ * @return bool true if anonymous login is supposed to work
130
138
*/
131
- public abstract function prepareAnonymousLogin ();
139
+ abstract public function prepareAnonymousLogin ();
132
140
133
141
/**
134
142
* @return string the workspace name used for the tests
@@ -158,6 +166,7 @@ public function getOtherWorkspaceName()
158
166
* Get a session for this implementation.
159
167
*
160
168
* @param \PHPCR\CredentialsInterface $credentials The credentials to log into the repository. If omitted, self::getCredentials should be used
169
+ *
161
170
* @return \PHPCR\SessionInterface the session resulting from logging into the repository with the provided credentials
162
171
*/
163
172
public function getSession ($ credentials = false )
@@ -169,6 +178,7 @@ public function getSession($credentials = false)
169
178
* Get a session corresponding to the additional workspace for this implementation.
170
179
*
171
180
* @param \PHPCR\CredentialsInterface $credentials The credentials to log into the repository. If omitted, self::getCredentials should be used
181
+ *
172
182
* @return \PHPCR\SessionInterface the session resulting from logging into the repository with the provided credentials
173
183
*/
174
184
public function getAdditionalSession ($ credentials = false )
@@ -202,7 +212,7 @@ public function getSessionWithLastModified()
202
212
* mix:lastModified. If that is not possible, this method should return
203
213
* true, which will skip the test about this feature.
204
214
*
205
- * @return boolean
215
+ * @return bool
206
216
*/
207
217
public function doesSessionLastModified ()
208
218
{
@@ -223,7 +233,7 @@ public function doesSessionLastModified()
223
233
*/
224
234
public function getTestSupported ($ chapter , $ case , $ name )
225
235
{
226
- return ! ( in_array ($ chapter , $ this ->unsupportedChapters )
236
+ return !( in_array ($ chapter , $ this ->unsupportedChapters )
227
237
|| in_array ($ case , $ this ->unsupportedCases )
228
238
|| in_array ($ name , $ this ->unsupportedTests )
229
239
);
@@ -232,11 +242,12 @@ public function getTestSupported($chapter, $case, $name)
232
242
/**
233
243
* @return \PHPCR\Test\FixtureLoaderInterface implementation that is used to load test fixtures
234
244
*/
235
- public abstract function getFixtureLoader ();
245
+ abstract public function getFixtureLoader ();
236
246
237
247
/**
238
248
* @param $credentials
239
249
* @param $workspaceName
250
+ *
240
251
* @return mixed
241
252
*/
242
253
private function getSessionForWorkspace ($ credentials , $ workspaceName )
0 commit comments