Skip to content

Commit ad3234c

Browse files
committed
Merge pull request #161 from phpcr/clean
Update infrastructure
2 parents c23efab + 28c31e2 commit ad3234c

File tree

97 files changed

+1531
-854
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

97 files changed

+1531
-854
lines changed

.php_cs

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<?php
2+
3+
$header = <<<EOF
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+
EOF;
11+
12+
// Run the phpcsfixer from this directory to fix all code style issues
13+
// https://github.com/FriendsOfPHP/PHP-CS-Fixer
14+
15+
Symfony\CS\Fixer\Contrib\HeaderCommentFixer::setHeader($header);
16+
17+
return Symfony\CS\Config\Config::create()
18+
->fixers(array(
19+
'header_comment',
20+
'-psr0',
21+
'psr4',
22+
'symfony',
23+
'concat_without_spaces',
24+
'-phpdoc_indent',
25+
'-phpdoc_params',
26+
))
27+
->finder(
28+
Symfony\CS\Finder\DefaultFinder::create()
29+
->exclude('vendor')
30+
->in(__DIR__)
31+
)
32+
;

LICENSE.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ phpcr-api-tests is dual licensed under the MIT license and the Apache License Ve
22

33
The MIT License (MIT)
44

5-
Copyright (c) 2013 Liip and others
5+
Copyright (c) 2015 Liip and others
66

77
Permission is hereby granted, free of charge, to any person obtaining a copy of
88
this software and associated documentation files (the "Software"), to deal in

bootstrap.dist.php

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,18 @@
11
<?php
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+
212
/** make sure we get ALL infos from php */
313
error_reporting(E_ALL | E_STRICT);
414

5-
/**
15+
/*
616
* Sample bootstrap file
717
*
818
* the thing you MUST do is define the constants as expected in the

composer.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,12 @@
3030
"php": ">=5.3.0",
3131
"phpcr/phpcr-implementation": "2.1.*"
3232
},
33+
"autoload": {
34+
"psr-4": {
35+
"PHPCR\\Test\\": "inc/",
36+
"PHPCR\\Tests\\": "tests/"
37+
}
38+
},
3339
"extra": {
3440
"branch-alias": {
3541
"dev-master": "2.1-dev"

fixtures/06_Query/characters.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,4 +65,4 @@
6565
</sv:node>
6666
</sv:node>
6767
</sv:node>
68-
</sv:node>
68+
</sv:node>

fixtures/10_Writing/mixinreferenceable.xml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,4 +130,3 @@
130130
</sv:property>
131131
</sv:node>
132132
</sv:node>
133-

fixtures/11_Import/simple.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@
88
<child/>
99
</yetanother>
1010
</sibling>
11-
</data>
11+
</data>

fixtures/general/query.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,4 @@
2424
<sv:value>SELECT * FROM [nt:file] WHERE [nt:file].[jcr:mimeType] = "text/plain"</sv:value>
2525
</sv:property>
2626
</sv:node>
27-
</sv:node>
27+
</sv:node>

inc/AbstractLoader.php

Lines changed: 30 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
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+
312
namespace PHPCR\Test;
413

514
use 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

Comments
 (0)