diff --git a/src/Neo4jQueryAPI.php b/src/Neo4jQueryAPI.php index 3808b1d1..7642601c 100644 --- a/src/Neo4jQueryAPI.php +++ b/src/Neo4jQueryAPI.php @@ -1,5 +1,4 @@ client = $client; + $this->responseParser = $responseParser; + $this->requestFactory = $requestFactory; } - - /** * Executes a Cypher query. */ diff --git a/src/abc.php b/src/abc.php new file mode 100644 index 00000000..3343d6a0 --- /dev/null +++ b/src/abc.php @@ -0,0 +1,42 @@ +run($cypher); + + // Check the result structure (debugging purposes) + var_dump($resultSet); // To inspect the response data + + // Handle results + foreach ($resultSet as $row) { + echo "Node: " . json_encode($row) . "\n"; + } + + // Optionally, start a transaction + $transaction = $neo4j->beginTransaction(); + +} catch (Exception $e) { + echo 'Error: ' . $e->getMessage(); +} diff --git a/tests/Integration/Neo4jQueryAPIIntegrationTest.php b/tests/Integration/Neo4jQueryAPIIntegrationTest.php index bd5f1f8c..2d1e2a40 100644 --- a/tests/Integration/Neo4jQueryAPIIntegrationTest.php +++ b/tests/Integration/Neo4jQueryAPIIntegrationTest.php @@ -81,9 +81,23 @@ public function testInvalidQueryHandling() } - private function initializeApi(): Neo4jQueryAPI + /*private function initializeApi(): Neo4jQueryAPI { return Neo4jQueryAPI::login(getenv('NEO4J_ADDRESS'), Authentication::fromEnvironment()); + }*/ + + private function initializeApi(): Neo4jQueryAPI + { + $client = new Client(); + $responseParser = new ResponseParser(ogm: new OGM()); + + $requestFactory = new Neo4jRequestFactory( + psr17Factory: new Psr17Factory(), + streamFactory: new Psr17Factory(), + configuration: new Configuration(baseUri: getenv('NEO4J_ADDRESS')), + auth: Authentication::fromEnvironment() + ); + return new Neo4jQueryAPI($client, $responseParser, $requestFactory); } public function testCounters(): void diff --git a/tests/Integration/Neo4jTransactionIntegrationTest.php b/tests/Integration/Neo4jTransactionIntegrationTest.php index 79994cd6..02721da4 100644 --- a/tests/Integration/Neo4jTransactionIntegrationTest.php +++ b/tests/Integration/Neo4jTransactionIntegrationTest.php @@ -3,9 +3,15 @@ namespace Neo4j\QueryAPI\Tests\Integration; use Exception; +use GuzzleHttp\Client; +use Neo4j\QueryAPI\Configuration; +use Neo4j\QueryAPI\Neo4jRequestFactory; use Neo4j\QueryAPI\Objects\Authentication; use GuzzleHttp\Exception\GuzzleException; use Neo4j\QueryAPI\Neo4jQueryAPI; +use Neo4j\QueryAPI\OGM; +use Neo4j\QueryAPI\ResponseParser; +use Nyholm\Psr7\Factory\Psr17Factory; use PHPUnit\Framework\TestCase; /** @@ -28,14 +34,29 @@ public function setUp(): void /** * @throws Exception */ - private function initializeApi(): Neo4jQueryAPI + /* private function initializeApi(): Neo4jQueryAPI { return Neo4jQueryAPI::login( getenv('NEO4J_ADDRESS'), Authentication::fromEnvironment(), ); - } + }*/ + private function initializeApi(): Neo4jQueryAPI + { + $client = new Client(); // Guzzle Client + + $responseParser = new ResponseParser(ogm: new OGM()); + + $requestFactory = new Neo4jRequestFactory( + psr17Factory: new Psr17Factory(), + streamFactory: new Psr17Factory(), + configuration: new Configuration(baseUri: getenv('NEO4J_ADDRESS')), + auth: Authentication::fromEnvironment() + ); + + return new Neo4jQueryAPI($client, $responseParser, $requestFactory); + } /** * @throws GuzzleException */