Skip to content

Commit 91c1ee2

Browse files
committed
tested getResult
As pointed out by florent here: neo4j-examples/movies-php-client#2
1 parent dcafe33 commit 91c1ee2

File tree

2 files changed

+24
-1
lines changed

2 files changed

+24
-1
lines changed

src/Databags/SummarizedResult.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ public function getSummary(): ResultSummary
5757
return $this->summary;
5858
}
5959

60-
public function getResult(): CypherList
60+
public function getResults(): CypherList
6161
{
6262
return new CypherList($this);
6363
}

tests/Integration/SummarizedResultFormatterTest.php

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
use Laudis\Neo4j\Databags\SummarizedResult;
2121
use Laudis\Neo4j\Databags\SummaryCounters;
2222
use Laudis\Neo4j\Formatter\SummarizedResultFormatter;
23+
use Laudis\Neo4j\Types\CypherList;
2324
use Laudis\Neo4j\Types\CypherMap;
2425
use function random_bytes;
2526

@@ -59,4 +60,26 @@ public function testAcceptanceWrite(string $alias): void
5960
}, $alias)->getSummary()->getCounters();
6061
self::assertEquals(new SummaryCounters(1, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, true), $counters);
6162
}
63+
64+
/**
65+
* @dataProvider connectionAliases
66+
*
67+
* @throws Exception
68+
*/
69+
public function testGetResults(string $alias): void
70+
{
71+
$results = $this->getClient()->run('RETURN 1 AS one', [], $alias)->getResults();
72+
73+
self::assertNotInstanceOf(SummarizedResult::class, $results);
74+
self::assertInstanceOf(CypherList::class, $results);
75+
76+
$jsonSerialize = $results->jsonSerialize();
77+
self::assertIsArray($jsonSerialize);
78+
self::assertArrayNotHasKey('summary', $jsonSerialize);
79+
self::assertArrayNotHasKey('result', $jsonSerialize);
80+
81+
$first = $results->first();
82+
self::assertInstanceOf(CypherMap::class, $first);
83+
self::assertEquals(1, $first->get('one'));
84+
}
6285
}

0 commit comments

Comments
 (0)