Skip to content

Commit 5f3809f

Browse files
committed
fixed the test for stub -basic-query in testkit
1 parent de6a404 commit 5f3809f

File tree

7 files changed

+338
-61
lines changed

7 files changed

+338
-61
lines changed

src/Formatter/Specialised/BoltOGMTranslator.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,9 @@ private function makeFromBoltRelationship(BoltRelationship $rel): Relationship
178178
foreach ($rel->properties as $key => $property) {
179179
$map[$key] = $this->mapValueToType($property);
180180
}
181+
/** @var string|null $elementId */
182+
$startNodeElementId = null;
183+
$endNodeElementId = null;
181184

182185
/** @var string|null $elementId */
183186
$elementId = null;
@@ -191,7 +194,9 @@ private function makeFromBoltRelationship(BoltRelationship $rel): Relationship
191194
$rel->endNodeId,
192195
$rel->type,
193196
new CypherMap($map),
194-
$elementId
197+
$elementId,
198+
$startNodeElementId, // Add this parameter
199+
$endNodeElementId
195200
);
196201
}
197202

src/Types/Relationship.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@
2424
*/
2525
final class Relationship extends UnboundRelationship
2626
{
27+
private string $startNodeElementId;
28+
private string $endNodeElementId;
29+
2730
/**
2831
* @param CypherMap<OGMTypes> $properties
2932
*/
@@ -34,8 +37,17 @@ public function __construct(
3437
string $type,
3538
CypherMap $properties,
3639
?string $elementId,
40+
int|string|null $startNodeElementId = null,
41+
int|string|null $endNodeElementId = null,
3742
) {
3843
parent::__construct($id, $type, $properties, $elementId);
44+
$this->startNodeElementId = $startNodeElementId !== null
45+
? (string) $startNodeElementId
46+
: (string) $startNodeId;
47+
48+
$this->endNodeElementId = $endNodeElementId !== null
49+
? (string) $endNodeElementId
50+
: (string) $endNodeId;
3951
}
4052

4153
/**

src/Types/UnboundRelationship.php

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,15 @@ class UnboundRelationship extends AbstractPropertyObject
3232
/**
3333
* @param CypherMap<OGMTypes> $properties
3434
*/
35+
private string $elementId;
36+
3537
public function __construct(
3638
private readonly int $id,
3739
private readonly string $type,
3840
private readonly CypherMap $properties,
39-
private readonly ?string $elementId,
41+
?string $elementId = null,
4042
) {
43+
$this->elementId = $elementId ?? (string) $id;
4144
}
4245

4346
public function getElementId(): ?string
@@ -55,6 +58,9 @@ public function getType(): string
5558
return $this->type;
5659
}
5760

61+
/**
62+
* @psalm-suppress MixedReturnTypeCoercion
63+
*/
5864
public function getProperties(): CypherMap
5965
{
6066
/** @psalm-suppress InvalidReturnStatement false positive with type alias. */
@@ -80,7 +86,11 @@ public function toArray(): array
8086
*
8187
* @return OGMTypes
8288
*/
83-
public function getProperty(string $key)
89+
90+
/**
91+
* @psalm-suppress MixedReturnStatement
92+
*/
93+
public function getProperty(string $key): string
8494
{
8595
/** @psalm-suppress ImpureMethodCall */
8696
if (!$this->properties->hasKey($key)) {

testkit-backend/features.php

Lines changed: 205 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,28 +12,207 @@
1212
*/
1313

1414
return [
15+
'Feature:API:SSLSchemes' => true,
16+
// === FUNCTIONAL FEATURES ===
17+
// Driver supports the Bookmark Manager Feature
18+
'Feature:API:BookmarkManager' => true,
19+
// The driver offers a configuration option to limit time it spends at most,
20+
// trying to acquire a connection from the pool.
21+
'Feature:API:ConnectionAcquisitionTimeout' => true,
22+
// The driver offers a method to run a query in a retryable context at the
23+
// driver object level.
24+
'Feature:API:Driver.ExecuteQuery' => true,
25+
// The driver allows users to specify a session scoped auth token when
26+
// invoking driver.executeQuery.
27+
'Feature:API:Driver.ExecuteQuery:WithAuth' => true,
28+
// The driver offers a method for checking if a connection to the remote
29+
// server of cluster can be established and retrieve the server info of the
30+
// reached remote.
31+
'Feature:API:Driver:GetServerInfo' => true,
32+
// The driver offers a method for driver objects to report if they were
33+
// configured with a or without encryption.
34+
'Feature:API:Driver.IsEncrypted' => true,
35+
// The driver supports setting a custom max connection lifetime
36+
'Feature:API:Driver:MaxConnectionLifetime' => true,
37+
// The driver supports notification filters configuration.
38+
'Feature:API:Driver:NotificationsConfig' => true,
39+
// The driver offers a method for checking if the provided authentication
40+
// information is accepted by the server.
41+
'Feature:API:Driver.VerifyAuthentication' => true,
42+
// The driver offers a method for checking if a connection to the remote
43+
// server of cluster can be established.
44+
'Feature:API:Driver.VerifyConnectivity' => true,
45+
// The driver offers a method for checking if a protocol version negotiated
46+
// with the remote supports re-authentication.
47+
'Feature:API:Driver.SupportsSessionAuth' => true,
48+
// The driver supports connection liveness check.
49+
'Feature:API:Liveness.Check' => true,
50+
// The driver offers a method for the result to return all records as a list
51+
// or array. This method should exhaust the result.
52+
'Feature:API:Result.List' => true,
53+
// The driver offers a method for the result to peek at the next record in
54+
// the result stream without advancing it (i.e. without consuming any
55+
// records)
56+
'Feature:API:Result.Peek' => true,
57+
// The driver offers a method for the result to retrieve exactly one record.
58+
// This method asserts that exactly one record in left in the result
59+
// stream, else it will raise an exception.
60+
'Feature:API:Result.Single' => true,
61+
// The driver offers a method for the result to retrieve the next record in
62+
// the result stream. If there are no more records left in the result, the
63+
// driver will indicate so by returning None/null/nil/any other empty value.
64+
// If there are more than records, the driver emits a warning.
65+
// This method is supposed to always exhaust the result stream.
66+
'Feature:API:Result.SingleOptional' => true,
67+
// The driver offers a way to determine if exceptions are retryable or not.
68+
'Feature:API:RetryableExceptions' => true,
69+
// The session configuration allows to switch the authentication context
70+
// by supplying new credentials. This new context is only valid for the
71+
// current session.
72+
'Feature:API:Session:AuthConfig' => true,
73+
// The session supports notification filters configuration.
74+
'Feature:API:Session:NotificationsConfig' => true,
75+
// The driver implements configuration for client certificates.
76+
'Feature:API:SSLClientCertificate' => true,
77+
// The driver implements explicit configuration options for SSL.
78+
// - enable / disable SSL
79+
// - verify signature against system store / custom cert / not at all
80+
'Feature:API:SSLConfig' => true,
81+
// The result summary provides a way to access the transaction's
82+
// GqlStatusObject.
83+
'Feature:API:Summary:GqlStatusObjects' => true,
84+
// The driver supports sending and receiving geospatial data types.
85+
'Feature:API:Type.Spatial' => true,
86+
// The driver supports sending and receiving temporal data types.
87+
'Feature:API:Type.Temporal' => true,
88+
// The driver supports single-sign-on (SSO) by providing a bearer auth token
89+
// API.
90+
'Feature:Auth:Bearer' => true,
91+
// The driver supports custom authentication by providing a dedicated auth
92+
// token API.
93+
'Feature:Auth:Custom' => true,
94+
// The driver supports Kerberos authentication by providing a dedicated auth
95+
// token API.
96+
'Feature:Auth:Kerberos' => true,
97+
// The driver supports an auth token manager or similar mechanism for the
98+
// user to provide (potentially changing) auth tokens and a way to get
99+
// notified when the server reports a token expired.
100+
'Feature:Auth:Managed' => false,
101+
// The driver supports Bolt protocol version 3
102+
'Feature:Bolt:3.0' => true,
103+
// The driver supports Bolt protocol version 4.1
104+
'Feature:Bolt:4.1' => true,
105+
// The driver supports Bolt protocol version 4.2
106+
'Feature:Bolt:4.2' => true,
107+
// The driver supports Bolt protocol version 4.3
108+
'Feature:Bolt:4.3' => true,
109+
// The driver supports Bolt protocol version 4.4
110+
'Feature:Bolt:4.4' => true,
111+
// The driver supports Bolt protocol version 5.0
112+
'Feature:Bolt:5.0' => true,
113+
// The driver supports Bolt protocol version 5.1
114+
'Feature:Bolt:5.1' => true,
115+
// The driver supports Bolt protocol version 5.2
116+
'Feature:Bolt:5.2' => true,
117+
// The driver supports Bolt protocol version 5.3
118+
'Feature:Bolt:5.3' => true,
119+
// The driver supports Bolt protocol version 5.4
120+
'Feature:Bolt:5.4' => true,
121+
// The driver supports Bolt protocol version 5.5, support dropped due
122+
// to a bug in the spec
123+
'Feature:Bolt:5.5' => true,
124+
// The driver supports Bolt protocol version 5.6
125+
'Feature:Bolt:5.6' => true,
126+
// The driver supports Bolt protocol version 5.7
127+
'Feature:Bolt:5.7' => true,
128+
// The driver supports Bolt protocol version 5.8
129+
'Feature:Bolt:5.8' => true,
130+
// The driver supports negotiating the Bolt protocol version with the server
131+
// using handshake manifest v1.
132+
'Feature:Bolt:HandshakeManifestV1' => true,
133+
// The driver supports patching DateTimes to use UTC for Bolt 4.3 and 4.4
134+
'Feature:Bolt:Patch:UTC' => true,
135+
// The driver supports impersonation
136+
'Feature:Impersonation' => true,
137+
// The driver supports TLS 1.1 connections.
138+
// If this flag is missing, TestKit assumes that attempting to establish
139+
// such a connection fails.
140+
'Feature:TLS:1.1' => true,
141+
// The driver supports TLS 1.2 connections.
142+
// If this flag is missing, TestKit assumes that attempting to establish
143+
// such a connection fails.
144+
'Feature:TLS:1.2' => true,
145+
// The driver supports TLS 1.3 connections.
146+
// If this flag is missing, TestKit assumes that attempting to establish
147+
// such a connection fails.
148+
'Feature:TLS:1.3' => true,
149+
15150
// === OPTIMIZATIONS ===
16151
// On receiving Neo.ClientError.Security.AuthorizationExpired, the driver
17152
// shouldn't reuse any open connections for anything other than finishing
18153
// a started job. All other connections should be re-established before
19154
// running the next job with them.
20-
'AuthorizationExpiredTreatment' => false,
21-
155+
'AuthorizationExpiredTreatment' => true,
156+
// (Bolt 5.1+) The driver doesn't wait for a SUCCESS after HELLO but
157+
// pipelines a LOGIN right afterwards and consumes two messages after.
158+
// Likewise, doesn't wait for a SUCCESS after LOGOFF and the following
159+
// LOGON but pipelines it with the next message and consumes all three
160+
// responses at once.
161+
// Each saves a full round-trip.
162+
'Optimization:AuthPipelining' => true,
163+
// The driver caches connections (e.g., in a pool) and doesn't start a new
164+
// one (with hand-shake, HELLO, etc.) for each query.
165+
'Optimization:ConnectionReuse' => true,
166+
// The driver first tries to SUCCESSfully BEGIN a transaction before calling
167+
// the user-defined transaction function. This way, the (potentially costly)
168+
// transaction function is not started until a working transaction has been
169+
// established.
170+
'Optimization:EagerTransactionBegin' => true,
171+
// For the executeQuery API, the driver doesn't wait for a SUCCESS after
172+
// sending BEGIN but pipelines the RUN and PULL right afterwards and
173+
// consumes three messages after that. This saves 2 full round-trips.
174+
'Optimization:ExecuteQueryPipelining' => true,
175+
// The driver implements a cache to match users to their most recently
176+
// resolved home database, routing requests with no set database to this
177+
// cached database if all open connections have an SSR connection hint.
178+
'Optimization:HomeDatabaseCache' => true,
179+
// The home db cache for optimistic home db resolution treats the principal
180+
// in basic auth the exact same way it treats impersonated users.
181+
'Optimization:HomeDbCacheBasicPrincipalIsImpersonatedUser' => true,
22182
// Driver doesn't explicitly send message data that is the default value.
23183
// This conserves bandwidth.
24-
'Optimization:ImplicitDefaultArguments' => false,
25-
184+
'Optimization:ImplicitDefaultArguments' => true,
185+
// Driver should not send duplicated bookmarks to the server
186+
'Optimization:MinimalBookmarksSet' => true,
26187
// The driver sends no more than the strictly necessary RESET messages.
27-
'Optimization:MinimalResets' => false,
28-
29-
// The driver caches connections (e.g., in a pool) and doesn't start a new
30-
// one (with hand-shake, HELLO, etc.) for each query.
31-
'Optimization:ConnectionReuse' => false,
32-
188+
'Optimization:MinimalResets' => true,
189+
// The driver's VerifyAuthentication method is optimized. It
190+
// * reuses connections from the pool
191+
// * only issues a single LOGOFF/LOGON cycle
192+
// * doesn't issue the cycle for newly established connections
193+
'Optimization:MinimalVerifyAuthentication' => true,
33194
// The driver doesn't wait for a SUCCESS after calling RUN but pipelines a
34195
// PULL right afterwards and consumes two messages after that. This saves a
35196
// full round-trip.
36-
'Optimization:PullPipelining' => false,
197+
'Optimization:PullPipelining' => true,
198+
// This feature requires `API_RESULT_LIST`.
199+
// The driver pulls all records (`PULL -1`) when Result.list() is called.
200+
// (As opposed to iterating over the Result with the configured fetch size.)
201+
// Note: If your driver supports this, make sure to document well that this
202+
// method ignores the configures fetch size. Your users will
203+
// appreciate it <3.
204+
'Optimization:ResultListFetchAll' => true,
205+
206+
// === IMPLEMENTATION DETAILS ===
207+
// `Driver.IsEncrypted` can also be called on closed drivers.
208+
'Detail:ClosedDriverIsEncrypted' => true,
209+
// Security configuration options for encryption and certificates are
210+
// compared based on their value and might still match the default
211+
// configuration as long as values match.
212+
'Detail:DefaultSecurityConfigValueEquality' => true,
213+
// The driver cannot differentiate between integer and float numbers.
214+
// I.e., JavaScript :P
215+
'Detail:NumberIsNumber' => true,
37216

38217
// === CONFIGURATION HINTS (BOLT 4.3+) ===
39218
// The driver understands and follow the connection hint
@@ -42,7 +221,21 @@
42221
// time period. On timout, the driver should remove the server from its
43222
// routing table and assume all other connections to the server are dead
44223
// as well.
45-
'ConfHint:connection.recv_timeout_seconds' => false,
224+
'ConfHint:connection.recv_timeout_seconds' => true,
225+
226+
// === BACKEND FEATURES FOR TESTING ===
227+
// The backend understands the FakeTimeInstall, FakeTimeUninstall and
228+
// FakeTimeTick protocol messages and provides a way to mock the system
229+
// time. This is mainly used for testing various timeouts.
230+
'Backend:MockTime' => true,
231+
// The backend understands the GetRoutingTable protocol message and provides
232+
// a way for TestKit to request the routing table (for testing only, should
233+
// not be exposed to the user).
234+
'Backend:RTFetch' => true,
235+
// The backend understands the ForcedRoutingTableUpdate protocol message
236+
// and provides a way to force a routing table update (for testing only,
237+
// should not be exposed to the user).
238+
'Backend:RTForceUpdate' => true,
46239

47240
// Temporary driver feature that will be removed when all official drivers
48241
// have been unified in their behaviour of when they return a Result object.

0 commit comments

Comments
 (0)