Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/9.0' into task/addBehatTestForFr…
Browse files Browse the repository at this point in the history
…ontendNodeController
  • Loading branch information
mhsdesign committed Nov 8, 2024
2 parents b0b093e + 0bf2d8f commit 563c8f8
Show file tree
Hide file tree
Showing 238 changed files with 5,964 additions and 3,957 deletions.
2 changes: 0 additions & 2 deletions .composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@
"../../bin/phpunit --colors --stop-on-failure -c ../../Build/BuildEssentials/PhpUnit/UnitTests.xml Neos.ContentRepositoryRegistry/Tests/Unit"
],
"test:parallel": [
"FLOW_CONTEXT=Testing/Behat ../../bin/paratest --debug -v --functional --group parallel --processes 2 --colors --stop-on-failure -c ../../Build/BuildEssentials/PhpUnit/FunctionalTests.xml Neos.ContentRepository.BehavioralTests/Tests/Functional/Feature/WorkspacePublication/WorkspaceWritingDuringPublication.php",
"FLOW_CONTEXT=Testing/Behat ../../bin/paratest --debug -v --functional --group parallel --processes 2 --colors --stop-on-failure -c ../../Build/BuildEssentials/PhpUnit/FunctionalTests.xml Neos.ContentRepository.BehavioralTests/Tests/Functional/Feature/WorkspacePublication/WorkspaceWritingDuringPublication.php",
"FLOW_CONTEXT=Testing/Behat ../../bin/paratest --debug -v --functional --group parallel --processes 2 --colors --stop-on-failure -c ../../Build/BuildEssentials/PhpUnit/FunctionalTests.xml Neos.ContentRepository.BehavioralTests/Tests/Functional/Feature/WorkspacePublication/WorkspaceWritingDuringPublication.php"
],
"test:behat-cli": "../../bin/behat -f progress --strict --no-interaction",
Expand Down
8 changes: 8 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,14 @@ jobs:
FLOW_CONTEXT=Testing ./flow doctrine:migrate --quiet
bin/phpunit --colors --stop-on-failure -c Build/BuildEssentials/PhpUnit/FunctionalTests.xml --testsuite "Neos tests" --verbose
- name: Run Parallel Tests for the ES CR
if: matrix.parallel-parts == 'escr-behavioral'
run: |
cd Packages/Neos
hasFailure=0
composer test:parallel || hasFailure=1
cat Neos.ContentRepository.BehavioralTests/Tests/Parallel/log.txt
exit $hasFailure
- name: Run Behavioral Tests (ES CR && Neos.Neos)
id: escrtests
if: matrix.parallel-parts == 'escr-behavioral'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,31 @@ public function iAddTheFollowingHierarchyRelation(TableNode $payloadTable): void
);
}

/**
* @When /^I change the following hierarchy relation's parent:$/
* @throws DBALException
*/
public function iChangeTheFollowingHierarchyRelationsParent(TableNode $payloadTable): void
{
$dataset = $this->transformPayloadTableToDataset($payloadTable);
$record = $this->transformDatasetToHierarchyRelationRecord($dataset);
unset($record['position']);

$newParentHierarchyRelation = $this->findHierarchyRelationByIds(
ContentStreamId::fromString($dataset['contentStreamId']),
DimensionSpacePoint::fromArray($dataset['dimensionSpacePoint']),
NodeAggregateId::fromString($dataset['newParentNodeAggregateId'])
);

$this->dbal->update(
$this->tableNames()->hierarchyRelation(),
[
'parentnodeanchor' => $newParentHierarchyRelation['childnodeanchor']
],
$record
);
}

/**
* @When /^I change the following hierarchy relation's dimension space point hash:$/
* @param TableNode $payloadTable
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ Feature: Run projection integrity violation detection regarding root connection
| language | de, gsw | gsw->de |
And using the following node types:
"""yaml
'Neos.ContentRepository.Testing:Root':
superTypes:
'Neos.ContentRepository:Root': true
'Neos.ContentRepository.Testing:Document': []
"""
And using identifier "default", I define a content repository
Expand All @@ -20,45 +23,54 @@ Feature: Run projection integrity violation detection regarding root connection
| newContentStreamId | "cs-identifier" |

Scenario: Create a cycle
When the event RootNodeAggregateWithNodeWasCreated was published with payload:
When the command CreateRootNodeAggregateWithNode is executed with payload:
| Key | Value |
| workspaceName | "live" |
| contentStreamId | "cs-identifier" |
| nodeAggregateId | "lady-eleonode-rootford" |
| nodeTypeName | "Neos.ContentRepository.Testing:Document" |
| nodeTypeName | "Neos.ContentRepository.Testing:Root" |
| coveredDimensionSpacePoints | [{"language":"de"},{"language":"gsw"}] |
| nodeAggregateClassification | "root" |
When the event NodeAggregateWithNodeWasCreated was published with payload:
When the command CreateNodeAggregateWithNode is executed with payload:
| Key | Value |
| workspaceName | "live" |
| contentStreamId | "cs-identifier" |
| nodeAggregateId | "sir-david-nodenborough" |
| nodeTypeName | "Neos.ContentRepository.Testing:Document" |
| originDimensionSpacePoint | {"language":"de"} |
| coveredDimensionSpacePoints | [{"language":"de"},{"language":"gsw"}] |
| parentNodeAggregateId | "lady-eleonode-rootford" |
| nodeName | "document" |
| nodeAggregateClassification | "regular" |
And the event NodeAggregateWithNodeWasCreated was published with payload:
When the command CreateNodeAggregateWithNode is executed with payload:
| Key | Value |
| workspaceName | "live" |
| contentStreamId | "cs-identifier" |
| nodeAggregateId | "nody-mc-nodeface" |
| nodeTypeName | "Neos.ContentRepository.Testing:Document" |
| originDimensionSpacePoint | {"language":"de"} |
| coveredDimensionSpacePoints | [{"language":"de"},{"language":"gsw"}] |
| parentNodeAggregateId | "sir-david-nodenborough" |
| nodeName | "child-document" |
| nodeAggregateClassification | "regular" |
And the event NodeAggregateWasMoved was published with payload:
| Key | Value |
| workspaceName | "live" |
| contentStreamId | "cs-identifier" |
| nodeAggregateId | "sir-david-nodenborough" |
| newParentNodeAggregateId | "nody-mc-nodeface" |
| succeedingSiblingsForCoverage | [{"dimensionSpacePoint":{"language":"de"},"nodeAggregateId": null},{"dimensionSpacePoint":{"language":"gsw"},"nodeAggregateId": null}] |

When I change the following hierarchy relation's parent:
| Key | Value |
| contentStreamId | "cs-identifier" |
| dimensionSpacePoint | {"language":"de"} |
| parentNodeAggregateId | "lady-eleonode-rootford" |
| childNodeAggregateId | "sir-david-nodenborough" |
| newParentNodeAggregateId | "nody-mc-nodeface" |
And I run integrity violation detection
Then I expect the integrity violation detection result to contain exactly 1 errors
And I expect integrity violation detection result error number 1 to have code 1597754245

# Another error. One error per subgraph
When I change the following hierarchy relation's parent:
| Key | Value |
| contentStreamId | "cs-identifier" |
| dimensionSpacePoint | {"language":"gsw"} |
| parentNodeAggregateId | "lady-eleonode-rootford" |
| childNodeAggregateId | "sir-david-nodenborough" |
| newParentNodeAggregateId | "nody-mc-nodeface" |
And I run integrity violation detection
# one error per subgraph
Then I expect the integrity violation detection result to contain exactly 2 errors
And I expect integrity violation detection result error number 1 to have code 1597754245
And I expect integrity violation detection result error number 2 to have code 1597754245
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,7 @@ Feature: Run integrity violation detection regarding reference relations
| Key | Value |
| sourceOriginDimensionSpacePoint | {"language":"de"} |
| sourceNodeAggregateId | "source-nodandaise" |
| referenceName | "referenceProperty" |
| references | [{"target": "anthony-destinode"}] |
| references | [{"referenceName": "referenceProperty", "references": [{"target": "anthony-destinode"}]}] |
And I detach the following reference relation from its source:
| Key | Value |
| contentStreamId | "cs-identifier" |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
use Neos\ContentRepository\Core\SharedModel\Workspace\ContentStream;
use Neos\ContentRepository\Core\SharedModel\Workspace\ContentStreamId;
use Neos\ContentRepository\Core\SharedModel\Workspace\ContentStreams;
use Neos\ContentRepository\Core\SharedModel\Workspace\ContentStreamStatus;
use Neos\ContentRepository\Core\SharedModel\Workspace\Workspace;
use Neos\ContentRepository\Core\SharedModel\Workspace\WorkspaceName;
use Neos\ContentRepository\Core\SharedModel\Workspace\Workspaces;
Expand Down Expand Up @@ -72,11 +71,6 @@ public function getContentGraph(WorkspaceName $workspaceName): ContentGraph
return new ContentGraph($this->dbal, $this->nodeFactory, $this->contentRepositoryId, $this->nodeTypeManager, $this->tableNames, $workspaceName, $currentContentStreamId);
}

public function buildContentGraph(WorkspaceName $workspaceName, ContentStreamId $contentStreamId): ContentGraph
{
return new ContentGraph($this->dbal, $this->nodeFactory, $this->contentRepositoryId, $this->nodeTypeManager, $this->tableNames, $workspaceName, $contentStreamId);
}

public function findWorkspaceByName(WorkspaceName $workspaceName): ?Workspace
{
$workspaceQuery = $this->getBasicWorkspaceQuery()
Expand Down Expand Up @@ -109,7 +103,7 @@ public function findContentStreamById(ContentStreamId $contentStreamId): ?Conten
{
$contentStreamByIdStatement = <<<SQL
SELECT
id, sourceContentStreamId, status, version, removed
id, sourceContentStreamId, version, closed
FROM
{$this->tableNames->contentStream()}
WHERE
Expand All @@ -133,7 +127,7 @@ public function findContentStreams(): ContentStreams
{
$contentStreamsStatement = <<<SQL
SELECT
id, sourceContentStreamId, status, version, removed
id, sourceContentStreamId, version, closed
FROM
{$this->tableNames->contentStream()}
SQL;
Expand Down Expand Up @@ -165,7 +159,7 @@ private function getBasicWorkspaceQuery(): QueryBuilder
$queryBuilder = $this->dbal->createQueryBuilder();

return $queryBuilder
->select('ws.name, ws.baseWorkspaceName, ws.currentContentStreamId, cs.sourceContentStreamVersion != scs.version as baseWorkspaceChanged')
->select('ws.name, ws.baseWorkspaceName, ws.currentContentStreamId, cs.hasChanges, cs.sourceContentStreamVersion = scs.version as upToDateWithBase')
->from($this->tableNames->workspace(), 'ws')
->join('ws', $this->tableNames->contentStream(), 'cs', 'cs.id = ws.currentcontentstreamid')
->leftJoin('cs', $this->tableNames->contentStream(), 'scs', 'scs.id = cs.sourceContentStreamId');
Expand All @@ -177,33 +171,39 @@ private function getBasicWorkspaceQuery(): QueryBuilder
private static function workspaceFromDatabaseRow(array $row): Workspace
{
$baseWorkspaceName = $row['baseWorkspaceName'] !== null ? WorkspaceName::fromString($row['baseWorkspaceName']) : null;
$status = match ($row['baseWorkspaceChanged']) {

if ($baseWorkspaceName === null) {
// no base workspace, a root is always up-to-date
null => WorkspaceStatus::UP_TO_DATE,
// base workspace didnt change (sql 0 is _false_)
0 => WorkspaceStatus::UP_TO_DATE,
default => WorkspaceStatus::OUTDATED,
};
$status = WorkspaceStatus::UP_TO_DATE;
} elseif ($row['upToDateWithBase'] === 1) {
// base workspace didnt change
$status = WorkspaceStatus::UP_TO_DATE;
} else {
// base content stream was removed or contains newer changes
$status = WorkspaceStatus::OUTDATED;
}

return new Workspace(
return Workspace::create(
WorkspaceName::fromString($row['name']),
$baseWorkspaceName,
ContentStreamId::fromString($row['currentContentStreamId']),
$status,
$baseWorkspaceName === null
? false
: (bool)$row['hasChanges'],
);
}

/**
* @param array<string, mixed> $row todo fetch source content stream version and use for publishing as expected version
* @param array<string, mixed> $row
*/
private static function contentStreamFromDatabaseRow(array $row): ContentStream
{
return new ContentStream(
return ContentStream::create(
ContentStreamId::fromString($row['id']),
isset($row['sourceContentStreamId']) ? ContentStreamId::fromString($row['sourceContentStreamId']) : null,
ContentStreamStatus::from($row['status']),
Version::fromInteger((int)$row['version']),
(bool)$row['removed']
(bool)$row['closed'],
);
}
}
Loading

0 comments on commit 563c8f8

Please sign in to comment.