Skip to content

Commit 96e67bb

Browse files
committed
updated the unit test for request Factory
1 parent b965f77 commit 96e67bb

11 files changed

+117
-686
lines changed

.php-cs-fixer.cache

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{"php":"8.3.6","version":"3.68.0:v3.68.0#73f78d8b2b34a0dd65fedb434a602ee4c2c8ad4c","indent":" ","lineEnding":"\n","rules":{"binary_operator_spaces":{"default":"at_least_single_space"},"blank_line_after_opening_tag":true,"blank_line_between_import_groups":true,"blank_lines_before_namespace":true,"braces_position":{"allow_single_line_empty_anonymous_classes":true},"class_definition":{"inline_constructor_arguments":false,"space_before_parenthesis":true},"compact_nullable_type_declaration":true,"declare_equal_normalize":true,"lowercase_cast":true,"lowercase_static_reference":true,"new_with_parentheses":true,"no_blank_lines_after_class_opening":true,"no_extra_blank_lines":{"tokens":["use"]},"no_leading_import_slash":true,"no_whitespace_in_blank_line":true,"ordered_class_elements":{"order":["use_trait"]},"ordered_imports":{"imports_order":["class","function","const"],"sort_algorithm":"none"},"return_type_declaration":true,"short_scalar_cast":true,"single_import_per_statement":{"group_to_single_imports":false},"single_space_around_construct":{"constructs_followed_by_a_single_space":["abstract","as","case","catch","class","const_import","do","else","elseif","final","finally","for","foreach","function","function_import","if","insteadof","interface","namespace","new","private","protected","public","static","switch","trait","try","use","use_lambda","while"],"constructs_preceded_by_a_single_space":["as","else","elseif","use_lambda"]},"single_trait_insert_per_statement":true,"ternary_operator_spaces":true,"unary_operator_spaces":{"only_dec_inc":true},"visibility_required":true,"blank_line_after_namespace":true,"constant_case":true,"control_structure_braces":true,"control_structure_continuation_position":true,"elseif":true,"function_declaration":true,"indentation_type":true,"line_ending":true,"lowercase_keywords":true,"method_argument_space":{"attribute_placement":"ignore","on_multiline":"ensure_fully_multiline"},"no_break_comment":true,"no_closing_tag":true,"no_multiple_statements_per_line":true,"no_space_around_double_colon":true,"no_spaces_after_function_name":true,"no_trailing_whitespace":true,"no_trailing_whitespace_in_comment":true,"single_blank_line_at_eof":true,"single_class_element_per_statement":{"elements":["property"]},"single_line_after_imports":true,"spaces_inside_parentheses":true,"statement_indentation":true,"switch_case_semicolon_to_colon":true,"switch_case_space":true,"encoding":true,"full_opening_tag":true,"strict_param":true},"hashes":{"tests\/Unit\/Neo4jExceptionUnitTest.php":"0d7842780eeb9729d501831ee55df0d8","tests\/Unit\/ResultRowTest.php":"f5ee9f21d2439793a290e8ab946a7f32","tests\/Integration\/Neo4jOGMTest.php":"73136b2d28fbb4fa298467d1ab3e18c8","src\/OGM.php":"93aae9c7afc8dbfd5aa00bc1d264ad19","src\/Results\/ResultRow.php":"ad55ec1bd999a8f6ad6b18874c4017b5","src\/Results\/ResultSet.php":"5f7748a356bf0fb30403e3c5a411bd24","src\/Exception\/Neo4jException.php":"dfb0f6933b9d3913c5495ba6d801d5f1","src\/Objects\/Path.php":"88c95962a6316ba7aa2fa3f0f6e31627","src\/Objects\/Node.php":"4a8ab7b8bd1981ee4d35d8c52b81c7c3","src\/Objects\/ProfiledQueryPlanArguments.php":"1be7b230a034a72c13349a5670a34a2f","src\/Objects\/Person.php":"f2f469937660f5454761e4f31154e081","src\/Objects\/Point.php":"169715b2157e08482e420374e6ca4cc3","src\/Objects\/Bookmarks.php":"50f89ca88b2df817433ce8237ccc0f18","src\/Objects\/ResultCounters.php":"a9372c98fe7bede10cb004af30ea502f","src\/Objects\/Relationship.php":"f6347c0260780d4f5d2dc407dc97e25e","src\/Objects\/ProfiledQueryPlan.php":"d9ba608f3177426ea34d73276d75f20b","src\/Objects\/php your-script.php":"63c3a9abbf4774d1da8c5f3c9f8f455e","src\/Objects\/ResultSet.php":"f126eac07a2190797052d123971933be","tests\/resources\/expected\/complex-query-profile.php":"10f481c27e83c1478b5c0e3ad509ab26","src\/Transaction.php":"3e57e12e463749f8e3aabece091c91fc","src\/Neo4jQueryAPI.php":"6b9a0de0fc6aa8afc30dd9bc714d59c8","src\/NoAuth.php":"1db5e3d1197fe4f14e82e169d472e9d4","src\/AuthenticateInterface.php":"4f8ba55f92481b88d7a0ea556d2d24c5","src\/BasicAuthentication.php":"2fa3b9cb881ffb42c958020ea93fa3c3","src\/Objects\/Authentication.php":"9a542d736e88d3146232921a0f8f7852","tests\/Unit\/AuthenticationTest.php":"b3a14c0ff573deb58f62803a08f14865","src\/BearerAuthentication.php":"d74739bcc5f7dac5a5d55084807b8713","src\/Neo4jRequestFactory.php":"e15e376f6f23bb6b35370151144c9a51","src\/requestFactory.php":"cc6047aed36bd747a129775af374100b","tests\/Unit\/Neo4jQueryAPIUnitTest.php":"2d0183e377b28f6381e3a065592118c4","tests\/Integration\/Neo4jQueryAPIIntegrationTest.php":"22b47366ff9c4599c2414356aaa14030"}}
1+
{"php":"8.3.6","version":"3.68.0:v3.68.0#73f78d8b2b34a0dd65fedb434a602ee4c2c8ad4c","indent":" ","lineEnding":"\n","rules":{"binary_operator_spaces":{"default":"at_least_single_space"},"blank_line_after_opening_tag":true,"blank_line_between_import_groups":true,"blank_lines_before_namespace":true,"braces_position":{"allow_single_line_empty_anonymous_classes":true},"class_definition":{"inline_constructor_arguments":false,"space_before_parenthesis":true},"compact_nullable_type_declaration":true,"declare_equal_normalize":true,"lowercase_cast":true,"lowercase_static_reference":true,"new_with_parentheses":true,"no_blank_lines_after_class_opening":true,"no_extra_blank_lines":{"tokens":["use"]},"no_leading_import_slash":true,"no_whitespace_in_blank_line":true,"ordered_class_elements":{"order":["use_trait"]},"ordered_imports":{"imports_order":["class","function","const"],"sort_algorithm":"none"},"return_type_declaration":true,"short_scalar_cast":true,"single_import_per_statement":{"group_to_single_imports":false},"single_space_around_construct":{"constructs_followed_by_a_single_space":["abstract","as","case","catch","class","const_import","do","else","elseif","final","finally","for","foreach","function","function_import","if","insteadof","interface","namespace","new","private","protected","public","static","switch","trait","try","use","use_lambda","while"],"constructs_preceded_by_a_single_space":["as","else","elseif","use_lambda"]},"single_trait_insert_per_statement":true,"ternary_operator_spaces":true,"unary_operator_spaces":{"only_dec_inc":true},"visibility_required":true,"blank_line_after_namespace":true,"constant_case":true,"control_structure_braces":true,"control_structure_continuation_position":true,"elseif":true,"function_declaration":true,"indentation_type":true,"line_ending":true,"lowercase_keywords":true,"method_argument_space":{"attribute_placement":"ignore","on_multiline":"ensure_fully_multiline"},"no_break_comment":true,"no_closing_tag":true,"no_multiple_statements_per_line":true,"no_space_around_double_colon":true,"no_spaces_after_function_name":true,"no_trailing_whitespace":true,"no_trailing_whitespace_in_comment":true,"single_blank_line_at_eof":true,"single_class_element_per_statement":{"elements":["property"]},"single_line_after_imports":true,"spaces_inside_parentheses":true,"statement_indentation":true,"switch_case_semicolon_to_colon":true,"switch_case_space":true,"encoding":true,"full_opening_tag":true,"strict_param":true},"hashes":{"tests\/Unit\/Neo4jExceptionUnitTest.php":"0d7842780eeb9729d501831ee55df0d8","tests\/Unit\/ResultRowTest.php":"f5ee9f21d2439793a290e8ab946a7f32","tests\/Integration\/Neo4jOGMTest.php":"73136b2d28fbb4fa298467d1ab3e18c8","src\/OGM.php":"93aae9c7afc8dbfd5aa00bc1d264ad19","src\/Results\/ResultRow.php":"ad55ec1bd999a8f6ad6b18874c4017b5","src\/Results\/ResultSet.php":"5f7748a356bf0fb30403e3c5a411bd24","src\/Exception\/Neo4jException.php":"dfb0f6933b9d3913c5495ba6d801d5f1","src\/Objects\/Path.php":"88c95962a6316ba7aa2fa3f0f6e31627","src\/Objects\/Node.php":"4a8ab7b8bd1981ee4d35d8c52b81c7c3","src\/Objects\/ProfiledQueryPlanArguments.php":"1be7b230a034a72c13349a5670a34a2f","src\/Objects\/Person.php":"f2f469937660f5454761e4f31154e081","src\/Objects\/Point.php":"169715b2157e08482e420374e6ca4cc3","src\/Objects\/Bookmarks.php":"50f89ca88b2df817433ce8237ccc0f18","src\/Objects\/ResultCounters.php":"a9372c98fe7bede10cb004af30ea502f","src\/Objects\/Relationship.php":"f6347c0260780d4f5d2dc407dc97e25e","src\/Objects\/ProfiledQueryPlan.php":"d9ba608f3177426ea34d73276d75f20b","src\/Objects\/php your-script.php":"63c3a9abbf4774d1da8c5f3c9f8f455e","src\/Objects\/ResultSet.php":"f126eac07a2190797052d123971933be","tests\/resources\/expected\/complex-query-profile.php":"10f481c27e83c1478b5c0e3ad509ab26","src\/Transaction.php":"3e57e12e463749f8e3aabece091c91fc","tests\/Unit\/Neo4jQueryAPIUnitTest.php":"2d0183e377b28f6381e3a065592118c4","tests\/Unit\/Neo4jRequestFactoryTest.php":"8fdcf16ec45f05a923bf36ee94583df7","tests\/Unit\/AuthenticationTest.php":"58e41cacacf5f521fef5abc25ad4bc9f","tests\/Integration\/Neo4jQueryAPIIntegrationTest.php":"975c579bb20d1f5a2f2dfbef7af2af61","src\/Neo4jQueryAPI.php":"c145914ee1458602691bab00d1822e77","src\/BearerAuthentication.php":"0c6a9ba4adc3b762a586f8d1d58e62dc","src\/NoAuth.php":"80e445bfbd33cc7b60036db9461e0706","src\/AuthenticateInterface.php":"36290631a54b09926af0d78af8fc7282","src\/BasicAuthentication.php":"efaae7442bf25f033548765fd06b70dd","src\/Neo4jRequestFactory.php":"2c1b08e8547ff90fee8826ad02e7c65c","src\/Objects\/Authentication.php":"de564835b80cf54171f42c3f5fccda28","src\/requestFactory.php":"23cff999060edda7bd1f19b7122d4b49"}}

src/AuthenticateInterface.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
use Psr\Http\Message\RequestInterface;
66

7-
interface AuthenticateInterface extends RequestInterface
7+
interface AuthenticateInterface
88
{
99
/**
1010
* Authenticates the request by returning a new instance of the request with the authentication information attached.

src/BasicAuthentication.php

Lines changed: 4 additions & 82 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,8 @@
22

33
namespace Neo4j\QueryAPI;
44

5-
use Psr\Http\Message\MessageInterface;
65
use Psr\Http\Message\RequestInterface;
76
use Psr\Http\Message\ResponseInterface;
8-
use Psr\Http\Message\StreamInterface;
9-
use Psr\Http\Message\UriInterface;
107

118
class BasicAuthentication implements AuthenticateInterface
129
{
@@ -19,89 +16,14 @@ public function authenticate(RequestInterface $request): RequestInterface
1916
$authHeader = 'Basic ' . base64_encode($this->username . ':' . $this->password);
2017
return $request->withHeader('Authorization', $authHeader);
2118
}
22-
23-
public function getProtocolVersion(): string
24-
{
25-
// TODO: Implement getProtocolVersion() method.
26-
}
27-
28-
public function withProtocolVersion(string $version): MessageInterface
29-
{
30-
// TODO: Implement withProtocolVersion() method.
31-
}
32-
33-
public function getHeaders(): array
34-
{
35-
// TODO: Implement getHeaders() method.
36-
}
37-
38-
public function hasHeader(string $name): bool
19+
public function getHeader(): string
3920
{
40-
// TODO: Implement hasHeader() method.
21+
return 'Basic ' . base64_encode($this->username . ':' . $this->password);
4122
}
4223

43-
public function getHeader(string $name): array
24+
public function getType(): string
4425
{
45-
// TODO: Implement getHeader() method.
26+
return 'Basic';
4627
}
4728

48-
public function getHeaderLine(string $name): string
49-
{
50-
// TODO: Implement getHeaderLine() method.
51-
}
52-
53-
public function withHeader(string $name, $value): MessageInterface
54-
{
55-
// TODO: Implement withHeader() method.
56-
}
57-
58-
public function withAddedHeader(string $name, $value): MessageInterface
59-
{
60-
// TODO: Implement withAddedHeader() method.
61-
}
62-
63-
public function withoutHeader(string $name): MessageInterface
64-
{
65-
// TODO: Implement withoutHeader() method.
66-
}
67-
68-
public function getBody(): StreamInterface
69-
{
70-
// TODO: Implement getBody() method.
71-
}
72-
73-
public function withBody(StreamInterface $body): MessageInterface
74-
{
75-
// TODO: Implement withBody() method.
76-
}
77-
78-
public function getRequestTarget(): string
79-
{
80-
// TODO: Implement getRequestTarget() method.
81-
}
82-
83-
public function withRequestTarget(string $requestTarget): RequestInterface
84-
{
85-
// TODO: Implement withRequestTarget() method.
86-
}
87-
88-
public function getMethod(): string
89-
{
90-
// TODO: Implement getMethod() method.
91-
}
92-
93-
public function withMethod(string $method): RequestInterface
94-
{
95-
// TODO: Implement withMethod() method.
96-
}
97-
98-
public function getUri(): UriInterface
99-
{
100-
// TODO: Implement getUri() method.
101-
}
102-
103-
public function withUri(UriInterface $uri, bool $preserveHost = false): RequestInterface
104-
{
105-
// TODO: Implement withUri() method.
106-
}
10729
}

src/BearerAuthentication.php

Lines changed: 4 additions & 83 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,7 @@
22

33
namespace Neo4j\QueryAPI;
44

5-
use Psr\Http\Message\MessageInterface;
65
use Psr\Http\Message\RequestInterface;
7-
use Psr\Http\Message\StreamInterface;
8-
use Psr\Http\Message\UriInterface;
96

107
class BearerAuthentication implements AuthenticateInterface
118
{
@@ -18,89 +15,13 @@ public function authenticate(RequestInterface $request): RequestInterface
1815
$authHeader = 'Bearer ' . $this->token;
1916
return $request->withHeader('Authorization', $authHeader);
2017
}
21-
22-
public function getProtocolVersion(): string
23-
{
24-
// TODO: Implement getProtocolVersion() method.
25-
}
26-
27-
public function withProtocolVersion(string $version): MessageInterface
28-
{
29-
// TODO: Implement withProtocolVersion() method.
30-
}
31-
32-
public function getHeaders(): array
33-
{
34-
// TODO: Implement getHeaders() method.
35-
}
36-
37-
public function hasHeader(string $name): bool
38-
{
39-
// TODO: Implement hasHeader() method.
40-
}
41-
42-
public function getHeader(string $name): array
43-
{
44-
// TODO: Implement getHeader() method.
45-
}
46-
47-
public function getHeaderLine(string $name): string
48-
{
49-
// TODO: Implement getHeaderLine() method.
50-
}
51-
52-
public function withHeader(string $name, $value): MessageInterface
53-
{
54-
// TODO: Implement withHeader() method.
55-
}
56-
57-
public function withAddedHeader(string $name, $value): MessageInterface
58-
{
59-
// TODO: Implement withAddedHeader() method.
60-
}
61-
62-
public function withoutHeader(string $name): MessageInterface
63-
{
64-
// TODO: Implement withoutHeader() method.
65-
}
66-
67-
public function getBody(): StreamInterface
68-
{
69-
// TODO: Implement getBody() method.
70-
}
71-
72-
public function withBody(StreamInterface $body): MessageInterface
73-
{
74-
// TODO: Implement withBody() method.
75-
}
76-
77-
public function getRequestTarget(): string
78-
{
79-
// TODO: Implement getRequestTarget() method.
80-
}
81-
82-
public function withRequestTarget(string $requestTarget): RequestInterface
83-
{
84-
// TODO: Implement withRequestTarget() method.
85-
}
86-
87-
public function getMethod(): string
88-
{
89-
// TODO: Implement getMethod() method.
90-
}
91-
92-
public function withMethod(string $method): RequestInterface
93-
{
94-
// TODO: Implement withMethod() method.
95-
}
96-
97-
public function getUri(): UriInterface
18+
public function getHeader(): string
9819
{
99-
// TODO: Implement getUri() method.
20+
return 'Bearer ' . $this->token;
10021
}
10122

102-
public function withUri(UriInterface $uri, bool $preserveHost = false): RequestInterface
23+
public function getType(): string
10324
{
104-
// TODO: Implement withUri() method.
25+
return 'Bearer';
10526
}
10627
}

0 commit comments

Comments
 (0)