This repository has been archived by the owner on Mar 16, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
/
MongoDBImplementationLoader.php
executable file
·174 lines (146 loc) · 6.81 KB
/
MongoDBImplementationLoader.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
<?php
require_once __DIR__.'/../../vendor/phpcr/phpcr-api-tests/inc/AbstractLoader.php';
/**
* Implementation loader for jackalope-mongodb
*/
class ImplementationLoader extends \PHPCR\Test\AbstractLoader
{
private static $instance = null;
private $necessaryConfigValues = array('phpcr.user', 'phpcr.pass', 'phpcr.workspace');
protected function __construct()
{
// Make sure we have the necessary config
foreach ($this->necessaryConfigValues as $val) {
if (empty($GLOBALS[$val])) {
die('Please set ' . $val . ' in your phpunit.xml.' . "\n");
}
}
parent::__construct('Jackalope\RepositoryFactoryMongoDB');
$this->unsupportedChapters = array(
'Export',
'Import',
'NodeTypeManagement',
'SameNameSiblings',
'OrderableChildNodes',
'Observation', // TODO: Transport does not support observation
'Versioning', // TODO: Transport does not support versioning
'Locking', // TODO: Transport does not support locking
'Transactions', // TODO: Transport does not support transactions
);
$this->unsupportedCases = array(
'Writing\\AddMethodsTest',
'Writing\\CloneMethodsTest',
'Writing\\CombinedManipulationsTest',
'Writing\\CopyMethodsTest',
'Writing\\SetPropertyTypesTest',
'Writing\\SetPropertyDynamicRebindingTest',
'Writing\\DeleteMethodsTest',
'Writing\\SetPropertyMethodsTest',
'Writing\\MoveMethodsTest',
'Writing\\NodeTypeAssignementTest',
'Writing\\EncodingTest',
'Writing\\MixinReferenceableTest',
'Writing\\ItemStateTest',
'Writing\\LastModifiedTest',
'Writing\\MixinCreatedTest',
'Query\\XPath\QueryOperationsTest',
'Query\\QuerySql2OperationsTest',
'Query\\RowIteratorTest',
'Query\\RowTest',
'Query\\Sql1\QueryOperationsTest',
);
$this->unsupportedTests = array(
'Connecting\\RepositoryTest::testLoginException', // TODO: figure out what would be invalid credentials
'Connecting\\WorkspaceReadMethodsTest::testGetQueryManager',
'Reading\\SessionReadMethodsTest::testImpersonate', // TODO: Check if that's implemented in newer jackrabbit versions.
'Reading\\SessionNamespaceRemappingTest::testSetNamespacePrefix',
'Reading\\NodeReadMethodsTest::testGetSharedSetUnreferenced', // TODO: should this be moved to 14_ShareableNodes
'Reading\\BinaryReadMethodsTest::testReadBinaryValue', // TODO MongoDB specific fixer-loading problem with binaries
'Reading\\BinaryReadMethodsTest::testIterateBinaryValue',
'Reading\\BinaryReadMethodsTest::testReadBinaryValueAsString',
'Reading\\BinaryReadMethodsTest::testReadBinaryValues',
'Reading\\BinaryReadMethodsTest::testReadBinaryValuesAsString',
'Reading\\BinaryReadMethodsTest::testReadBinaryPathEncoding',
'Reading\\BinaryReadMethodsTest::testReadBinaryPathTrailingQuestionmark',
'Reading\\PropertyReadMethodsTest::testGetBinary',
'Reading\\PropertyReadMethodsTest::testGetBinaryMulti',
'Query\\QueryManagerTest::testGetQuery',
'Query\\QueryManagerTest::testGetQueryInvalid',
'Query\\NodeViewTest::testSeekable',
'Query\\NodeViewTest::testSeekableOutOfBounds',
'Query\\QueryObjectSql2Test::testGetStoredQueryPath',
'Query\\QueryObjectSql2Test::testExecuteLimit',
'Query\\QueryObjectSql2Test::testExecuteOffset',
'Query\\QueryObjectSql2Test::testExecuteLimitAndOffset',
'Query\\QueryResultsTest::testGetColumnNames',
'Query\\QueryResultsTest::testGetAliasColumnNames',
'Query\\QueryResultsTest::testGetSelectorNames',
'Query\\QueryResultsTest::testGetNodes',
'Query\\QueryResultsTest::testIterateOverQueryResult',
'Query\\QueryResultsTest::testReadPropertyContentFromResults',
'Query\\QueryResultsTest::testCompareNumberFields',
'Query\\QueryResultsTest::testCompareStringFields',
'Query\\QueryResultsTest::testBooleanField',
'Query\\CharacterTest::testPropertyWithBackslash',
'Query\\CharacterTest::testPropertyWithDoubleBackslash',
'Query\\CharacterTest::testPropertyWithQuotes',
'Query\\CharacterTest::testPropertyWithQuotesAndBackslash',
'Query\\CharacterTest::testQueryWithAmpersand',
'Query\\NodeViewTest::testIterator',
'Query\\QueryObjectQOMTest::testExecute',
'Query\\QueryObjectQOMTest::testExecuteInvalid',
'Writing\\NamespaceRegistryTest::testRegisterUnregisterNamespace',
'WorkspaceManagement\\WorkspaceManagementTest::testCreateWorkspaceWithSource',
'WorkspaceManagement\\WorkspaceManagementTest::testCreateWorkspaceWithInvalidSource',
'PhpcrUtils\\PurgeTest::testPurge',
'PermissionsAndCapabilities\\PermissionReadTest::testCheckPermissionAccessControlException',
);
}
/**
* Make the repository ready for login with null credentials, handling the
* case where authentication is passed outside the login method.
*
* If the implementation does not support this feature, it must return
* false for this method, otherwise true.
*
* @return boolean true if anonymous login is supposed to work
*/
public function prepareAnonymousLogin()
{
return true;
}
public static function getInstance()
{
if (null === self::$instance) {
self::$instance = new ImplementationLoader();
}
return self::$instance;
}
public function getRepositoryFactoryParameters()
{
global $db; // initialized in bootstrap.php
return array('jackalope.mongodb_database' => $db);
}
public function getCredentials()
{
return new \PHPCR\SimpleCredentials($GLOBALS['phpcr.user'], $GLOBALS['phpcr.pass']);
}
public function getInvalidCredentials()
{
return new \PHPCR\SimpleCredentials('nonexistinguser', '');
}
public function getRestrictedCredentials()
{
return new \PHPCR\SimpleCredentials('anonymous', 'abc');
}
public function getUserId()
{
return $GLOBALS['phpcr.user'];
}
public function getFixtureLoader()
{
global $db; // initialized in bootstrap.php
require_once 'MongoDBFixtureLoader.php';
return new \MongoDBFixtureLoader($db, __DIR__ . "/../fixtures/mongodb/");
}
}