-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathImplementationLoader.php
182 lines (148 loc) · 6.95 KB
/
ImplementationLoader.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
<?php
use Symfony\Component\Filesystem\Filesystem;
/**
* Implemnentation Loader for filesystem
*/
class ImplementationLoader extends \PHPCR\Test\AbstractLoader
{
private static $instance = null;
public static function getInstance()
{
if (null === self::$instance) {
self::$instance = new ImplementationLoader();
}
return self::$instance;
}
/**
* Base path for content repository
* @var string
*/
private $path;
protected function __construct()
{
parent::__construct('Jackalope\RepositoryFactoryFilesystem', $GLOBALS['phpcr.workspace']);
$this->unsupportedChapters = array(
// to be supported
'WorkspaceManagement',
'ShareableNodes',
'Versioning',
'AccessControlManagement',
'Locking',
'LifecycleManagement',
'RetentionAndHold',
'Transactions',
'SameNameSiblings',
'OrderableChildNodes',
// not supported yet
'PermissionsAndCapabilities',
'Observation',
);
$this->unsupportedCases = array(
'Query\\XPath', // Query language 'xpath' not implemented.
'Query\\Sql1', // Query language 'sql' is legacy and only makes sense with jackrabbit
'Writing\\CloneMethodsTest', // TODO: Support for workspace->clone, node->update, node->getCorrespondingNodePath
);
$this->unsupportedTests = array(
'Connecting\\RepositoryTest::testLoginException', //TODO: figure out what would be invalid credentials
'Reading\\NodeReadMethodsTest::testGetSharedSetUnreferenced', // TODO: should this be moved to 14_ShareableNodes
'Reading\SessionNamespaceRemappingTest::testSetNamespacePrefix', // not supported by jackalope
'Reading\\SessionReadMethodsTest::testImpersonate', //TODO: Check if that's implemented in newer jackrabbit versions.
// see https://github.com/jackalope/jackalope/pull/229
'Reading\\NodeReadMethodsTest::testGetNodesTypeFilter', //TODO implement node type filtering
'Reading\\NodeReadMethodsTest::testGetNodesTypeFilterList', //TODO implement node type filtering
'Query\\NodeViewTest::testSeekable', // see https://github.com/phpcr/phpcr-api-tests/issues/141
// not supported by jackalope
'Query\\QueryManagerTest::testGetQuery',
'Query\\QueryManagerTest::testGetQueryInvalid',
'Query\\QueryObjectSql2Test::testGetStoredQueryPath',
'Query\\QuerySql2OperationsTest::testQueryJoin',
'Query\\QuerySql2OperationsTest::testQueryJoinChildnode',
'Query\\QuerySql2OperationsTest::testQueryJoinReference',
'Query\\QuerySql2OperationsTest::testQueryJoinWithAlias',
'Query\\QuerySql2OperationsTest::testQueryLeftJoin',
'Query\\QuerySql2OperationsTest::testQueryRightJoin',
// length not supported
'Query\QuerySql2OperationsTest::testLengthOperandOnBinaryProperty',
'Query\QuerySql2OperationsTest::testLengthOperandOnEmptyProperty',
'Query\QuerySql2OperationsTest::testLengthOperandOnStringProperty',
// invalid query for zendsearch
'Query\QuerySql2OperationsTest::testQueryFieldDate',
// source class 'Jackalope\Query\QOM\Join' is not supported
'Query\QuerySql2OperationsTest::testQueryJoinNested',
'Query\QuerySql2OperationsTest::testQueryLeftJoinNull',
// this doesn't work with ZendSearch yet
'Query\QueryResultsTest::testCompareNumberFieldsMulti',
'Reading\BinaryReadMethodsTest::testReadEmptyBinaryMultivalue',
'Writing\CombinedManipulationsTest::testRemoveSessionRefresh',
'Writing\CopyMethodsTest::testCopyPreserveChildOrder',
'Writing\DeleteMethodsTest::testDeletePreviouslyReferencedNodeInMultipleProperty',
'Writing\SetPropertyMethodsTest::testSetPropertyMultivalueAllNull',
'Writing\CopyMethodsTest::testWorkspaceCopyReference',
'Writing\CopyMethodsTest::testCopyChildrenBinaryData',
'Writing\CopyMethodsTest::testCopyChildrenBinaryDataMultivalue',
'Writing\MoveMethodsTest::testNodeRename',
// this doesn't work with ZendSearch -- need to implement a native search engine
'Writing\CombinedManipulationsTest::testAddAndRemoveAndAdd',
'Writing\CombinedManipulationsTest::testRemoveAndAddToplevelNode',
'Writing\CombinedManipulationsTest::testRemoveAndAddAndRemoveToplevelNode',
'Writing\\CopyMethodsTest::testCopyUpdateOnCopy', //TODO: update-on-copy is currently not supported
'Writing\\CopyMethodsTest::testCopyUpdateOnCopy', //TODO: update-on-copy is currently not supported
'Writing\LastModifiedTest::testUpdateText',
'Writing\LastModifiedTest::testUpdateBinary',
'Writing\LastModifiedTest::testRemoveProperty',
'Writing\SetPropertyTypesTest::testCreateValueBinaryFromStream',
'Writing\SetPropertyTypesTest::testCreateValueBinaryFromStreamAndRead',
);
$this->path = __DIR__ . '/data';
// start with a clean system
$filesystem = new Filesystem();
$filesystem->remove($this->path);
}
public function getRepositoryFactoryParameters()
{
return array('path' => $this->path);
}
public function getCredentials()
{
return new \PHPCR\SimpleCredentials('admin', 'admin');
}
public function getInvalidCredentials()
{
return new \PHPCR\SimpleCredentials('nonexistinguser', '');
}
public function getRestrictedCredentials()
{
return new \PHPCR\SimpleCredentials('anonymous', 'abc');
}
public function prepareAnonymousLogin()
{
return false;
}
public function getUserId()
{
return 'admin';
}
public function getRepository()
{
$transport = new \Jackalope\Transport\Fs\Client(new \Jackalope\Factory, array(
'path' => $this->path,
'search.enabled' => true,
'search.zend.hide_destruct_exception' => true,
));
foreach (array($GLOBALS['phpcr.workspace'], $this->otherWorkspacename) as $workspace) {
try {
$transport->createWorkspace($workspace);
} catch (\PHPCR\RepositoryException $e) {
if ($e->getMessage() != "Workspace '$workspace' already exists") {
// if the message is not that the workspace already exists, something went really wrong
throw $e;
}
}
}
return new \Jackalope\Repository(null, $transport, $this->getRepositoryFactoryParameters());
}
public function getFixtureLoader()
{
return new \Jackalope\Test\Tester\FilesystemFixtureLoader();
}
}