Skip to content

Commit 66b0d5a

Browse files
committed
upgrade to cypher datastructures 0.2.0 wip
1 parent 75e4f34 commit 66b0d5a

File tree

69 files changed

+1611
-968
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

69 files changed

+1611
-968
lines changed

composer.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@
5353
},
5454
"scripts": {
5555
"test": "export ENABLE_FEATURE_TEST=true && echo -n \"\" > ./tests/test.log && php vendor/phpunit/phpunit/phpunit",
56+
"test:current": "export ENABLE_FEATURE_TEST=true && echo -n \"\" > ./tests/test.log && php vendor/phpunit/phpunit/phpunit --group current",
5657
"test:coverage:xml": "export XDEBUG_MODE=coverage && php ./vendor/phpunit/phpunit/phpunit --coverage-clover coverage.xml",
5758
"test:coverage:html": "export XDEBUG_MODE=coverage && php ./vendor/phpunit/phpunit/phpunit --coverage-html ./tmp",
5859
"test:mutant": "export XDEBUG_MODE=coverage && php vendor/infection/infection/bin/infection --threads=4",

src/EventListener/Neo4j/NodeConstraintCreateToStatementEventListener.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ public static function nodeConstraintStatement(NodeConstraintInterface $nodeCons
5050
throw InvalidArgumentException::createForConstraintForIsNull();
5151
}
5252
$properties = [];
53-
foreach ($nodeConstraint->getProperties() as $propertyName) {
53+
foreach ($nodeConstraint->getProperties() as $propertyName => $propertyValue) {
5454
$properties[] = sprintf("e.%s", $propertyName);
5555
}
5656
$type = $nodeConstraint->getType();

src/EventListener/Neo4j/RelationConstraintCreateToStatementEventListener.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ public static function relationConstraintStatement(RelationConstraintInterface $
5050
throw InvalidArgumentException::createForConstraintForIsNull();
5151
}
5252
$properties = [];
53-
foreach ($relationConstraint->getProperties() as $propertyName) {
53+
foreach ($relationConstraint->getProperties() as $propertyName => $propertyValue) {
5454
$properties[] = sprintf("e.%s", $propertyName);
5555
}
5656
$constraintType = $relationConstraint->getType();

src/Helper/StructureHelper.php

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public static function identifiersToStructure(array $identifiers): string
2525
{
2626
$internalIdentifiers = [];
2727
$publicIdentifiers = [];
28-
foreach ($identifiers as $key) {
28+
foreach ($identifiers as $key => $value) {
2929
if (str_starts_with($key, '_')) {
3030
$internalIdentifiers[] = $key;
3131
} else {
@@ -61,11 +61,15 @@ public static function getRelationStructure(RelationInterface $relation): string
6161
{
6262
$startNode = $relation->getStartNode();
6363
if (!$startNode) {
64-
throw new InvalidArgumentException('start node can not be null');
64+
throw InvalidArgumentException::createForStartNodeIsNull();
6565
}
6666
$endNode = $relation->getEndNode();
6767
if (!$endNode) {
68-
throw new InvalidArgumentException('end node can not be null');
68+
throw InvalidArgumentException::createForEndNodeIsNull();
69+
}
70+
$type = $relation->getType();
71+
if (!$type) {
72+
throw InvalidArgumentException::createForRelationTypeIsNull();
6973
}
7074
if (0 === count($relation->getIdentifiers())) {
7175
throw new InvalidArgumentException('at least one relation identifier is required');
@@ -74,7 +78,7 @@ public static function getRelationStructure(RelationInterface $relation): string
7478
$parts[] = self::getNodeStructure($startNode);
7579
$parts[] = sprintf(
7680
"-[%s %s]->",
77-
$relation->getType(),
81+
$type,
7882
self::identifiersToStructure($relation->getIdentifiers())
7983
);
8084
$parts[] = self::getNodeStructure($endNode);

tests/ContainerTestCase.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@
1818
use Syndesi\CypherEntityManager\EventListener\Neo4j\NodeConstraintDeleteToStatementEventListener;
1919
use Syndesi\CypherEntityManager\EventListener\Neo4j\NodeIndexCreateToStatementEventListener;
2020
use Syndesi\CypherEntityManager\EventListener\Neo4j\NodeIndexDeleteToStatementEventListener;
21+
use Syndesi\CypherEntityManager\EventListener\Neo4j\RelationConstraintCreateToStatementEventListener;
22+
use Syndesi\CypherEntityManager\EventListener\Neo4j\RelationConstraintDeleteToStatementEventListener;
23+
use Syndesi\CypherEntityManager\EventListener\Neo4j\RelationIndexCreateToStatementEventListener;
24+
use Syndesi\CypherEntityManager\EventListener\Neo4j\RelationIndexDeleteToStatementEventListener;
2125
use Syndesi\CypherEntityManager\EventListener\OpenCypher\NodeCreateToStatementEventListener;
2226
use Syndesi\CypherEntityManager\EventListener\OpenCypher\NodeDeleteToStatementEventListener;
2327
use Syndesi\CypherEntityManager\EventListener\OpenCypher\NodeMergeToStatementEventListener;
@@ -68,6 +72,10 @@ protected function setUp(): void
6872
$listenerProvider->addSubscriber(NodeIndexDeleteToStatementEventListener::class, NodeIndexDeleteToStatementEventListener::class);
6973
$listenerProvider->addSubscriber(NodeConstraintCreateToStatementEventListener::class, NodeConstraintCreateToStatementEventListener::class);
7074
$listenerProvider->addSubscriber(NodeConstraintDeleteToStatementEventListener::class, NodeConstraintDeleteToStatementEventListener::class);
75+
$listenerProvider->addSubscriber(RelationIndexCreateToStatementEventListener::class, RelationIndexCreateToStatementEventListener::class);
76+
$listenerProvider->addSubscriber(RelationIndexDeleteToStatementEventListener::class, RelationIndexDeleteToStatementEventListener::class);
77+
$listenerProvider->addSubscriber(RelationConstraintCreateToStatementEventListener::class, RelationConstraintCreateToStatementEventListener::class);
78+
$listenerProvider->addSubscriber(RelationConstraintDeleteToStatementEventListener::class, RelationConstraintDeleteToStatementEventListener::class);
7179
$this->container->set(ListenerProviderInterface::class, $listenerProvider);
7280
$this->container->set(EventDispatcherInterface::class, new Dispatcher(
7381
$this->container->get(ListenerProviderInterface::class),

tests/Event/ConstraintPostCreateEventTest.php

Lines changed: 0 additions & 30 deletions
This file was deleted.

tests/Event/ConstraintPostDeleteEventTest.php

Lines changed: 0 additions & 30 deletions
This file was deleted.

tests/Event/ConstraintPreCreateEventTest.php

Lines changed: 0 additions & 30 deletions
This file was deleted.

tests/Event/ConstraintPreDeleteEventTest.php

Lines changed: 0 additions & 30 deletions
This file was deleted.

tests/Event/IndexPostCreateEventTest.php

Lines changed: 0 additions & 30 deletions
This file was deleted.

0 commit comments

Comments
 (0)