11<?php
22
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+
312namespace PHPCR \Test ;
413
514use PHPCR \NoSuchWorkspaceException ;
@@ -18,20 +27,20 @@ abstract class AbstractLoader
1827 protected $ otherWorkspacename ;
1928
2029 /**
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).
2231 */
2332 protected $ unsupportedChapters = array ();
2433 /**
25- * array in the format Chapter\FeatureTest with all cases to skip
34+ * array in the format Chapter\FeatureTest with all cases to skip.
2635 */
2736 protected $ unsupportedCases = array ();
2837 /**
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.
3039 */
3140 protected $ unsupportedTests = array ();
3241
3342 /**
34- * Create the loader
43+ * Create the loader.
3544 *
3645 * @param string $factoryclass the class name of your implementations
3746 * RepositoryFactory. You can pass null but then you must overwrite
@@ -71,7 +80,7 @@ public function getRepositoryFactoryClass()
7180 /**
7281 * @return array hashmap with the parameters for the repository factory
7382 */
74- public abstract function getRepositoryFactoryParameters ();
83+ abstract public function getRepositoryFactoryParameters ();
7584
7685 /**
7786 * You should overwrite this to instantiate the repository without the
@@ -85,39 +94,38 @@ public abstract function getRepositoryFactoryParameters();
8594 public function getRepository ()
8695 {
8796 $ factoryclass = $ this ->getRepositoryFactoryClass ();
88- $ factory = new $ factoryclass ;
89- if (! $ factory instanceof RepositoryFactoryInterface) {
97+ $ factory = new $ factoryclass() ;
98+ if (!$ factory instanceof RepositoryFactoryInterface) {
9099 throw new \Exception ("$ factoryclass is not of type RepositoryFactoryInterface " );
91100 }
92- /** @var $factory RepositoryFactoryInterface */
101+ /* @var $factory RepositoryFactoryInterface */
93102 return $ factory ->getRepository ($ this ->getRepositoryFactoryParameters ());
94103 }
95104
96105 /**
97106 * @return \PHPCR\CredentialsInterface the login credentials that lead to successful login into the repository
98107 */
99- public abstract function getCredentials ();
108+ abstract public function getCredentials ();
100109
101110 /**
102111 * @return \PHPCR\CredentialsInterface the login credentials that lead to login failure
103112 */
104- public abstract function getInvalidCredentials ();
113+ abstract public function getInvalidCredentials ();
105114
106115 /**
107116 * Used when impersonating another user in Reading\SessionReadMethodsTests::testImpersonate
108- * And for Reading\SessionReadMethodsTest::testCheckPermissionAccessControlException
117+ * And for Reading\SessionReadMethodsTest::testCheckPermissionAccessControlException.
109118 *
110119 * The user may not have write access to /tests_general_base/numberPropertyNode/jcr:content/foo
111120 *
112121 * @return \PHPCR\CredentialsInterface the login credentials with limited permissions for testing impersonate and access control
113122 */
114- public abstract function getRestrictedCredentials ();
123+ abstract public function getRestrictedCredentials ();
115124
116125 /**
117126 * @return string the user id that is used in the credentials
118127 */
119- public abstract function getUserId ();
120-
128+ abstract public function getUserId ();
121129
122130 /**
123131 * Make the repository ready for login with null credentials, handling the
@@ -126,9 +134,9 @@ public abstract function getUserId();
126134 * If the implementation does not support this feature, it must return
127135 * false for this method, otherwise true.
128136 *
129- * @return boolean true if anonymous login is supposed to work
137+ * @return bool true if anonymous login is supposed to work
130138 */
131- public abstract function prepareAnonymousLogin ();
139+ abstract public function prepareAnonymousLogin ();
132140
133141 /**
134142 * @return string the workspace name used for the tests
@@ -158,6 +166,7 @@ public function getOtherWorkspaceName()
158166 * Get a session for this implementation.
159167 *
160168 * @param \PHPCR\CredentialsInterface $credentials The credentials to log into the repository. If omitted, self::getCredentials should be used
169+ *
161170 * @return \PHPCR\SessionInterface the session resulting from logging into the repository with the provided credentials
162171 */
163172 public function getSession ($ credentials = false )
@@ -169,6 +178,7 @@ public function getSession($credentials = false)
169178 * Get a session corresponding to the additional workspace for this implementation.
170179 *
171180 * @param \PHPCR\CredentialsInterface $credentials The credentials to log into the repository. If omitted, self::getCredentials should be used
181+ *
172182 * @return \PHPCR\SessionInterface the session resulting from logging into the repository with the provided credentials
173183 */
174184 public function getAdditionalSession ($ credentials = false )
@@ -202,7 +212,7 @@ public function getSessionWithLastModified()
202212 * mix:lastModified. If that is not possible, this method should return
203213 * true, which will skip the test about this feature.
204214 *
205- * @return boolean
215+ * @return bool
206216 */
207217 public function doesSessionLastModified ()
208218 {
@@ -223,7 +233,7 @@ public function doesSessionLastModified()
223233 */
224234 public function getTestSupported ($ chapter , $ case , $ name )
225235 {
226- return ! ( in_array ($ chapter , $ this ->unsupportedChapters )
236+ return !( in_array ($ chapter , $ this ->unsupportedChapters )
227237 || in_array ($ case , $ this ->unsupportedCases )
228238 || in_array ($ name , $ this ->unsupportedTests )
229239 );
@@ -232,11 +242,12 @@ public function getTestSupported($chapter, $case, $name)
232242 /**
233243 * @return \PHPCR\Test\FixtureLoaderInterface implementation that is used to load test fixtures
234244 */
235- public abstract function getFixtureLoader ();
245+ abstract public function getFixtureLoader ();
236246
237247 /**
238248 * @param $credentials
239249 * @param $workspaceName
250+ *
240251 * @return mixed
241252 */
242253 private function getSessionForWorkspace ($ credentials , $ workspaceName )
0 commit comments