Skip to content

Commit

Permalink
tested getResult
Browse files Browse the repository at this point in the history
As pointed out by florent here: neo4j-examples/movies-php-client#2
  • Loading branch information
transistive committed Jan 14, 2022
1 parent dcafe33 commit 91c1ee2
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/Databags/SummarizedResult.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public function getSummary(): ResultSummary
return $this->summary;
}

public function getResult(): CypherList
public function getResults(): CypherList
{
return new CypherList($this);
}
Expand Down
23 changes: 23 additions & 0 deletions tests/Integration/SummarizedResultFormatterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
use Laudis\Neo4j\Databags\SummarizedResult;
use Laudis\Neo4j\Databags\SummaryCounters;
use Laudis\Neo4j\Formatter\SummarizedResultFormatter;
use Laudis\Neo4j\Types\CypherList;
use Laudis\Neo4j\Types\CypherMap;
use function random_bytes;

Expand Down Expand Up @@ -59,4 +60,26 @@ public function testAcceptanceWrite(string $alias): void
}, $alias)->getSummary()->getCounters();
self::assertEquals(new SummaryCounters(1, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, true), $counters);
}

/**
* @dataProvider connectionAliases
*
* @throws Exception
*/
public function testGetResults(string $alias): void
{
$results = $this->getClient()->run('RETURN 1 AS one', [], $alias)->getResults();

self::assertNotInstanceOf(SummarizedResult::class, $results);
self::assertInstanceOf(CypherList::class, $results);

$jsonSerialize = $results->jsonSerialize();
self::assertIsArray($jsonSerialize);
self::assertArrayNotHasKey('summary', $jsonSerialize);
self::assertArrayNotHasKey('result', $jsonSerialize);

$first = $results->first();
self::assertInstanceOf(CypherMap::class, $first);
self::assertEquals(1, $first->get('one'));
}
}

0 comments on commit 91c1ee2

Please sign in to comment.